improve; 菜单管理编辑更新

This commit is contained in:
From-wh 2023-05-18 09:53:17 +08:00
parent e7b144d15d
commit e1ca702aad
2 changed files with 19 additions and 3 deletions

View File

@ -356,7 +356,7 @@ export default {
.then(async (res) => {
this.$Message.success(res.msg);
this.modals = false;
this.$emit('changeMenu');
this.$emit('changeMenu', this.formValidate);
this.getAddFrom();
// this.$store.dispatch('menus/getMenusNavList');
})

View File

@ -198,6 +198,7 @@ export default {
seletRouteIds: [], // 选中id
menusId: 0, // 选中分类id
nodeKey: 0, // 选中节点
openId: '',
};
},
components: { menusFrom, formCreate: formCreate.$form() },
@ -397,6 +398,7 @@ export default {
},
// 编辑
edit(row, title, index) {
this.openId = row.id;
this.formValidate = {};
this.menusDetails(row.id);
this.titleFrom = title;
@ -439,10 +441,24 @@ export default {
this.$Message.error(res.msg);
});
},
changeMenu() {
// this.getData(1);
changeMenu(data) {
console.log(data)
this.changeData(this.tableData, data);
this.getMenusUnique();
},
changeData(arr, data) {
let arrKey = Object.keys(data);
arr.map((e) => {
if (e.id == this.openId) {
arrKey.map((el) => {
e[el] = data[el];
});
console.log(e);
} else if (e.children) {
this.changeData(e.children, data);
}
});
},
getMenusUnique() {
getMenusUnique().then((res) => {
let data = res.data;