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="关联物料" placeholder="关联物料"
clearable clearable
multiple multiple
filterable
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in materialOptions" v-for="item in materialOptions"
:key="item.id" :key="item.id"
:label="item.label" :label="item.full_name"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@ -301,7 +302,7 @@ export default {
query.type = val; query.type = val;
query.page = 0; query.page = 0;
query.is_hidden = false; query.is_hidden = false;
this.$API.mtm.material.list.req(query).then((res) => { that.$API.mtm.material.list.req(query).then((res) => {
that.materialOptions = []; that.materialOptions = [];
res.forEach((item) => { res.forEach((item) => {
item.label = item.label =
@ -315,42 +316,37 @@ export default {
}, },
// //
submit() { submit() {
this.$refs.dialogForm.validate(async (valid) => { let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
this.isSaveing = true; that.isSaveing = true;
this.form.brothers = this.brothers; that.form.brothers = that.brothers;
if (this.form.is_assemb) { if (that.form.is_assemb) {
let obj = {}; let obj = {};
this.componentList.forEach((item) => { that.componentList.forEach((item) => {
obj[item.id] = item.count; obj[item.id] = item.count;
}); });
this.form.components = obj; that.form.components = obj;
} }
if (this.mode == "add") { if (that.mode == "add") {
this.$API.mtm.material.create that.$API.mtm.material.create.req(that.form).then((res) => {
.req(this.form) that.isSaveing = false;
.then((res) => { that.$emit("success", that.form, that.mode);
this.isSaveing = false; that.visible = false;
this.$emit("success", this.form, this.mode); that.$message.success("操作成功");
this.visible = false; }).catch(() => {
this.$message.success("操作成功"); that.isSaveing = false;
}) that.visible = false;
.catch(() => { });
this.isSaveing = false; } else if (that.mode == "edit") {
this.visible = false; that.$API.mtm.material.update.req(that.form.id, that.form).then((res) => {
}); that.isSaveing = false;
} else if (this.mode == "edit") { that.$emit("success", that.form, that.mode);
this.$API.mtm.material.update that.visible = false;
.req(this.form.id, this.form) that.$message.success("操作成功");
.then((res) => { }).catch(() => {
this.isSaveing = false; that.isSaveing = false;
this.$emit("success", this.form, this.mode); });
this.visible = false;
this.$message.success("操作成功");
})
.catch(() => {
this.isSaveing = false;
});
} }
} }
}); });
@ -377,7 +373,6 @@ export default {
}, },
delComponent(index) { delComponent(index) {
this.componentList.splice(index, 1); this.componentList.splice(index, 1);
console.log("this.componentList:", this.componentList);
}, },
// //
setFilters(filters) { setFilters(filters) {