diff --git a/sgzb-ui/src/views/warehouseManage/machinery/type/index.vue b/sgzb-ui/src/views/warehouseManage/machinery/type/index.vue index 53b6ab4b..5f28936f 100644 --- a/sgzb-ui/src/views/warehouseManage/machinery/type/index.vue +++ b/sgzb-ui/src/views/warehouseManage/machinery/type/index.vue @@ -1289,6 +1289,43 @@ export default { this.addFormParams.typeName = data.label this.addTitleVisible = true }, + /* 确定 */ + onSubmit() { + const { id, typeName, parentId } = this.addFormParams; + const addParams = { + parentId: id, + typeName, + }; + const editParams = { + typeId: id, + typeName, + parentId, + }; + + this.$refs["addFormParamsRef"].validate(async (valid) => { + if (valid) { + if (this.addTitle === "新增") { + const res = await addMaType(addParams); + if (res.code === 200) { + this.$message.success("新增成功!"); + this.addTitleVisible = false; + this.getTreeData(); + } + } else { + const res = await updateMaType(editParams); + if (res.code === 200) { + this.$message.success("修改成功!"); + this.addTitleVisible = false; + this.getTreeData(); + } + } + } + }); + }, + /* 取消 */ + onCancel() { + this.addTitleVisible = false; + }, }, }