From 3b74b5c7bfc9617f55565800349f4be51712e805 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 12 Nov 2024 20:40:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E9=85=8D=E8=A7=92=E8=89=B2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/user.ts | 15 ++-- src/views/system/user/UserUpdateRoleModal.vue | 90 +++++++++++++++++++ src/views/system/user/index.vue | 11 ++- 3 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 src/views/system/user/UserUpdateRoleModal.vue diff --git a/src/apis/system/user.ts b/src/apis/system/user.ts index 59af309..a7eaf75 100644 --- a/src/apis/system/user.ts +++ b/src/apis/system/user.ts @@ -40,11 +40,6 @@ export function exportUser(query: T.UserQuery) { return http.download(`${BASE_URL}/export`, query) } -/** @desc 重置密码 */ -export function resetUserPwd(data: any, id: string) { - return http.patch(`${BASE_URL}/${id}/password`, data) -} - /** @desc 下载用户导入模板 */ export function downloadUserImportTemplate() { return http.download(`${BASE_URL}/import/template`) @@ -59,3 +54,13 @@ export function parseImportUser(data: FormData) { export function importUser(data: any) { return http.post(`${BASE_URL}/import`, data) } + +/** @desc 重置密码 */ +export function resetUserPwd(data: any, id: string) { + return http.patch(`${BASE_URL}/${id}/password`, data) +} + +/** @desc 分配角色 */ +export function updateUserRole(data: { roleIds: string[] }, id: string) { + return http.patch(`${BASE_URL}/${id}/role`, data) +} diff --git a/src/views/system/user/UserUpdateRoleModal.vue b/src/views/system/user/UserUpdateRoleModal.vue new file mode 100644 index 0000000..31140a1 --- /dev/null +++ b/src/views/system/user/UserUpdateRoleModal.vue @@ -0,0 +1,90 @@ + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index fd03722..fa7f5ec 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -70,13 +70,14 @@ 删除 - + @@ -89,6 +90,7 @@ + @@ -98,6 +100,7 @@ import UserAddDrawer from './UserAddDrawer.vue' import UserImportDrawer from './UserImportDrawer.vue' import UserDetailDrawer from './UserDetailDrawer.vue' import UserResetPwdModal from './UserResetPwdModal.vue' +import UserUpdateRoleModal from './UserUpdateRoleModal.vue' import { type UserQuery, type UserResp, deleteUser, exportUser, listUser } from '@/apis/system' import type { Columns, Options } from '@/components/GiForm' import type { TableInstanceColumns } from '@/components/GiTable/type' @@ -252,6 +255,12 @@ const UserResetPwdModalRef = ref>() const onResetPwd = (record: UserResp) => { UserResetPwdModalRef.value?.onReset(record.id) } + +const UserUpdateRoleModalRef = ref>() +// 分配角色 +const onUpdateRole = (record: UserResp) => { + UserUpdateRoleModalRef.value?.onOpen(record.id) +}