From 6fd473484193ec5f0e88f333dc62cfb09e544a73 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 25 Apr 2025 14:55:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=AD=A3=E7=8E=BB=E7=BA=A4?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E6=89=AB=E7=A0=81=E6=89=B9=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E6=9C=89=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/mlogb_form.vue | 63 +++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/views/wpm_bx/mlogb_form.vue b/src/views/wpm_bx/mlogb_form.vue index 5f480f50..0093ce4c 100644 --- a/src/views/wpm_bx/mlogb_form.vue +++ b/src/views/wpm_bx/mlogb_form.vue @@ -18,8 +18,8 @@ style="padding: 0 10px" > - - + + { if(res.length>0){ - let index = res.length-1; + let index = res.length-1;//最后一条记录 let bwitem = {}; bwitem.mlogb=""; bwitem.number=res[index].number; @@ -398,10 +399,12 @@ export default { }else{ that.form.batch = arr[0].batch; that.form.wm_in = arr[0].id; - that.form.count_use = 1; - that.wm_in = arr[0].batch; + that.form.count_use += 1; + that.wm_in = ''; + that.batchs = arr[0].id; } - that.bwItemForm = bwitem; + that.bwItemForms.push(bwitem); + // that.bwItemForm = bwitem; }else{ that.wm_in = ''; that.$message.error("批次号不存在"); @@ -409,24 +412,34 @@ export default { } }) } - } - }, //表单提交方法 submit() { let that = this; if(that.hasMlogbIn){ - that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => { - that.$message.success("添加成功"); - that.wm_in = ''; - that.form.mtask = ''; - that.form.batch = ''; - that.form.parent = ''; - that.form.count_use = 0; - that.$emit("closed"); - that.visible = false; - }) + that.bwItemForms.forEach(item=>{ + item.mlogb = res.id; + that.$API.wpm.mlogbw.create.req(item).then((res1) => { + that.wm_in = ''; + that.form.mtask = ''; + that.form.batch = ''; + that.form.parent = ''; + that.form.count_use = 0; + that.$emit("closed"); + that.visible = false; + }) + }) + // that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => { + // that.$message.success("添加成功"); + // that.wm_in = ''; + // that.form.mtask = ''; + // that.form.batch = ''; + // that.form.parent = ''; + // that.form.count_use = 0; + // that.$emit("closed"); + // that.visible = false; + // }) }else{ that.form.mlog = that.mlog; that.$API.wpm.mlogb.in.req(that.form).then((res) => { @@ -436,11 +449,17 @@ export default { that.form.batch = ''; that.form.parent = ''; that.form.count_use = 0; - if(that.scanKyes!=='mat'&&that.mlogbInCount>1){ - that.bwItemForm.mlogb = res.id; - that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => { - that.$emit("closed"); + if(that.scanKyes!=='mat'&&that.bwItemForms.length>1){ + that.bwItemForms.forEach(item=>{ + item.mlogb = res.id; + that.$API.wpm.mlogbw.create.req(item).then((res1) => { + that.$emit("closed"); + }) }) + // that.bwItemForm.mlogb = res.id; + // that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => { + // that.$emit("closed"); + // }) }else{ that.$emit("closed"); }