From 4ef3ad8d3f525a1aef7f8b4882db8d22bd20ace3 Mon Sep 17 00:00:00 2001 From: fangyunong Date: Sat, 12 Jul 2025 15:48:30 +0800 Subject: [PATCH] =?UTF-8?q?feature:=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 3 ++ src/api/roleApi.ts | 71 ++++++++++++++++++++--------- src/components/Ls-UI/LsRoleBase.vue | 63 +++++++++++++++++++++++++ src/views/role/pages/Auth.vue | 62 +++++++++++++++++++++---- 4 files changed, 167 insertions(+), 32 deletions(-) create mode 100644 src/components/Ls-UI/LsRoleBase.vue diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 9068c09..b9a680c 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -14,8 +14,11 @@ declare global { const defineComponent: typeof import('vue')['defineComponent'] const deleteUser: typeof import('./src/api/roleApi')['deleteUser'] const effectScope: typeof import('vue')['effectScope'] + const enable: typeof import('./src/api/roleApi')['enable'] + const enableRole: typeof import('./src/api/roleApi')['enableRole'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] + const getRoleList: typeof import('./src/api/roleApi')['getRoleList'] const getUserInfo: typeof import('./src/api/userApi')['getUserInfo'] const getUserList: typeof import('./src/api/roleApi')['getUserList'] const h: typeof import('vue')['h'] diff --git a/src/api/roleApi.ts b/src/api/roleApi.ts index 529c70f..2ea37bf 100644 --- a/src/api/roleApi.ts +++ b/src/api/roleApi.ts @@ -1,29 +1,56 @@ import http from "@/utils/request"; // 用户列表 -interface UserListQuery{ - roleName?:string - page:number - pageSize:number +interface UserListQuery { + roleName?: string; + page: number; + pageSize: number; } -interface UserListReturn{ - totalCount:number, - users:UserRaw[] +interface UserListReturn { + totalCount: number; + users: UserRaw[]; } -export function getUserList(data:UserListQuery):Promise{ - return http({ - url:"/api/v1/AdminRoleControllers/SearchUserFromRole", - method:'POST', - data - }) +export function getUserList(data: UserListQuery): Promise { + return http({ + url: "/api/v1/AdminRoleControllers/SearchUserFromRole", + method: "POST", + data, + }); } // 删除用户 -export function deleteUser(userId:string){ - return http({ - url:'/api/v1/AdminRoleControllers/DelUser', - method:'POST', - params:{ - userId - } - }) -} \ No newline at end of file +export function deleteUser(userId: string) { + return http({ + url: "/api/v1/AdminRoleControllers/DelUser", + method: "POST", + params: { + userId, + }, + }); +} + +// 获取角色列表 +export interface RoleListReturn { + concurrencyStamp?: string; + id: string; + name: string; + normalizedName: string; +} +export function getRoleList(): Promise { + return http({ + url: "/api/v1/AdminRoleControllers/AllRole", + method: "GET", + }); +} + +// 授权角色 +interface EnableRoleQuery { + userId: string; + roleName: string; +} +export function enableRole(data:EnableRoleQuery) { + return http({ + url: "/api/v1/AdminRoleControllers/EndowRole", + method: "POST", + data, + }); +} diff --git a/src/components/Ls-UI/LsRoleBase.vue b/src/components/Ls-UI/LsRoleBase.vue new file mode 100644 index 0000000..5fd2608 --- /dev/null +++ b/src/components/Ls-UI/LsRoleBase.vue @@ -0,0 +1,63 @@ + + + + \ No newline at end of file diff --git a/src/views/role/pages/Auth.vue b/src/views/role/pages/Auth.vue index d4745db..1cdba61 100644 --- a/src/views/role/pages/Auth.vue +++ b/src/views/role/pages/Auth.vue @@ -2,18 +2,19 @@
- +
- - + + 角色库