diff --git a/src/apis/system/role.ts b/src/apis/system/role.ts index aa62d88..3bef576 100644 --- a/src/apis/system/role.ts +++ b/src/apis/system/role.ts @@ -31,6 +31,11 @@ export function deleteRole(id: string) { return http.del(`${BASE_URL}`, { ids: [id] }) } +/** @desc 查询角色权限树 */ +export function listRolePermissionTree() { + return http.get(`${BASE_URL}/permission/tree`) +} + /** @desc 修改角色权限 */ export function updateRolePermission(id: string, data: any) { return http.put(`${BASE_URL}/${id}/permission`, data) diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 3528a2b..8250ba7 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -63,6 +63,15 @@ export type RoleDetailResp = RoleResp & { menuCheckStrictly: boolean deptCheckStrictly: boolean } +export interface RolePermissionResp { + id: string + title: string + parentId: string + permission?: string + children?: RolePermissionResp[] + permissions?: RolePermissionResp[] + isChecked?: boolean +} export interface RoleUserResp { id: string username: string diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 095a228..11c2079 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -96,7 +96,7 @@ import type { TableInstance } from '@arco-design/web-vue' import { Message, Modal } from '@arco-design/web-vue' import MenuAddModal from './MenuAddModal.vue' -import { type MenuQuery, type MenuResp, clearMenuCache, deleteMenu, listMenu } from '@/apis/system/menu' +import { type MenuQuery, type MenuResp, clearMenuCache, deleteMenu, listMenuDictTree } from '@/apis/system/menu' import type GiTable from '@/components/GiTable/index.vue' import { useTable } from '@/hooks' import { isMobile } from '@/utils' @@ -111,7 +111,7 @@ const { loading, search, handleDelete, -} = useTable(() => listMenu(queryForm), { immediate: true }) +} = useTable(() => listMenuDictTree({ description: queryForm.description || '' }), { immediate: true }) // 过滤树 const searchData = (title: string, path: string, permission: string) => { diff --git a/src/views/system/role/components/Permission.vue b/src/views/system/role/components/Permission.vue index df59667..b0be87a 100644 --- a/src/views/system/role/components/Permission.vue +++ b/src/views/system/role/components/Permission.vue @@ -56,12 +56,11 @@