From bbf58b9167ea73ab8709616fe8eae8dd4ab2ca44 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 28 May 2026 13:28:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=B0=86=E5=B7=B2=E6=89=AB=E6=9D=BF?= =?UTF-8?q?=E6=AE=B5=E5=AF=B9=E5=BA=94=E7=9A=84=E6=89=B9=E6=AC=A1=E9=A2=84?= =?UTF-8?q?=E5=A1=AB=E5=85=A5=E5=A4=9A=E9=80=89=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=B7=BB=E5=8A=A0=E6=8A=8A=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=A1=B6=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/handover_form.vue | 56 +++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index d04f7670..301f4aaa 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -665,7 +665,16 @@ export default { }); }, addMaterial(){ - this.addShow = true; + let that = this; + that.addShow = true; + // 将已扫板段对应的批次预填入多选,避免手动添加把扫描数据顶掉 + if(that.form.handoverb && that.form.handoverb.length > 0){ + that.form.handoverb.forEach(item => { + if(item.wm && that.selectItems.indexOf(item.wm) === -1){ + that.selectItems.push(item.wm); + } + }); + } }, delMaterial(index){ this.selectItems.splice(index,1); @@ -715,6 +724,15 @@ export default { }, materialChange() { let that = this; + // shangpaipingmo:先缓存已扫板段数据,重建后保留 + let scannedMap = {}; + if(that.route_code == 'shangpaipingmo'){ + (that.form.handoverb || []).forEach(h => { + if(h.wm && h.handoverbw && h.handoverbw.length > 0){ + scannedMap[h.wm] = h; + } + }); + } that.form.new_batch = that.route_code=='shangpaipingmo'?that.form.new_batch:""; let totalCount = 0,data = []; if(that.selectItems.length>0){ @@ -755,15 +773,31 @@ export default { } data.forEach((item,index)=>{ item.wm = item.id; - item.count = item.count_canhandover; - totalCount += Number(item.count_canhandover); item.tracking = item.material_.tracking; if(item.material_.process_name){ item.process = item.material_.process_name; } - item.handoverbw = []; - that.getWprList(item.id,index); + let scanned = scannedMap[item.id]; + if(scanned){ + // 保留已扫板段的 handoverbw 和数量 + item.handoverbw = scanned.handoverbw; + item.count = scanned.count; + totalCount += Number(scanned.count); + } else { + item.count = item.count_canhandover; + totalCount += Number(item.count_canhandover); + item.handoverbw = []; + that.getWprList(item.id,index); + } }) + // 同步 checkedStatus:全选状态由各批次 handoverbw 实际勾选情况决定 + that.checkedStatus = data.map(item => { + let scanned = scannedMap[item.id]; + if(scanned && scanned.handoverbw && scanned.handoverbw.length > 0){ + return scanned.handoverbw.every(w => w.checked !== false); + } + return true; + }); } that.totalCount = totalCount; that.form.handoverb = data; @@ -1049,16 +1083,22 @@ export default { let obj1 = {}; obj1.wpr = res[0].id; obj1.number = res[0].number; + obj1.checked = true; that.form.handoverb[indexs].count+=1; that.form.handoverb[indexs].handoverbw.push(obj1); + that.checkedStatus.push(true) + that.selectItems.push(res[0].id) } }else{ that.form.handoverb[indexs].handoverbw = []; let obj1 = {}; obj1.wpr = res[0].id; + obj1.checked = true; obj1.number = res[0].number; that.form.handoverb[indexs].count=1; that.form.handoverb[indexs].handoverbw.push(obj1); + that.checkedStatus.push(true) + that.selectItems.push(res[0].id) } }else{//handoverb里没有有这个物料批次 if(that.new_wm==''){ @@ -1082,9 +1122,12 @@ export default { obj2.count = 1; let obj3 = {}; obj3.wpr = res[0].id; + obj3.checked = true; obj3.number = res[0].number; obj2.handoverbw.push(obj3); that.form.handoverb.push(obj2); + that.checkedStatus.push(true) + that.selectItems.push(res[0].id) } }) }else{ @@ -1097,9 +1140,12 @@ export default { obj2.count = 1; let obj3 = {}; obj3.wpr = res[0].id; + obj3.checked = true; obj3.number = res[0].number; obj2.handoverbw.push(obj3); that.form.handoverb.push(obj2); + that.checkedStatus.push(true) + that.selectItems.push(res[0].id) } } }else{