| | |
| | | * @role 角色对象 |
| | | */ |
| | | open (role) { |
| | | if (this.userInfo.type === 1) { |
| | | fetchTree1({}) |
| | | fetchTree1(0) |
| | | .then(records => { |
| | | this.role = role |
| | | this.menus = records |
| | |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | } else { |
| | | fetchMenuList({}) |
| | | .then(records => { |
| | | this.role = role |
| | | this.menus = records |
| | | // 如果为固定角色,则固定菜单不可更改 |
| | | this.__resetDisabled(this.menus, this.role) |
| | | // 找出叶节点 |
| | | role.menus = role.menus.filter(menu => role.menus.findIndex(m => m.parentId === menu.id) === -1) |
| | | // 初始化选中 |
| | | this.selectedIds = role.menus.map(r => r.id) |
| | | this.visible = true |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | } |
| | | // } |
| | | // else { |
| | | // fetchMenuList() |
| | | // .then(records => { |
| | | // this.role = role |
| | | // this.menus = records |
| | | // // 如果为固定角色,则固定菜单不可更改 |
| | | // this.__resetDisabled(this.menus, this.role) |
| | | // // 找出叶节点 |
| | | // role.menus = role.menus.filter(menu => role.menus.findIndex(m => m.parentId === menu.id) === -1) |
| | | // // 初始化选中 |
| | | // this.selectedIds = role.menus.map(r => r.id) |
| | | // this.visible = true |
| | | // }) |
| | | // .catch(e => { |
| | | // this.$tip.apiFailed(e) |
| | | // }) |
| | | // } |
| | | |
| | | }, |
| | | // 确认选择菜单 |