From e4184d3849559ffff4df0b7e43e7b3886c10fa01 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 13 Mar 2025 15:30:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=8E=BB=E7=BA=A4=E7=89=A9=E6=96=99?= =?UTF-8?q?=E4=BA=A4=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/handover_form.vue | 101 +++++++++++++++++++---------- 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 82b6e876..2c59507d 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -16,7 +16,13 @@ 手动添加 - + + {{ totalCount }} @@ -31,6 +37,7 @@ filterable multiple clearable + @clear="clearSelect" @change="materialChange" style="width: 100%" > @@ -84,11 +91,11 @@ :min="0" :step="1" :max="listItem.count_cando" - :disabled="mode==='show'" + :disabled="mode==='show'||listItem.tracking==20" :step-strictly="true" style="width: 100%" placeholder="交接数量" - @change="countChange" + @change="countChanges($index)" > @@ -318,6 +325,7 @@ export default { type:20, is_hidde:true, }, + wm_in:"", materials:[], totalCount: 0, deptID:'', @@ -378,8 +386,14 @@ export default { }, methods: { deletebw(index){ + let that = this; 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){ this.bwIndex = index; @@ -530,29 +544,37 @@ export default { this.form.handoverb = data; this.visible = true; return this; + }, + clearSelect(){ + let that = this; + that.totalCount = 0; + that.form.handoverb = []; }, materialChange() { let that = this; - let totalCount = 0; - let data = that.materialOptions.filter((item) => { - return that.selectItems.indexOf(item.id)>-1; - }); - let materialId = data[0].material; - let params = { - material: materialId, - type: that.type, - }; - console.log('params',params); - that.$API.wpm.handover.mgroups.req(params).then((res) => { - that.mgroupOptions = res; - }) - data.forEach((item,index)=>{ - item.wm = item.id; - item.count = item.count_cando; - totalCount += item.count_cando; - item.handoverbw = []; - that.getWprList(item.id,index); - }) + let totalCount = 0,data = []; + if(that.selectItems.length>0){ + data = that.materialOptions.filter((item) => { + return that.selectItems.indexOf(item.id)>-1; + }); + let materialId = data[0].material; + let params = { + material: materialId, + type: that.type, + }; + that.$API.wpm.handover.mgroups.req(params).then((res) => { + that.mgroupOptions = res; + }) + data.forEach((item,index)=>{ + item.wm = item.id; + item.count = item.count_cando; + totalCount += item.count_cando; + item.tracking = item.material_.tracking; + item.handoverbw = []; + that.getWprList(item.id,index); + }) + } + that.totalCount = totalCount; that.form.handoverb = data; }, @@ -580,6 +602,15 @@ export default { that.totalCount = totalCount; } }, + 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() { let that = this; @@ -660,8 +691,8 @@ export default { let that = this; that.scanVisible = true; }, - scanClose(data){ - if(data==''||data==undefined||data==null){ + formWminChange(data){ + if(data==''){ return; } let that = this; @@ -703,13 +734,16 @@ export default { } }) }else{//wpr的number + debugger; that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { if(res.length>0){ - let indexs = 0; - let arr = that.form.handoverb.filter((item,index) => { - indexs = index; - return item.wm == res[0].wm; - }) + let indexs = 0,arr =[]; + if( that.form.handoverb&&that.form.handoverb.length>0){ + arr = that.form.handoverb.filter((item,index) => { + indexs = index; + return item.wm == res[0].wm; + }) + } //handoverb里有这个物料批次 if(arr.length>0){ //判断是否有wpr,若无将wpr放进去 @@ -720,14 +754,12 @@ export default { }) if(arr1.length>0){ that.$message.error("该物料已存在"); - // console.log('0',that.form); }else{ let obj1 = {}; obj1.wpr = res[0].id; obj1.number = res[0].number; that.form.handoverb[indexs].count+=1; that.form.handoverb[indexs].handoverbw.push(obj1); - // console.log('1',that.form); } }else{ that.form.handoverb[indexs].handoverbw = []; @@ -736,11 +768,12 @@ export default { obj1.number = res[0].number; that.form.handoverb[indexs].count=1; that.form.handoverb[indexs].handoverbw.push(obj1); - // console.log('2',that.form); } }else{//handoverb里没有有这个物料批次 + console.log('handoverb里没有有这个物料批次'); that.materialOptions.forEach((item) => { if(item.id == res[0].wm){ + console.log('item',item); let params = {material: item.material,type: that.type}; that.$API.wpm.handover.mgroups.req(params).then((res1) => { that.mgroupOptions = res1; @@ -755,8 +788,8 @@ export default { obj3.wpr = res[0].id; obj3.number = res[0].number; obj2.handoverbw.push(obj3); + that.form.handoverb = []; that.form.handoverb.push(obj2); - // console.log('3',that.form); } }) }