chore: 初始化平台管理端
This commit is contained in:
86
src/api/system-manage.ts
Normal file
86
src/api/system-manage.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import api from '@/utils/http'
|
||||
import type { AppRouteRecord } from '@/types/router'
|
||||
|
||||
// 1. 获取用户列表
|
||||
export function fetchGetUserList(params: Api.SystemManage.UserSearchParams) {
|
||||
return api.get<Api.SystemManage.UserListResponse>({
|
||||
url: '/api/admin/v1/users',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 2. 获取用户详情
|
||||
export function fetchGetUserDetail(userId: string, includeDeleted?: boolean) {
|
||||
return api.get<Api.SystemManage.UserDetailDto>({
|
||||
url: `/api/admin/v1/users/${userId}`,
|
||||
params: includeDeleted ? { includeDeleted } : undefined
|
||||
})
|
||||
}
|
||||
|
||||
// 3. 创建用户
|
||||
export function fetchCreateUser(command: Api.SystemManage.CreateIdentityUserCommand) {
|
||||
return api.post<Api.SystemManage.UserDetailDto>({
|
||||
url: '/api/admin/v1/users',
|
||||
data: command
|
||||
})
|
||||
}
|
||||
|
||||
// 4. 更新用户
|
||||
export function fetchUpdateUser(
|
||||
userId: string,
|
||||
command: Api.SystemManage.UpdateIdentityUserCommand
|
||||
) {
|
||||
return api.put<Api.SystemManage.UserDetailDto>({
|
||||
url: `/api/admin/v1/users/${userId}`,
|
||||
data: command
|
||||
})
|
||||
}
|
||||
|
||||
// 5. 删除用户
|
||||
export function fetchDeleteUser(userId: string) {
|
||||
return api.del<boolean>({
|
||||
url: `/api/admin/v1/users/${userId}`
|
||||
})
|
||||
}
|
||||
|
||||
// 6. 恢复用户
|
||||
export function fetchRestoreUser(userId: string) {
|
||||
return api.post<boolean>({
|
||||
url: `/api/admin/v1/users/${userId}/restore`
|
||||
})
|
||||
}
|
||||
|
||||
// 7. 更新用户状态
|
||||
export function fetchChangeUserStatus(
|
||||
userId: string,
|
||||
command: Api.SystemManage.ChangeIdentityUserStatusCommand
|
||||
) {
|
||||
return api.put<boolean>({
|
||||
url: `/api/admin/v1/users/${userId}/status`,
|
||||
data: command
|
||||
})
|
||||
}
|
||||
|
||||
// 8. 重置用户密码
|
||||
export function fetchResetUserPassword(userId: string) {
|
||||
return api.post<Api.SystemManage.ResetIdentityUserPasswordResult>({
|
||||
url: `/api/admin/v1/users/${userId}/password-reset`
|
||||
})
|
||||
}
|
||||
|
||||
// 9. 批量用户操作
|
||||
export function fetchBatchUserOperation(
|
||||
command: Api.SystemManage.BatchIdentityUserOperationCommand
|
||||
) {
|
||||
return api.post<Api.SystemManage.BatchIdentityUserOperationResult>({
|
||||
url: '/api/admin/v1/users/batch',
|
||||
data: command
|
||||
})
|
||||
}
|
||||
|
||||
// 10. 获取菜单列表
|
||||
export function fetchGetMenuList() {
|
||||
return api.get<AppRouteRecord[]>({
|
||||
url: '/api/v3/system/menus/simple'
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user