Commit a171d2fb authored by jingnan's avatar jingnan 👀

领用出库申请联调

parent 9a37e807
......@@ -23,8 +23,7 @@
model-name="OutStorageUse"
:lay-config="cmpOptions"
:basic-data="{...basicData,useRequestType:basicData.typeName||typeName}"
:on-form-event-hander="formEventHander"
@on-cancel="cancelHandler"
@on-cancelCreate="cancelHandler"
/>
</div>
</template>
......@@ -60,17 +59,6 @@ export default {
typeName: 'OutStorageUse',
layKey: 'outStorageUseApplyAdd_useAO'
},
formEventHander: {
'on-submit': () => {
if (!this.formData || !this.formData.typeName) {
return this.$message.error('请选择一种领用类型')
}
this.$emit('on-submit', this.formData)
},
'on-cancel': () => {
this.$emit('on-cancel')
}
},
outStorageUseId: [] // 取消使解除占用操作需要
}
},
......
......@@ -71,7 +71,7 @@ export default {
handler(val) {
this.$set(this.cmpOptions, 'layKey', `outStorageUseMaterial_Add_${val}`)
switch (val) {
case 'useAO':
case 'useAO' || 'noAO':
this.amountItemLabel = '申领数量'
break
case 'swapUse':
......@@ -96,6 +96,7 @@ export default {
this.$refs['applyForm'].validate((valid) => {
if (valid && this.selection) {
if (this.applyForm.reqAmount > this.selection.unableAmount) return this.$utils.showMessageWarning('申领数量不能大于当前选中物料的可用数量!')
const typeName = this.basicData.useRequestType
const data = [{
'subTypeName': 'OutStorageUseItem',
'extMaterial': this.selection.extMaterial,
......@@ -106,11 +107,11 @@ export default {
'unableAmount': this.selection.unableAmount,
'reqAmount': this.applyForm.reqAmount
}]
if (this.basicData.useRequestType === 'swapUse') {
if (typeName === 'swapUse') {
data[0].extSupportingItemVO = this.selectDatas[0].extSupportingItemVO
} else if (this.basicData.useRequestType === 'scrapUse') {
} else if (typeName === 'scrapUse' || typeName === 'useAO') {
data[0].extSupportingItemVO = this.selection.extSupportingItemVO
data[0].extSupportingItemId = this.selection.extSupportingItemVO.id
data[0].extSupportingItemId = this.selection.extSupportingItemVO && this.selection.extSupportingItemVO.id
}
this.$emit('submitEvent', { formData: data, addContinue })
this.cleanAddForm()
......@@ -137,6 +138,9 @@ export default {
}
.applyForm{
margin-top: 30px;
.el-input-number{
width: 180px;
}
}
.foot-btn-box{
display: flex;
......
......@@ -147,6 +147,13 @@ export default {
})
}
})
// 申领数量编辑时同步修改占用数量
this.$bus.$on('changeAllocatedAmount', ({ index, inventoryJobResponses, allocatedAmount }) => {
if (this.tableData[index]) {
this.$set(this.tableData[index], 'inventoryJobResponses', inventoryJobResponses)
this.$set(this.tableData[index], 'allocatedAmount', allocatedAmount)
}
})
},
methods: {
tableToolHandler(val) {
......@@ -187,10 +194,10 @@ export default {
const form = Object.assign({}, this.form)
form.aircraftType = form.aircraftType.includes('+') && form.aircraftType.split('+')[1] || form.aircraftType
form.sorties = form.sorties.includes('+') && form.sorties.split('+')[1] || form.sorties
const typeName = this.basicData.useRequestType
const param = {
...form,
typeName: this.basicData.useRequestType, // 领用类型
typeName: typeName, // 领用类型
inStorageRequestItems: this.selectionRows,
subTypeName: 'OutStorageUse',
operator: 'ADD'
......@@ -204,7 +211,7 @@ export default {
data.forEach(item => {
tableData.forEach(v => {
let flag = v.extMaterialId === item.extMaterialId
if (this.basicData.useRequestType === 'scrapUse') {
if (typeName === 'scrapUse' || typeName === 'useAO') {
flag = v.extSupportingItemId === item.extSupportingItemId && v.extMaterialId === item.extMaterialId
} else {
flag = v.extMaterialId === item.extMaterialId
......
......@@ -8,7 +8,7 @@
clearable
:remote-method="remoteMethod"
:disabled="disabled"
:placeholder="options.length?'请选择':'暂无数据'"
:placeholder="!options.length?'至少输入三位进行查询':'暂无数据'"
@change="change"
@clear="clear"
>
......@@ -72,14 +72,14 @@ export default {
methods: {
remoteMethod(query, id) {
if (!this.form || !this.form.sorties) return this.$utils.showMessageWarning('请选择架次后查询!')
if ((!query || query.length < 1) && !id) return
if ((!query || query.length < 3) && !id) return
if (this.remoteFlag) {
this.remoteFlag = false
this.tableColumnSelect = true
let requestUrl = 'ExtProcessPlan'
let queryNo = 'serialNumber'
if (this.basicData.useRequestType === 'useAO') {
requestUrl = 'AbsentAO' // 指令AbsentAO
if (this.basicData.useRequestType === 'noAO') {
requestUrl = 'AbsentAO' // 指令AbsentAO
queryNo = 'aoNo'
} else {
requestUrl = 'ExtProcessPlan'
......@@ -87,7 +87,7 @@ export default {
}
const params = {
'pageFrom': 1,
'pageSize': 999,
'pageSize': 10,
'searchItems': {
'items': [
{
......
/**
* @Description: 申领数量行内编辑
* @author gjn
* @date 2023-09-07
*/
<template>
<div class="EditReqAmount">
<el-input-number v-model="reqAmount" size="small" :min="0" :max="maxNum" @change="handleChange" />
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '申领数量行内编辑',
name: 'EditReqAmount',
components: {},
props: {
scope: {
type: Object,
default: () => {}
},
form: {
type: Object,
default: () => {}
},
value: {
type: Number,
default: 0
}
},
data() {
return {
reqAmount: 0,
maxNum: 999999
}
},
computed: {},
watch: {
'form.reqAmount': {
immediate: true,
handler(val) {
this.reqAmount = val
}
},
'form.unableAmount': {
immediate: true,
handler(val) {
val && (this.maxNum = val)
}
}
},
created() {
},
methods: {
handleChange() {
this.$emit('input', this.reqAmount)
if (this.form.id) {
this.changeAmount()
}
},
changeAmount(val) {
const params = {
...this.form,
reqAmount: this.reqAmount,
operator: 'MODIFY'
}
post(`InStorageRequestItem/inStorageRequestItem/update`, params).then(res => {
this.$message({
type: 'success',
message: '数量编辑成功!'
})
if (res.items && res.items.inventoryJobResponses) {
const allocatedAmount = this.$utils.sumArray(res.items.inventoryJobResponses, 'allocatedAmount')
this.$set(this.scope.row, 'allocatedAmount', allocatedAmount)
this.$bus.$emit('changeAllocatedAmount', { index: this.scope.$index, allocatedAmount, inventoryJobResponses: res.items.inventoryJobResponses })
}
}).catch((err) => {
console.log(err)
})
}
}
}
</script>
<style lang='scss'>
</style>
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