类型管理
This commit is contained in:
parent
df0b11a8ce
commit
b829f91fc4
|
|
@ -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;
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue