diff --git a/src/api/model/wpm.js b/src/api/model/wpm.js index c44006bd..42de0095 100644 --- a/src/api/model/wpm.js +++ b/src/api/model/wpm.js @@ -422,6 +422,14 @@ export default { ); }, }, + createsubmit: { + name: "创建并提交", + req: async function (data) { + return await http.post( + `${config.API_URL}/wpm/handover/create_and_submit/`,data + ); + }, + }, mgroups:{ name: "获取可交接的工段", req: async function (data) { diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index fcde3272..aaf72f28 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -582,7 +582,6 @@ export default { that.getWprList(item.id,index); }) } - that.totalCount = totalCount; that.form.handoverb = data; }, @@ -630,39 +629,39 @@ export default { that.form.mtype = 30; that.form.recive_mgroup = that.form.send_mgroup; } - if (that.mode == "add") { - that.$API.wpm.handover.create.req(that.form).then((res) => { - if(that.type==40||that.mtype==30){ - //提交 - that.$API.wpm.handover.submit.req(res.id).then((res1) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }); - }else{ + //合批、分批、报废,这三个交接操作直接创建并提交 + if(that.mtype==20||that.mtype==30||that.type==40){ + that.$API.wpm.handover.createsubmit.req(that.form).then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + }else{ + if (that.mode == "add") { + that.$API.wpm.handover.create.req(that.form).then((res) => { that.isSaveing = false; that.$emit("success"); that.visible = false; that.$message.success("操作成功"); - } - }).catch((err) => { - //可以处理校验错误 - that.isSaveing = false; - return err; - }); - } else if (that.mode == "edit") { - that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { - that.isSaveing = false; - that.$emit("success", that.form, that.mode); - that.visible = false; - that.$message.success("操作成功"); - }) - .catch((err) => { - //可以处理校验错误 - that.isSaveing = false; - return err; - }); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + } else if (that.mode == "edit") { + that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { + that.isSaveing = false; + that.$emit("success", that.form, that.mode); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + } } } }); diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index 053266fd..b5940154 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -524,44 +524,38 @@ export default { let that = this; that.$refs.dialogForm.validate(async (valid) => { if (valid) { - if (that.mode == "add") { - if(that.mtype==30){ - that.form.mtype =30; - that.form.recive_user = that.form.send_user; - that.form.recive_mgroup = that.form.send_mgroup; - } - that.$API.wpm.handover.create.req(that.form).then((res) => { - if(that.type==40||that.mtype==20||that.mtype==30){ - //提交 - that.$API.wpm.handover.submit.req(res.id).then((res1) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }); - }else{ + if(that.mtype==20||that.mtype==30||that.type==40){ + that.$API.wpm.handover.createsubmit.req(that.form).then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + }else{ + if (that.mode == "add") { + that.$API.wpm.handover.create.req(that.form).then((res) => { that.isSaveing = false; that.$emit("success"); that.visible = false; that.$message.success("操作成功"); - } - }).catch((err) => { - //可以处理校验错误 - that.isSaveing = false; - return err; - }); - } else if (that.mode == "edit") { - that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { - that.isSaveing = false; - that.$emit("success", that.form, that.mode); - that.visible = false; - that.$message.success("操作成功"); - }) - .catch((err) => { - //可以处理校验错误 - that.isSaveing = false; - return err; - }); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + } else if (that.mode == "edit") { + that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => { + that.isSaveing = false; + that.$emit("success", that.form, that.mode); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + return err; + }); + } } } });