From 94859d431d4dc587a433aa10faaca7f522e856f0 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 14 Jul 2026 14:23:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=8A=E7=9B=98=E5=B9=B3=E7=A3=A8?= =?UTF-8?q?=E5=90=88=E6=89=B9=E5=BC=B9=E7=AA=97=E6=80=BB=E8=AE=A1=E4=B8=8D?= =?UTF-8?q?=E5=88=B7=E6=96=B0,=E4=BA=A4=E6=8E=A5=E6=95=B0=E9=87=8F@change?= =?UTF-8?q?=E7=9A=84countChanges=E6=96=B9=E6=B3=95=E6=9C=AA=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E5=8F=98=E9=87=8F=E6=8A=A5=E9=94=99;=E6=80=BB?= =?UTF-8?q?=E8=AE=A1=E6=94=B9=E4=B8=BAcomputed=E8=AE=A1=E7=AE=97=E5=B1=9E?= =?UTF-8?q?=E6=80=A7,=E9=9A=8Fhandoverb=E8=87=AA=E5=8A=A8=E6=B1=87?= =?UTF-8?q?=E6=80=BB,=E5=B9=B6=E7=A7=BB=E9=99=A4=E5=88=86=E6=95=A3?= =?UTF-8?q?=E7=9A=84=E6=89=8B=E5=8A=A8=E7=B4=AF=E5=8A=A0=E4=B8=8E500ms?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E9=87=8D=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- src/views/wpm_bx/handover_form.vue | 47 ++++-------------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 181057d6..5895118d 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -101,7 +101,6 @@ :step-strictly="true" style="width: 100%" placeholder="交接数量" - @change="countChanges($index)" > @@ -383,7 +382,6 @@ export default { route_code: "", project_code:'', materials:[], - totalCount: 0, deptID:'', bwIndex:0, checkedStatus:[], @@ -466,6 +464,11 @@ export default { that.getMgroupOptions(); }, computed: { + // 总计:始终等于各批次交接数量之和,随 handoverb 自动刷新 + totalCount() { + if (!this.form.handoverb || this.form.handoverb.length === 0) return 0; + return this.form.handoverb.reduce((sum, item) => sum + Number(item.count || 0), 0); + }, // 合批时源批次 state 均为 OK(10) 且 defect 不一致,才显示"清除缺陷"勾选 defectMismatch() { if (this.mtype !== 30) return false; @@ -490,11 +493,6 @@ export default { that.checkedStatus.splice(index,1); this.form.handoverb[this.bwIndex].handoverbw.splice(index,1); this.form.handoverb[this.bwIndex].count--; - let totalCount = 0; - that.form.handoverb.forEach((item)=>{ - totalCount += item.count; - }) - that.totalCount = totalCount; }, showbw(index){ let that = this; @@ -680,7 +678,6 @@ export default { delMaterial(index){ this.selectItems.splice(index,1); this.form.handoverb.splice(index,1); - this.countChange(); }, codeTextChange(text){ this.wm_in = text; @@ -701,12 +698,10 @@ export default { } that.form.handoverb = data?data:[]; if(data&&data!==''&&data.length>0){ - that.totalCount = 0; data.forEach((item,index)=>{ item.wm = item.id; that.checkedStatus.push(true) that.selectItems.push(item.id) - that.totalCount += Number(item.count); that.getWprList(item.wm,index); }) if(that.isFeiPinku){ @@ -720,7 +715,6 @@ export default { }, clearSelect(){ let that = this; - that.totalCount = 0; that.form.handoverb = []; }, materialChange() { @@ -735,7 +729,7 @@ export default { }); } that.form.new_batch = that.route_code=='shangpaipingmo'?that.form.new_batch:""; - let totalCount = 0,data = []; + let data = []; if(that.selectItems.length>0){ console.log('that.selectItems',that.selectItems) data = that.materialOptions.filter((item) => { @@ -783,10 +777,8 @@ export default { // 保留已扫板段的 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); } @@ -800,7 +792,6 @@ export default { return true; }); } - that.totalCount = totalCount; that.form.handoverb = data; }, getWprList(id,index){ @@ -830,28 +821,6 @@ export default { }else{ this.checkedStatus[index] = false; } - this.countChange(); - }, - countChange(){ - let that = this; - let totalCount = 0; - if(this.form.handoverb&&this.form.handoverb.length&&this.form.handoverb.length>0){ - this.form.handoverb.forEach(item=>{ - totalCount += Number(item.count); - }) - that.totalCount = totalCount; - }else{ - that.totalCount = 0; - } - }, - countChanges(index){ - if(this.form.handoverb[index]){}else{} - if(this.form.handoverb.length>0){ - this.form.handoverb.forEach(item=>{ - totalCount += item.count; - }) - that.totalCount = totalCount; - } }, //提交 submit() { @@ -910,7 +879,6 @@ export default { //表单注入数据 setData(data) { let that = this; - this.totalCount = data.count?data.count:data.handoverb.count; Object.assign(this.form, data); this.$API.system.user.list.req({ depts: data.send_dept, page: 0 }).then((res) => { that.userList = res; @@ -1154,9 +1122,6 @@ export default { } } } - setTimeout(() => { - this.countChange(); - }, 500); }, new_batch(){ let that = this;