From 1f2a259f8cbb7eb0b12d12895116c309eb8cd609 Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期五, 08 四月 2022 16:16:28 +0800 Subject: [PATCH] 'lct' --- src/views/systemManage/roleManage/index.vue | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/views/systemManage/roleManage/index.vue b/src/views/systemManage/roleManage/index.vue index cadc1be..c425921 100644 --- a/src/views/systemManage/roleManage/index.vue +++ b/src/views/systemManage/roleManage/index.vue @@ -313,14 +313,15 @@ } }) }, - sethasMenuTree(roleId) { + async sethasMenuTree(roleId) { const _this = this + _this.defaultCheckKeys = [] _this.checkStrictly=true const params = {} params['roleId'] = roleId; - getRole(params).then(response => { - const res = response.data - if (res.code == 200) { + let response = await getRole(params) + const res = response.data + if (res.code === '200') { const hasMenuTree = res.result if (hasMenuTree && hasMenuTree.length > 0) { const checkKeys = [] @@ -328,15 +329,38 @@ checkKeys.push(menu.id) } _this.defaultCheckKeys = checkKeys + setTimeout( ()=>{ + this.$refs.menuTree.setCheckedKeys(checkKeys) + }) } else { _this.defaultCheckKeys = [] } - _this.checkStrictly=false + _this.checkStrictly=true } else { parseError({ error: res.message, vm: _this }) _this.checkStrictly=false } - }) + // getRole(params).then(response => { + // const res = response.data + // if (res.code == 200) { + // debugger + // const hasMenuTree = res.result + // if (hasMenuTree && hasMenuTree.length > 0) { + // const checkKeys = [] + // for (const menu of hasMenuTree) { + // checkKeys.push(menu.id) + // } + // _this.defaultCheckKeys = checkKeys + // } else { + // _this.defaultCheckKeys = [] + // } + // _this.checkStrictly=false + // } else { + // parseError({ error: res.message, vm: _this }) + // _this.checkStrictly=false + // } + // }) + console.log(_this.defaultCheckKeys); }, cancelPermEdit() { this.permModalVisible = false -- Gitblit v1.9.2