| | |
| | | } |
| | | }) |
| | | }, |
| | | 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 = [] |
| | |
| | | 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 |