bugfix 0720 bomTechAndFiring

This commit is contained in:
lb
2023-07-21 11:03:23 +08:00
parent ab24d8b558
commit be39723748
5 changed files with 79 additions and 69 deletions

View File

@@ -22,8 +22,13 @@
<el-form ref="dataForm" :model="dataForm" v-loading="loading">
<el-row :gutter="20">
<el-col>
<el-form-item label="bom" prop="bomId" :rules="rules.bom">
<el-input v-model="dataForm.bomId" clearable disabled></el-input>
<el-form-item label="配方号" prop="code" :rules="rules.code">
<el-input v-model="dataForm.code" clearable disabled></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="牌号" prop="name" :rules="rules.name">
<el-input v-model="dataForm.name" clearable disabled></el-input>
</el-form-item>
</el-col>
<el-col>
@@ -43,7 +48,7 @@
<!-- footer -->
<div slot="footer">
<!-- <el-button @click="handleBtnClick('保存')">保存</el-button> -->
<el-button type="primary" @click="handleBtnClick('更新')">更新</el-button>
<el-button type="primary" @click="handleBtnClick('更新')" :loading="btnLoading">更新</el-button>
<el-button @click="handleBtnClick('取消')">取消</el-button>
</div>
</el-dialog>
@@ -60,14 +65,17 @@ export default {
loading: false,
dataForm: {
id: null,
bomId: null,
techId: null,
code: null,
name: null,
},
rules: {
bom: [],
tech: [{ required: true, message: "必填项不能为空", trigger: "blur" }],
code: [],
name: [],
tech: []
// name: [{ required: true, message: "必填项不能为空", trigger: "blur" }],
},
techList: [],
btnLoading: false,
};
},
computed: {},
@@ -78,10 +86,12 @@ export default {
},
methods: {
// 初始化
init({ id, bomId, techId }) {
init({ id, code, name, techId, bomId }) {
this.$set(this.dataForm, "id", id);
this.$set(this.dataForm, "bomId", bomId);
this.$set(this.dataForm, "code", code);
this.$set(this.dataForm, "name", name);
this.$set(this.dataForm, "techId", techId);
this.$set(this.dataForm, "bomId", bomId);
},
// 获取工艺列表
async getTechList() {
@@ -103,13 +113,6 @@ export default {
}
},
// 提交更新
async push(type = "add") {
if (type == "add") {
} else if (type == "update") {
}
},
// 按钮事件
handleBtnClick(type) {
switch (type) {
@@ -123,14 +126,22 @@ export default {
case "更新":
this.$refs.dataForm.validate((valid) => {
if (valid) {
this.$http.put("/pms/bomTech", this.dataForm).then((res) => {
if (res.data.code == 0) {
this.$message.success("更新成功");
this.handleClose(true);
} else {
this.$message.error(res.data.msg);
}
});
this.btnLoading = true;
this.$http
.put("/pms/bomTech", {
id: this.dataForm.id,
techId: this.dataForm.techId,
bomId: this.dataForm.bomId,
})
.then((res) => {
if (res.data.code == 0) {
this.$message.success("更新成功");
this.handleClose(true);
} else {
this.$message.error(res.data.msg);
}
this.btnLoading = false;
});
}
});
break;