From cf3637aa2bd6938535250fadf50fd3588814fa58 Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 14 Jun 2023 10:59:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/modules/systemmanage/role.vue | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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) } } }