Commit 7c2feb6d authored by xioln's avatar xioln

供外出库调整占用

parent 5146bee6
...@@ -1549,6 +1549,21 @@ export function fileByIdDownload(objName, objId, linkId) { ...@@ -1549,6 +1549,21 @@ export function fileByIdDownload(objName, objId, linkId) {
this.downLoadFile(res) this.downLoadFile(res)
}) })
} }
/**
* @Description: 查找DeeForm
* @author xioln
*/
export function findForm(elem = this) {
// 检查当前元素是否是 el-form
if (elem.$el && elem.$el.classList.contains('el-form')) {
return elem // 找到了 el-form,返回当前
}
// 检查是否存在父组件
if (elem.$parent) {
return findForm(elem.$parent) // 递归调用父组件
}
return null // 没有找到 el-form,返回 null
}
export default { export default {
treeFindBackArray, treeFindBackArray,
...@@ -1631,5 +1646,6 @@ export default { ...@@ -1631,5 +1646,6 @@ export default {
groupBy, groupBy,
filterParams, filterParams,
deepClone, deepClone,
fileByIdDownload fileByIdDownload,
findForm
} }
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
<div class="AddOutStorageMaterialDetailDialog-diloag"> <div class="AddOutStorageMaterialDetailDialog-diloag">
<dee-as-com <dee-as-com
ref="materielSearch" ref="materielSearch"
:lay-config="{ typeName: 'Inventory', layKey: 'search_sanqichukuwuliaomingxi'}" :lay-config="{ typeName: 'Inventory', layKey: 'search_sanqichukuwuliaomingxi' }"
:basic-data="defaultData" :basic-data="defaultData"
@searchEvent="searchEvent" @searchEvent="searchEvent"
/> />
<dee-as-com <dee-as-com
ref="materielTable" ref="materielTable"
class="list-table" class="list-table"
:lay-config="{ typeName: 'Inventory', layKey: 'table_sanqichukuwuliaomingxi'}" :lay-config="{ typeName: 'Inventory', layKey: 'table_sanqichukuwuliaomingxi' }"
@selectionChange="selectionChange" @selectionChange="selectionChange"
/> />
<div slot="footer" class="foot-btn-box"> <div slot="footer" class="foot-btn-box">
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
props: { props: {
basicData: { basicData: {
type: Object, type: Object,
default: () => {} default: () => { }
} }
}, },
data() { data() {
...@@ -126,16 +126,16 @@ export default { ...@@ -126,16 +126,16 @@ export default {
} }
</script> </script>
<style lang='scss'> <style lang='scss'>
.AddOutStorageMaterialDetailDialog-diloag{ .AddOutStorageMaterialDetailDialog-diloag {
.list-table{ .list-table {
height: 510px!important; height: 510px !important;
} }
.foot-btn-box{
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
.foot-btn-box {
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style> </style>
...@@ -51,8 +51,8 @@ export default { ...@@ -51,8 +51,8 @@ export default {
'form.sorties': { 'form.sorties': {
immediate: true, immediate: true,
deep: true, deep: true,
handler(val) { handler(val, oldVal) {
if (val) { if (val !== oldVal) {
const params = { const params = {
searchItems: { searchItems: {
items: [ items: [
......
/**
* @Description: 供外出库调整占用申领数量
* @author xioln
* @date 2023-08-02
*/
<template>
<div class="outStorageAdjustOccupy-reqAmount">
<el-input-number v-model="reqAmount" :min="0" :max="maxNum" @change="handleChange" />
</div>
</template>
<script>
export default {
componentName: '供外出库调整占用申领数量',
name: 'OutStorageCallBackReqAmount',
components: {},
props: {
form: {
type: Object,
default: () => {}
},
value: {
type: Number,
default: 0
}
},
data() {
return {
reqAmount: 0,
maxNum: 0
}
},
computed: {},
created() {
// 初始化数据
if (this.value !== '0') {
this.reqAmount = Number(this.value)
}
if (this.form.reqAmount) {
this.maxNum = this.form.reqAmount
} else {
this.maxNum = 10
}
},
methods: {
handleChange() {
this.$emit('input', this.reqAmount)
}
}
}
</script>
<style lang='scss'>
</style>
/**
* @Description: 供外出库调整占用
* @author xioln
* @date 2023-08-23
* @FilePath: applications/dee-mes/src/privateComponents/components/OutStorageOfferAdjustOccupy/index.vue
*/
<template>
<div class="OutStorageOfferAdjustOccupy">
<DeeAsCom
ref="adjustOccupyInfo"
:basic-data="basicData"
:lay-config="{
typeName: 'OutStorageOutItem',
layKey: 'adjustOccupyTable'
}"
/>
<DeeAsCom
ref="adjustOccupyInventory"
:basic-data="basicData"
:lay-config="{
typeName: 'JobResponseOutStorageOut',
layKey: 'table'
}"
/>
</div>
</template>
<script>
export default {
componentName: '供外出库调整占用',
name: 'OutStorageOfferAdjustOccupy', // name写在组件的最前方,自定义组件为必填
components: {},
data() {
return {
}
},
computed: {},
created() {
// 初始化数据
},
methods: {
}
}
</script>
<style lang='scss'>
</style>
/**
* @Description: 供外出库调整占用
* @author xioln
* @date 2023-08-23
*/
<template>
<div class="outStorageOffer-adjustOccupy">
<DeeAsCom
ref="adjustOccupyInfo"
:basic-data="selectDatas[0]"
:form="form"
:lay-config="{
typeName: 'Inventory',
layKey: 'adjustOccupyTable'
}"
@selectionChange="infoSelectionChange"
/>
<div style="height: 80px; text-align: center;display: flex;justify-content: center;align-items: center;">
<el-button type="primary" size="medium" round icon="el-icon-caret-top" @click="relieve">解除</el-button>
<el-button type="primary" round icon="el-icon-caret-bottom" @click="occupy">占用</el-button>
</div>
<DeeAsCom
ref="adjustOccupyjobResponse"
:basic-data="selectDatas[0]"
:lay-config="{
typeName: 'JobResponseOutStorageOut',
layKey: 'table',
}"
@selectionChange="jobResponseSelectionChange"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '供外出库调整占用',
name: 'OutStorageOfferAdjustOccupy', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
// basicData: {
// type: Object,
// default: () => { }
// },
selectDatas: {
type: Array,
default: () => {}
},
form: {
type: Object,
default: () => {}
}
},
data() {
return {
infoSelection: [],
jobResponseSelection: []
}
},
computed: {},
created() {
// 初始化数据
},
methods: {
infoSelectionChange(v) {
this.infoSelection = v
},
jobResponseSelectionChange(v) {
this.jobResponseSelection = v
},
// 解除占用
relieve() {
if (this.jobResponseSelection.length === 0) {
return this.$utils.showMessageWarning('请选择响应数据!')
}
const ids = this.jobResponseSelection.map(item => item.id).join(',')
post('InStorageRequestItem/adjust/cancelTake?jobResponseIds=' + ids).then(res => {
this.$utils.showMessageSuccess('解除占用成功!')
this.refeach()
}).catch((err) => {
console.log(err)
})
},
// 手动占用
occupy() {
const param = this.infoSelection.map(item => {
if (item.allocatedAmount === 0 || !item.hasOwnProperty('allocatedAmount')) {
return this.$utils.showMessageWarning('请输入分配数量!')
} else {
return {
inventoryId: item.id,
allocatedAmount: item.allocatedAmount
}
}
})
console.log('param', param)
if (!param.includes(undefined)) {
post('InStorageRequestItem/adjust/reTake?itemId=' + this.selectDatas[0].id, param).then(res => {
this.$utils.showMessageSuccess('占用成功!')
this.refeach()
}).catch((err) => {
console.log(err)
})
}
},
refeach() {
this.$refs.adjustOccupyInfo.$refs.asCom.getData()
this.$refs.adjustOccupyjobResponse.$refs.asCom.getData()
}
}
}
</script>
<style lang='scss'>
.outStorageOffer-adjustOccupy{
}
</style>
...@@ -15,23 +15,31 @@ ...@@ -15,23 +15,31 @@
> >
<dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" /> <dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" />
</dee-table> </dee-table>
<dee-dialog width="70%" title="添加供外出库申请明细" :visible="dialogVisible"> <dee-dialog width="70%" title="添加供外出库申请明细" :visible.sync="dialogVisible" @on-cancel="cancel">
<addOutStorageOfferDetailDialog ref="addOffer" :basic-data="form" @submitEvent="addData" @cancel="cancel" /> <addOutStorageOfferDetailDialog ref="addOffer" :basic-data="form" @submitEvent="addData" />
</dee-dialog>
<dee-dialog width="70%" title="调整占用" :visible.sync="aoDialogVisible" @on-cancel="aoCancel">
<OutStorageOfferAdjustOccupy ref="adjustOffer" :select-datas="selectTableData" :form="form" @submitEvent="addData" />
</dee-dialog> </dee-dialog>
</div> </div>
</template> </template>
<script> <script>
import AddOutStorageOfferDetailDialog from './components/addOutStorageOfferDetailDialog' import AddOutStorageOfferDetailDialog from './components/addOutStorageOfferDetailDialog'
import OutStorageOfferAdjustOccupy from './components/outStorageOfferAdjustOccupy'
import { post } from '@/utils/http' import { post } from '@/utils/http'
export default { export default {
componentName: '供外出库申请明细', componentName: '供外出库申请明细',
name: 'OutStorageOfferDetail', name: 'OutStorageOfferDetail',
components: { AddOutStorageOfferDetailDialog }, components: { AddOutStorageOfferDetailDialog, OutStorageOfferAdjustOccupy },
props: { props: {
form: { form: {
type: Object, type: Object,
required: true required: true
},
basicData: {
type: Object,
required: true
} }
}, },
data() { data() {
...@@ -44,7 +52,7 @@ export default { ...@@ -44,7 +52,7 @@ export default {
{ title: '规格', key: 'extMaterial.spec', align: 'center' }, { title: '规格', key: 'extMaterial.spec', align: 'center' },
{ title: '单位名称', key: 'extMaterial.extUnit.unitName', align: 'center' }, { title: '单位名称', key: 'extMaterial.extUnit.unitName', align: 'center' },
{ {
title: '申领数量', key: 'reqAmount', align: 'center', minWidth: '120', title: '申领数量', key: 'reqAmount', align: 'center', minWidth: '160', fixed: 'right',
component: { component: {
show: true, show: true,
render: (h, data, column, index) => { render: (h, data, column, index) => {
...@@ -71,11 +79,17 @@ export default { ...@@ -71,11 +79,17 @@ export default {
icon: '/icons/c-add.png', icon: '/icons/c-add.png',
handler: { handler: {
click: () => { click: () => {
if (!this.form.extWorkCenterId) { this.$utils.findForm(this).validate((isok) => {
this.$utils.showMessageWarning('请先选择库房!') if (isok) {
return if (!this.form.extWorkCenterId) {
} this.$utils.showMessageWarning('请先选择库房!')
this.dialogVisible = true return
}
this.dialogVisible = true
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
} }
} }
}, },
...@@ -84,7 +98,33 @@ export default { ...@@ -84,7 +98,33 @@ export default {
icon: '/icons/c-creatBook.png', icon: '/icons/c-creatBook.png',
handler: { handler: {
click: () => { click: () => {
this.occupy() this.$utils.findForm(this).validate((isok) => {
if (isok) {
// 校验通过
this.occupy()
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
},
{
name: '调整占用',
icon: '/icons/c-newchangeapp.png',
handler: {
click: () => {
if (this.selectTableData.length === 1) {
if (this.selectTableData[0].hasOwnProperty('id')) {
this.aoDialogVisible = true
} else {
this.$utils.showMessageWarning('请先保存占用!')
}
} else if (this.selectTableData.length > 1) {
this.$utils.showMessageWarning('只能勾选一条明细!')
} else {
this.$utils.showMessageWarning('请先选择要调整的明细!')
}
} }
} }
}, },
...@@ -97,7 +137,9 @@ export default { ...@@ -97,7 +137,9 @@ export default {
} }
} }
}], }],
param: {} param: {},
aoDialogVisible: false,
selectTableData: []
} }
}, },
computed: { computed: {
...@@ -115,8 +157,8 @@ export default { ...@@ -115,8 +157,8 @@ export default {
// 初始化数据 // 初始化数据
}, },
mounted() { mounted() {
if (this.$route.query.id) { if (this.basicData.id) {
this.getEditData(this.$route.query.id) this.getEditData()
} }
}, },
methods: { methods: {
...@@ -131,11 +173,13 @@ export default { ...@@ -131,11 +173,13 @@ export default {
cancel() { cancel() {
this.dialogVisible = false this.dialogVisible = false
}, },
aoCancel() {
this.aoDialogVisible = false
},
occupy() { occupy() {
const form = { ...this.form } const form = { ...this.form }
form.aircraftType = form.aircraftType.split('+')[1] form.aircraftType = form.aircraftType.split('+')[1]
form.sorties = form.sorties.split('+')[1] form.sorties = form.sorties.split('+')[1]
const param = { const param = {
...form, ...form,
inStorageRequestItems: this.tableData, inStorageRequestItems: this.tableData,
...@@ -143,7 +187,7 @@ export default { ...@@ -143,7 +187,7 @@ export default {
operator: 'ADD' operator: 'ADD'
} }
post('OutStorageRequest/outStorageOut/saveAndTake', param).then(res => { post('OutStorageRequest/outStorageOut/saveAndTake', param).then(res => {
console.log('res', res) this.$utils.showMessageSuccess('占用成功!')
const data = res.items.inStorageRequestItems const data = res.items.inStorageRequestItems
const tableData = [...this.tableData] const tableData = [...this.tableData]
data.forEach(item => { data.forEach(item => {
...@@ -183,45 +227,46 @@ export default { ...@@ -183,45 +227,46 @@ export default {
}) })
}) })
}, },
getEditData(id) { getEditData() {
const param = { this.tableData.push(...this.basicData.inStorageRequestItems)
'searchItems': { // const param = {
'items': [ // 'searchItems': {
{ 'fieldName': 'subTypeName', 'operator': 'EQ', 'value': 'OutStorageOut' }, // 'items': [
{ 'fieldName': 'id', 'operator': 'EQ', 'value': id } // { 'fieldName': 'subTypeName', 'operator': 'EQ', 'value': 'OutStorageOut' },
] // { 'fieldName': 'id', 'operator': 'EQ', 'value': id }
}, // ]
openProps: [{ // },
'name': 'inStorageRequestItems', // openProps: [{
'openProps': [{ // 'name': 'inStorageRequestItems',
'name': 'extMaterial', // 'openProps': [{
'openProps': [{ // 'name': 'extMaterial',
'name': 'resType2' // 'openProps': [{
}, { // 'name': 'resType2'
'name': 'extUnit' // }, {
}] // 'name': 'extUnit'
}, { // }]
'name': 'extDxSipplier' // }, {
}, { // 'name': 'extDxSipplier'
'name': 'creator' // }, {
}, { // 'name': 'creator'
'name': 'storageZone' // }, {
}, // 'name': 'storageZone'
{ // },
'name': 'inventoryJobResponses' // {
}] // 'name': 'inventoryJobResponses'
}] // }]
} // }]
post('OutStorageRequest/search', param).then(res => { // }
console.log('res', res) // post('OutStorageRequest/search', param).then(res => {
const data = res.items.content[0].inStorageRequestItems // console.log('res', res)
data.forEach(item => { // const data = res.items.content[0].inStorageRequestItems
item.allocatedAmount = this.sumArray(item.inventoryJobResponses, 'allocatedAmount') // data.forEach(item => {
}) // item.allocatedAmount = this.sumArray(item.inventoryJobResponses, 'allocatedAmount')
this.tableData = data // })
}).catch((err) => { // this.tableData = data
console.log(err) // }).catch((err) => {
}) // console.log(err)
// })
}, },
sumArray(array, key) { sumArray(array, key) {
let sum = 0 let sum = 0
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
} }
} }
}, },
form: { 'form.extProductAreaId': {
immediate: true, immediate: true,
deep: true, deep: true,
handler() { handler() {
......
...@@ -52,8 +52,8 @@ export default { ...@@ -52,8 +52,8 @@ export default {
'form.aircraftType': { 'form.aircraftType': {
immediate: true, immediate: true,
deep: true, deep: true,
handler(val) { handler(val, oldVal) {
if (val) { if (val !== oldVal) {
const params = { const params = {
searchItems: { searchItems: {
items: [{ 'fieldName': 'aircraftTypeId', operator: 'EQ', value: val.split('+')[0] }], items: [{ 'fieldName': 'aircraftTypeId', operator: 'EQ', value: val.split('+')[0] }],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment