diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 2c59507d..db6c401a 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -699,10 +699,14 @@ export default { if(data.indexOf('#')>-1){ let id = data.split('#')[1]; this.$API.cm.labelmat.item.req(id).then((res) => { - let arr = that.form.handoverb.filter((item) => { - return item.batch == res.batch&&item.state==res.state; - }) + 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; + }) + } if(arr.length>0){ + that.wm_in = ""; that.$message.error("该批次已存在") }else{ that.materialOptions.forEach((item) => { @@ -727,14 +731,22 @@ export default { handoverbw.push(obj1); }) obj.handoverbw = handoverbw; - that.form.handoverb.push(obj); + if(that.form.handoverb&&that.form.handoverb.length>0){ + that.form.handoverb.push(obj); + }else{ + that.form.handoverb = []; + that.form.handoverb.push(obj); + } + that.wm_in = ""; }) + }else{ + that.$message.error("该批次不存在") + that.wm_in = ""; } }) } }) }else{//wpr的number - debugger; that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { if(res.length>0){ let indexs = 0,arr =[]; @@ -753,6 +765,7 @@ export default { return item1.wpr == res[0].id; }) if(arr1.length>0){ + that.wm_in = ""; that.$message.error("该物料已存在"); }else{ let obj1 = {}; @@ -760,6 +773,7 @@ export default { obj1.number = res[0].number; that.form.handoverb[indexs].count+=1; that.form.handoverb[indexs].handoverbw.push(obj1); + that.wm_in = ""; } }else{ that.form.handoverb[indexs].handoverbw = []; @@ -768,6 +782,7 @@ export default { obj1.number = res[0].number; that.form.handoverb[indexs].count=1; that.form.handoverb[indexs].handoverbw.push(obj1); + that.wm_in = ""; } }else{//handoverb里没有有这个物料批次 console.log('handoverb里没有有这个物料批次'); @@ -792,7 +807,11 @@ export default { that.form.handoverb.push(obj2); } }) + that.wm_in = ""; } + }else{ + that.wm_in = ""; + that.$message.error("该批次不存在") } }) }