diff --git a/src/views/mtm/process.vue b/src/views/mtm/process.vue index 951ce04b..13e9bd0d 100644 --- a/src/views/mtm/process.vue +++ b/src/views/mtm/process.vue @@ -157,7 +157,7 @@ export default { //删除产品 async roleDel(row) { var id = row.id; - var res = await this.$API.mtm.material.delete.req(id); + var res = await this.$API.mtm.process.delete.req(id); if (res.err_msg) { this.$message.error(res.err_msg); } else { diff --git a/src/views/mtm/process_form.vue b/src/views/mtm/process_form.vue index a7dc0835..3dfd7d68 100644 --- a/src/views/mtm/process_form.vue +++ b/src/views/mtm/process_form.vue @@ -1,155 +1,166 @@ - - - - - \ No newline at end of file + //表单数据 + form: defaultForm, + //验证规则 + rules: { + name: [ + { required: true, message: "请输入名称", trigger: "blur" }, + ], + }, + visible: false, + isSaveing: false, + deptOptions: [], + setFiltersVisible: false, + }; + }, + mounted() { + this.getDepts(); //获取部门 + }, + methods: { + getDepts() { + this.$API.system.dept.list + .req({ page: 0, type: "dept" }) + .then((res) => { + this.deptOptions = res; + }); + }, + //显示 + open(mode = "add") { + this.mode = mode; + this.visible = true; + return this; + }, + //表单注入数据 + setData(data) { + Object.assign(this.form, data); + }, + //表单提交方法 + submit() { + let that = this; + that.$refs.dialogForm.validate(async (valid) => { + if (valid) { + that.isSaveing = true; + if (that.mode === "add") { + that.$API.mtm.process.create + .req(that.form) + .then((res) => { + that.isSaveing = false; + that.$emit("success", that.form, that.mode); + that.visible = false; + that.$message.success("操作成功"); + }) + .catch((res) => { + that.isSaveing = false; + }); + } else { + that.$API.mtm.process.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((res) => { + that.isSaveing = false; + }); + } + } + }); + }, + + //设置过滤项 + setFilters(filters) { + this.selectionFilters = filters; + this.setFiltersVisible = true; + }, + }, +}; + + +