From d1c1fe27b3e51d5bbdf34eafbd9c01ba7cf662be Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 22 May 2025 11:06:17 +0800 Subject: [PATCH] fix:coding#834 --- src/views/wpm_bx/handover_form.vue | 43 ++++++++++++++---------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 7011ed38..31189ee7 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -361,11 +361,7 @@ export default { // type=40 废品入库 不合格品交接,接收工段固定为废品库 // type=50 改版 灵活无限制 //获取当前工段/部门交送人 - if(that.mgroupName=="size"||that.mgroupName=="facade"){//检验部交接 - that.$API.system.user.list.req({ page: 0, posts__code__contains: "check" }).then((res) => { - that.userList = res; - }); - }else if(that.type==20&&that.mgroupName=='废品库'){//废品交接 + if(that.type==20&&that.mgroupName=='废品库'){//废品交接 that.getCkUserList(); }else{ that.deptID = that.$TOOL.data.get('gx_deptID'); @@ -571,6 +567,9 @@ export default { }; that.$API.wpm.handover.mgroups.req(params).then((res) => { that.mgroupOptions = res; + if(res.length==1){ + that.form.recive_mgroup = res[0].id; + } }) data.forEach((item,index)=>{ item.wm = item.id; @@ -716,19 +715,26 @@ export default { this.$API.cm.labelmat.item.req(id).then((res) => { let arr = []; if(that.form.handoverb&&that.form.handoverb.length>0){ - arr = that.form.handoverb.filter((item) => { - return item.batch == res.batch&&item.state==res.state; + that.form.handoverb.forEach((item) => { + if(item.batch == res.batch&&item.state==res.state){ + arr.push(item); + } }) } if(arr.length>0){ that.wm_in = ""; that.$message.error("该批次已存在") }else{ + let hasArr = []; that.materialOptions.forEach((item) => { if(item.batch == res.batch){ + hasArr.push(item); let params = {material: item.material,type: that.type}; that.$API.wpm.handover.mgroups.req(params).then((res0) => { that.mgroupOptions = res0; + if(res0.length==1){ + that.form.recive_mgroup = res0[0].id; + } }) let obj = {}; obj.wm = item.id; @@ -738,6 +744,7 @@ export default { } obj.count_cando = item.count; obj.count = item.count; + obj.state = res.state; obj.handoverbw = []; that.$API.wpm.wpr.list.req({wm:item.id,page:0}).then((res) => { let handoverbw = []; @@ -749,19 +756,14 @@ export default { handoverbw.push(obj1); }) obj.handoverbw = handoverbw; - if(that.form.handoverb&&that.form.handoverb.length>0){ - that.form.handoverb.push(obj); - }else{ - // that.form.handoverb = []; - that.form.handoverb.push(obj); - } + that.form.handoverb.push(obj); that.wm_in = ""; }) - }else{ - that.$message.error("该批次不存在") - that.wm_in = ""; - } + } }) + if(hasArr.length>0){}else{ + that.$message.error("该批次不存在") + } } }) }else{//wpr的number @@ -792,12 +794,7 @@ export default { } obj2.count_cando = arr[0].count; obj2.count = arr[0].count; - if(that.form.handoverb&&that.form.handoverb.length>0){ - that.form.handoverb.push(obj2); - }else{ - // that.form.handoverb = []; - that.form.handoverb.push(obj2); - } + that.form.handoverb.push(obj2); that.wm_in = ""; } }else{//单件