2023-02-11 00:44:00 +08:00
|
|
|
import request from '@/config/axios'
|
|
|
|
|
|
|
|
export interface UserVO {
|
|
|
|
id: number
|
|
|
|
username: string
|
|
|
|
nickname: string
|
|
|
|
deptId: number
|
|
|
|
postIds: string[]
|
|
|
|
email: string
|
|
|
|
mobile: string
|
|
|
|
sex: number
|
|
|
|
avatar: string
|
|
|
|
loginIp: string
|
|
|
|
status: number
|
|
|
|
remark: string
|
|
|
|
loginDate: Date
|
|
|
|
createTime: Date
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查询用户管理列表
|
2023-03-31 07:54:33 +08:00
|
|
|
export const getUserPage = (params: PageParam) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.get({ url: '/system/user/page', params })
|
|
|
|
}
|
|
|
|
|
2023-11-11 20:50:33 +08:00
|
|
|
// 查询所有用户列表
|
|
|
|
export const getAllUser = () => {
|
|
|
|
return request.get({ url: '/system/user/all' })
|
|
|
|
}
|
|
|
|
|
2023-02-11 00:44:00 +08:00
|
|
|
// 查询用户详情
|
2023-03-31 23:34:19 +08:00
|
|
|
export const getUser = (id: number) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.get({ url: '/system/user/get?id=' + id })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 新增用户
|
2023-03-31 23:34:19 +08:00
|
|
|
export const createUser = (data: UserVO) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.post({ url: '/system/user/create', data })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 修改用户
|
2023-03-31 23:34:19 +08:00
|
|
|
export const updateUser = (data: UserVO) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.put({ url: '/system/user/update', data })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 删除用户
|
2023-03-31 07:54:33 +08:00
|
|
|
export const deleteUser = (id: number) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.delete({ url: '/system/user/delete?id=' + id })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 导出用户
|
2023-03-31 07:54:33 +08:00
|
|
|
export const exportUser = (params) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.download({ url: '/system/user/export', params })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 下载用户导入模板
|
2023-04-01 00:04:28 +08:00
|
|
|
export const importUserTemplate = () => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.download({ url: '/system/user/get-import-template' })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 用户密码重置
|
2023-03-31 13:40:57 +08:00
|
|
|
export const resetUserPwd = (id: number, password: string) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
const data = {
|
|
|
|
id,
|
|
|
|
password
|
|
|
|
}
|
|
|
|
return request.put({ url: '/system/user/update-password', data: data })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 用户状态修改
|
2023-03-31 13:40:57 +08:00
|
|
|
export const updateUserStatus = (id: number, status: number) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
const data = {
|
|
|
|
id,
|
|
|
|
status
|
|
|
|
}
|
|
|
|
return request.put({ url: '/system/user/update-status', data: data })
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取用户精简信息列表
|
2023-03-26 19:32:19 +08:00
|
|
|
export const getSimpleUserList = (): Promise<UserVO[]> => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return request.get({ url: '/system/user/list-all-simple' })
|
|
|
|
}
|