From a90cf43e7a1f41dcde401ed1fd118b0f90d7c3f5 Mon Sep 17 00:00:00 2001 From: cqf Date: 星期四, 26 五月 2022 11:41:49 +0800 Subject: [PATCH] 举一反三隐患-存在 --- 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