类型管理

This commit is contained in:
jjLv 2024-12-09 18:21:11 +08:00
parent df0b11a8ce
commit b829f91fc4
1 changed files with 37 additions and 0 deletions

View File

@ -1288,6 +1288,43 @@ export default {
this.addTitle = '修改'
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;
},
},
}