| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true">
|
| | | <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
|
| | | <el-form-item label="角色名称" prop="roleName">
|
| | | <el-input
|
| | | v-model="queryParams.roleName"
|
| | |
| | | </template>
|
| | |
|
| | | <script setup name="Role">
|
| | | import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole } from "@/api/system/role";
|
| | | import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
|
| | | import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
|
| | | import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
| | |
|
| | | const router = useRouter();
|
| | | const { proxy } = getCurrentInstance();
|
| | |
| | | });
|
| | | }
|
| | | /** 根据角色ID查询部门树结构 */
|
| | | function getRoleDeptTreeselect(roleId) {
|
| | | return roleDeptTreeselect(roleId).then(response => {
|
| | | function getDeptTree(roleId) {
|
| | | return deptTreeSelect(roleId).then(response => {
|
| | | deptOptions.value = response.depts;
|
| | | return response;
|
| | | });
|
| | |
| | | /** 分配数据权限操作 */
|
| | | function handleDataScope(row) {
|
| | | reset();
|
| | | const roleDeptTreeselect = getRoleDeptTreeselect(row.roleId);
|
| | | const deptTreeSelect = getDeptTree(row.roleId);
|
| | | getRole(row.roleId).then(response => {
|
| | | form.value = response.data;
|
| | | openDataScope.value = true;
|
| | | nextTick(() => {
|
| | | roleDeptTreeselect.then(res => {
|
| | | deptTreeSelect.then(res => {
|
| | | nextTick(() => {
|
| | | if (deptRef.value) {
|
| | | deptRef.value.setCheckedKeys(res.checkedKeys);
|