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) {