diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index 32aa3f39..82f2f53b 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -37,11 +37,12 @@ @@ -52,7 +53,7 @@ {{ scope.row.defect_name }} - + @@ -233,9 +234,11 @@ export default { recive_mgroup: null, handoverb:[], }, + selectObjIds:[], apiObjM:null, paramsM:{}, selectObj:{}, + selectObjs:[], rules: { batch: [ { @@ -441,9 +444,11 @@ export default { }, //显示 open(mode = "add",data,mtype) { + console.log(data) this.mode = mode; this.mtype = mtype; if(data!==''&&data!==null&&data!==undefined){ + console.log(typeof(data)=='string') if(typeof(data)=='string'){ this.codeText = data.replace(" ",""); this.codeTextChange(this.codeText) @@ -462,35 +467,23 @@ export default { }, materialChange0(){ let that = this; - if(that.selectObj.count_canhandover>0){ - let obj = {}; - obj.wm = that.selectObj.id; - obj.state = that.selectObj.state; - obj.batch = that.selectObj.batch; - obj.label = that.selectObj.defect !== null?that.selectObj.batch+'('+that.selectObj.material_name+')'+that.selectObj.defect_name:that.selectObj.batch+'('+that.selectObj.material_name+')'; - obj.count = that.selectObj.count_canhandover; - obj.defect = that.selectObj.defect; - obj.defect_name = that.selectObj.defect_name; - obj.count_cando = that.selectObj.count_canhandover; - obj.material = that.selectObj.material; - if(that.form.handoverb.length>0){ - let datas = that.form.handoverb.filter((item) => { - return item.wm==that.selectObj.id; - }); - if(datas.length>0){ - that.$message.warning('该物料已存在'); - }else{ - that.totalCount += Number(obj.count_canhandover); - that.form.handoverb.push(obj); - } - }else{ - that.totalCount += Number(obj.count_canhandover); - that.form.handoverb.push(obj); - } + that.form.handoverb = []; + that.totalCount = 0; + that.selectObjs.forEach(item=>{ + let obj = {}; + obj.wm = item.id; + obj.state = item.state; + obj.batch = item.batch; + obj.label = item.defect !== null?item.batch+'('+item.material_name+')'+item.defect_name:item.batch+'('+item.material_name+')'; + obj.count = item.count_canhandover; + obj.defect = item.defect; + obj.defect_name = item.defect_name; + obj.count_cando = item.count_canhandover; + obj.material = item.material; + that.totalCount += Number(obj.count); + that.form.handoverb.push(obj); that.getResaveMgroups(obj.material); - }else{ - that.$message.warning('该物料暂无可交接数量'); - } + }) }, countChange(){ let that = this; @@ -553,11 +546,19 @@ export default { }, //表单注入数据 setData(data) { + console.log(data) + let that = this; Object.assign(this.form, data); + that.totalCount = 0; + that.form.handoverb = data.handoverb; + data.handoverb.forEach(item=>{ + item.label = item.batch; + that.totalCount += Number(item.count); + }) if(data.type==30){ - this.getUserList3(); + that.getUserList3(); }else{ - this.getUserList2(); + that.getUserList2(); } }, //设置过滤项 @@ -594,7 +595,7 @@ export default { if(res1.length>0){ res1.forEach(item=>{ let cando = Number(item.count_canhandover); - if(cando>0&&item.defect_name==res.defect_name){ + if(cando>0&&(item.defect==null||item.defect_name==res.defect_name)){ let obj = {}; obj.wm = item.id; obj.batch = item.batch; @@ -606,11 +607,9 @@ export default { obj.count_cando = cando; obj.material = item.material; that.form.handoverb.push(obj) + that.totalCount += Number(obj.count); that.getResaveMgroups(obj.material); } - // else{ - // that.$message.error("该批次物料没有可交接的数量") - // } }) } that.codeText = '';