feat: 新增用户管理

This commit is contained in:
2024-04-14 12:17:33 +08:00
parent ceef5ceb15
commit 7e093e15f9
8 changed files with 641 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
export * from './user'
export * from './role'
export * from './menu'
export * from './dept'

View File

@@ -1,3 +1,36 @@
/** 系统用户类型 */
export interface UserResp {
id: string
username: string
nickname: string
avatar: string
gender: number
email: string
phone: string
description: string
status: 1 | 2
isSystem?: boolean
createUserString: string
createTime: string
updateUserString: string
updateTime: string
deptId: string
deptName: string
disabled: boolean
}
export type UserDetailResp = UserResp & {
roleIds?: Array<number>
roleNames: string
pwdResetTime?: string
}
export interface UserQuery {
description?: string
status?: number
deptId?: string
sort: Array<string>
}
export interface UserPageQuery extends PageQuery, UserQuery {}
/** 系统角色类型 */
export interface RoleResp {
id: string

39
src/apis/system/user.ts Normal file
View File

@@ -0,0 +1,39 @@
import http from '@/utils/http'
import type * as System from './type'
const BASE_URL = '/system/user'
/** @desc 查询用户列表 */
export function listUser(query: System.UserPageQuery) {
return http.get<PageRes<System.UserResp[]>>(`${BASE_URL}`, query)
}
/** @desc 查询用户详情 */
export function getUser(id: string) {
return http.get<System.UserDetailResp>(`${BASE_URL}/${id}`)
}
/** @desc 新增用户 */
export function addUser(data: any) {
return http.post(`${BASE_URL}`, data)
}
/** @desc 修改用户 */
export function updateUser(data: any, id: string) {
return http.put(`${BASE_URL}/${id}`, data)
}
/** @desc 删除用户 */
export function deleteUser(ids: string | Array<string>) {
return http.del(`${BASE_URL}/${ids}`)
}
/** @desc 导出用户 */
export function exportUser(query: System.UserQuery) {
return http.download<any>(`${BASE_URL}/export`, query)
}
/** @desc 重置密码 */
export function resetUserPwd(data: any, id: string) {
return http.patch(`${BASE_URL}/${id}/password`, data)
}