diff --git a/src/views/wpm_gx/mlogb_form.vue b/src/views/wpm_gx/mlogb_form.vue index e7f30af0..a305036e 100644 --- a/src/views/wpm_gx/mlogb_form.vue +++ b/src/views/wpm_gx/mlogb_form.vue @@ -49,6 +49,7 @@ :labelField="'batch'" style="width: 100%;" :params = "paramsM" + :multiple="isMultipleBatch" @change="materialBatchChange" > @@ -66,6 +67,28 @@ + + + + + - + that.formatWmaterialLabel(o)).join(";"); + let prevMap = {}; + that.multiBatchList.forEach(m => { prevMap[m.id] = m.count_use; }); + that.multiBatchList = list.map(o => ({ + id: o.id, + batch: o.batch, + material: o.material, + count_cando: o.count_cando, + count_use: prevMap[o.id] != null ? prevMap[o.id] : o.count_cando, + })); + let firstObj = list[0]; + that.getRoute(firstObj.material); + that.form.batch = firstObj.batch; + that.batch_count = firstObj.count; + if(that.is_fix){ + that.materialFix = firstObj.material; + } + that.getdefects(firstObj.material); + return; + } if(!that.selectObj || !that.selectObj.id){ that.wmInLabel = ""; return; @@ -505,11 +562,6 @@ export default { if (valid) { that.isSaveing = true; that.form.mlog = that.mlog; - that.form.batch = that.selectObj.batch; - // that.form.count_use = that.selectObj.count_cando; - if(that.mgroupMtype==10&&that.cellsList.length>0){ - that.form.count_json_from = that.cellsList; - } let count_pn_jgqbl = 0,mlogbdefect=[]; that.qct_defects.forEach(item => { if(that.defectform[item.defect_name]>0){ @@ -522,8 +574,34 @@ export default { }) that.form.mlogbdefect = mlogbdefect; that.form.count_pn_jgqbl = count_pn_jgqbl; - console.log(that.form); - console.log(that.selectObj); + if(that.isMultipleBatch){ + let list = that.multiBatchList || []; + if(list.length == 0){ + that.isSaveing = false; + that.$message.error("请选择批次号"); + return; + } + try { + for(let item of list){ + let payload = { ...that.form }; + payload.wm_in = item.id; + payload.batch = item.batch; + payload.count_use = item.count_use; + await that.$API.wpm.mlogb.in.req(payload); + } + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + } catch(err) { + that.isSaveing = false; + } + return; + } + that.form.batch = that.selectObj.batch; + if(that.mgroupMtype==10&&that.cellsList.length>0){ + that.form.count_json_from = that.cellsList; + } that.$API.wpm.mlogb.in.req(that.form).then((res) => { that.isSaveing = false; that.$emit("success");