| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role"; |
| | | import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"; |
| | | import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; |
| | | import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept"; |
| | | |
| | | export default { |
| | | name: "Role", |
| | |
| | | this.menuOptions = response.data; |
| | | }); |
| | | }, |
| | | /** 查询部门树结构 */ |
| | | getDeptTreeselect() { |
| | | deptTreeselect().then(response => { |
| | | this.deptOptions = response.data; |
| | | }); |
| | | }, |
| | | // 所有菜单节点数据 |
| | | getMenuAllCheckedKeys() { |
| | | // 目前被选中的菜单节点 |
| | |
| | | }); |
| | | }, |
| | | /** 根据角色ID查询部门树结构 */ |
| | | getRoleDeptTreeselect(roleId) { |
| | | return roleDeptTreeselect(roleId).then(response => { |
| | | getDeptTree(roleId) { |
| | | return deptTreeSelect(roleId).then(response => { |
| | | this.deptOptions = response.data.depts; |
| | | return response; |
| | | }); |
| | |
| | | /** 分配数据权限操作 */ |
| | | handleDataScope(row) { |
| | | this.reset(); |
| | | const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId); |
| | | const deptTreeSelect = this.getDeptTree(row.roleId); |
| | | getRole(row.roleId).then(response => { |
| | | this.form = response.data; |
| | | this.openDataScope = true; |
| | | this.$nextTick(() => { |
| | | roleDeptTreeselect.then(res => { |
| | | deptTreeSelect.then(res => { |
| | | this.$refs.dept.setCheckedKeys(res.data.checkedKeys); |
| | | }); |
| | | }); |