Files
pqs-9100_client/frontend/src/api/user/user.ts

73 lines
2.0 KiB
TypeScript
Raw Normal View History

import { ResPage } from '@/api/interface'
import { User } from './interface'
import { ADMIN as rePrefix } from '@/api/config/serviceName'
import http from '@/api'
2024-08-22 11:27:06 +08:00
/**
* @name
*/
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/list`, params)
}
2024-08-22 11:27:06 +08:00
// 获取树形用户列表
export const getUserTreeList = (params: User.ReqUserParams) => {
return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/tree/list`, params)
}
2024-08-22 11:27:06 +08:00
// 新增用户
export const addUser = (params: { id: string }) => {
return http.post(`${rePrefix}/user/add`, params)
}
2024-08-22 11:27:06 +08:00
// 批量添加用户
export const BatchAddUser = (params: FormData) => {
return http.post(`${rePrefix}/user/import`, params)
}
2024-08-22 11:27:06 +08:00
// 编辑用户
export const editUser = (params: { id: string }) => {
return http.post(`${rePrefix}/user/edit`, params)
}
2024-08-22 11:27:06 +08:00
// 删除用户
export const deleteUser = (params: { id: string[] }) => {
return http.post(`${rePrefix}/user/delete`, params)
}
2024-08-22 11:27:06 +08:00
// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
return http.post(`${rePrefix}/user/change`, params)
}
2024-08-22 11:27:06 +08:00
// 重置用户密码
export const resetUserPassWord = (params: { id: string }) => {
return http.post(`${rePrefix}/user/rest_password`, params)
}
2024-08-22 11:27:06 +08:00
// 导出用户数据
export const exportUserInfo = (params: User.ReqUserParams) => {
return http.download(`${rePrefix}/user/export`, params)
}
2024-08-22 11:27:06 +08:00
// 获取用户状态字典
export const getUserStatus = () => {
return http.get<User.ResStatus[]>(`${rePrefix}/user/status`)
}
2024-08-22 11:27:06 +08:00
// 获取用户性别字典
export const getUserGender = () => {
return http.get<User.ResGender[]>(`${rePrefix}/user/gender`)
}
2024-08-22 11:27:06 +08:00
// 获取用户部门列表
export const getUserDepartment = () => {
return http.get<User.ResDepartment[]>(`${rePrefix}/user/department`)
}
2024-08-22 11:27:06 +08:00
// 获取用户角色字典
export const getUserRole = () => {
return http.get<User.ResRole[]>(`${rePrefix}/user/role`)
}