diff --git a/src/apis/system/user.ts b/src/apis/system/user.ts index 59af309a..a7eaf753 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 00000000..31140a15 --- /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 fd03722d..fa7f5ec2 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) +}