fix:添加物料时显示物料所在的工序

This commit is contained in:
shijing 2025-08-01 16:13:43 +08:00
parent eacbfea375
commit 6c2271a59d
1 changed files with 29 additions and 34 deletions

View File

@ -93,12 +93,13 @@
placeholder="关联物料"
clearable
multiple
filterable
style="width: 100%"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.label"
:label="item.full_name"
:value="item.id"
/>
</el-select>
@ -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) {