From 6c2271a59d92cc2210a62525d4aa2820021d125c Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 1 Aug 2025 16:13:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=E7=89=A9=E6=96=99=E6=89=80=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mtm/materials_form.vue | 63 +++++++++++++++----------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/src/views/mtm/materials_form.vue b/src/views/mtm/materials_form.vue index ee2d330c..1dae8d0d 100644 --- a/src/views/mtm/materials_form.vue +++ b/src/views/mtm/materials_form.vue @@ -93,12 +93,13 @@ placeholder="关联物料" clearable multiple + filterable style="width: 100%" > @@ -301,7 +302,7 @@ export default { query.type = val; query.page = 0; query.is_hidden = false; - this.$API.mtm.material.list.req(query).then((res) => { + that.$API.mtm.material.list.req(query).then((res) => { that.materialOptions = []; res.forEach((item) => { item.label = @@ -315,42 +316,37 @@ export default { }, //提交 submit() { - this.$refs.dialogForm.validate(async (valid) => { + let that = this; + that.$refs.dialogForm.validate(async (valid) => { if (valid) { - this.isSaveing = true; - this.form.brothers = this.brothers; - if (this.form.is_assemb) { + that.isSaveing = true; + that.form.brothers = that.brothers; + if (that.form.is_assemb) { let obj = {}; - this.componentList.forEach((item) => { + that.componentList.forEach((item) => { obj[item.id] = item.count; }); - this.form.components = obj; + that.form.components = obj; } - if (this.mode == "add") { - this.$API.mtm.material.create - .req(this.form) - .then((res) => { - this.isSaveing = false; - this.$emit("success", this.form, this.mode); - this.visible = false; - this.$message.success("操作成功"); - }) - .catch(() => { - this.isSaveing = false; - this.visible = false; - }); - } else if (this.mode == "edit") { - this.$API.mtm.material.update - .req(this.form.id, this.form) - .then((res) => { - this.isSaveing = false; - this.$emit("success", this.form, this.mode); - this.visible = false; - this.$message.success("操作成功"); - }) - .catch(() => { - this.isSaveing = false; - }); + if (that.mode == "add") { + that.$API.mtm.material.create.req(that.form).then((res) => { + that.isSaveing = false; + that.$emit("success", that.form, that.mode); + that.visible = false; + that.$message.success("操作成功"); + }).catch(() => { + that.isSaveing = false; + that.visible = false; + }); + } else if (that.mode == "edit") { + that.$API.mtm.material.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(() => { + that.isSaveing = false; + }); } } }); @@ -377,7 +373,6 @@ export default { }, delComponent(index) { this.componentList.splice(index, 1); - console.log("this.componentList:", this.componentList); }, //设置过滤项 setFilters(filters) {