diff --git a/src/pages/modules/systemmanage/role.vue b/src/pages/modules/systemmanage/role.vue index 0a04cb1..e82f070 100644 --- a/src/pages/modules/systemmanage/role.vue +++ b/src/pages/modules/systemmanage/role.vue @@ -35,7 +35,7 @@
角色名称 - +
@@ -101,6 +102,7 @@ export default { children: 'children', label: 'title' }, + checkedKeys: [], pkObj: {}, pkId: '', unclick: false, @@ -245,6 +247,12 @@ export default { let res = await sysRoleMenu(this.pkId, arr) if (res.code === '1') { this.toast(res.desc) + this.pkId = '' + this.checkedKeys = [] + this.tree.map(e => { + this.$refs.tree.setChecked(e, false, true) + }) + this._sysRoleQuery() } else { this.toast(res.desc) } @@ -258,6 +266,9 @@ export default { return } let arr = this.$refs.tree.getCheckedKeys() + if (arr.length === 0) { + return + } let arr1 = [] arr.map(el => { arr1.push({menuId: el}) @@ -266,6 +277,18 @@ export default { }, toCheck (e) { this.pkId = this.pkId === e.roleId ? '' : e.roleId + this.checkedKeys = this.pkId === e.roleId ? e.menus : [] + this.tree.map(e => { + this.$refs.tree.setChecked(e, false, true) + }) + if (this.pkId === e.roleId) { + this.checkedKeys = e.menus + console.log(99) + } else { + this.checkedKeys = [] + console.log(100) + } + console.log(this.checkedKeys) } } }