This commit is contained in:
蔡玲
2024-11-15 15:58:00 +08:00
parent f56681ddcd
commit 7309f5e425
3 changed files with 71 additions and 29 deletions

View File

@@ -95,7 +95,7 @@
<td>{{el.kclx}}</td>
<td>{{el.kczt}}</td>
<td>
<input class="td_input" type="number" confirm-type="go" v-model="el.sl" @blur="updateNum(e, el)" @confirm="updateNum(e, el)"/>
<input class="td_input" type="number" confirm-type="go" v-model="el.sl" @focus="focusInput(e, el)" @blur="updateNum(e, el)" @confirm="updateNum(e, el)"/>
</td>
<td @tap.stop="showPop(1, e, el)">
<view class="zd-row td_change">
@@ -175,7 +175,6 @@
dataList: [], // 一级表格数据
popData: [], // 副表格点击物料编码弹出弹窗
popObj: {}, // 弹窗当前主表格内容
popObj1: {},
show: false, // 弹窗显示布尔值
type: '', // 弹窗类型
delShow: false, // 详情弹窗布尔值
@@ -183,6 +182,8 @@
value: '', // 选择仓库名称
range: [],
disabled1: false,
raw: '', // 副表格修改前输入框数据
rawObj: {} // 副表格修改前行数据
}
},
onLoad () {
@@ -319,16 +320,47 @@
this.disabled1 = false
}
},
// 修改副表格单行收货数量
// 副表格单行数量获取焦点
focusInput (e, el) {
this.raw = el.sl
},
// 修改副表格单行数量
updateNum (e, el) {
this._allocationBillDetailUpdate(e, el)
this._allocationBillDetailUpdate(e, el, 'sl')
},
// 副表格单行收货数量和收货仓库接口
async _allocationBillDetailUpdate (e, el) {
async _allocationBillDetailUpdate (e, el, type) {
try {
let res = await allocationBillDetailUpdate(el)
if (res.code !== 1) {
this._allocationBillDetail(e)
if (res.code === 1) {
this.dataList.map(ele => {
if (e.id === ele.id) {
e.subData.map(elem => {
if (elem.id === el.id) {
if (type === 'dcck') {
elem.dcckbm = el.dcckbm
elem.dcckmc = el.dcckmc
}
if (type === 'drck') {
elem.drckbm = el.drckbm
elem.drckmc = el.drckmc
}
}
})
}
})
} else {
this.dataList.map(ele => {
if (e.id === ele.id) {
e.subData.map(elem => {
if (elem.id === el.id) {
if (type === 'sl') {
elem.sl = this.raw
}
}
})
}
})
}
uni.showToast({
title: res.desc,
@@ -341,13 +373,12 @@
// 副表格修改仓库弹窗
showPop (type, e, obj) {
this.popObj = {}
this.popObj1 = {}
this.value = ''
this.type = type
if (type === 1 || type === 2) { // 修改副表格单行仓库弹窗
this.show = true
this.popObj = e
this.popObj1 = obj
this.rawObj = obj
}
},
// 副表格修改仓库弹窗->确定
@@ -366,22 +397,17 @@
text = el.text
}
})
this.dataList.map(e => {
if (e.id === this.popObj.id) {
e.subData.map(el => {
if (el.id === this.popObj1.id) {
if (this.type === 1) {
el.dcckbm = this.value
el.dcckmc = text
} else if (this.type === 2) {
el.drckbm = this.value
el.drckmc = text
}
this._allocationBillDetailUpdate(this.popObj, el)
}
})
}
})
let obj = Object.assign({}, this.rawObj)
if (this.type === 1) {
obj.dcckbm = this.value
obj.dcckmc = text
this._allocationBillDetailUpdate(this.popObj, obj, 'dcck')
} else if (this.type === 2) {
obj.drckbm = this.value
obj.drckmc = text
this._allocationBillDetailUpdate(this.popObj, obj, 'drck')
}
this.show = false
},
// 详情弹窗
getDetails (type,e) {