user.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { ResPage, User } from "@/api/interface/index";
  2. import { PORT1 } from "@/api/config/servicePort";
  3. import http from "@/api";
  4. /**
  5. * @name 用户管理模块
  6. */
  7. // 获取用户列表
  8. export const getUserList = (params: User.ReqUserParams) => {
  9. return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/list`, params);
  10. };
  11. // 获取树形用户列表
  12. export const getUserTreeList = (params: User.ReqUserParams) => {
  13. return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/tree/list`, params);
  14. };
  15. // 新增用户
  16. export const addUser = (params: { id: string }) => {
  17. return http.post(PORT1 + `/user/add`, params);
  18. };
  19. // 批量添加用户
  20. export const BatchAddUser = (params: FormData) => {
  21. return http.post(PORT1 + `/user/import`, params);
  22. };
  23. // 编辑用户
  24. export const editUser = (params: { id: string }) => {
  25. return http.post(PORT1 + `/user/edit`, params);
  26. };
  27. // 删除用户
  28. export const deleteUser = (params: { id: string[] }) => {
  29. return http.post(PORT1 + `/user/delete`, params);
  30. };
  31. // 切换用户状态
  32. export const changeUserStatus = (params: { id: string; status: number }) => {
  33. return http.post(PORT1 + `/user/change`, params);
  34. };
  35. // 重置用户密码
  36. export const resetUserPassWord = (params: { id: string }) => {
  37. return http.post(PORT1 + `/user/rest_password`, params);
  38. };
  39. // 导出用户数据
  40. export const exportUserInfo = (params: User.ReqUserParams) => {
  41. return http.download(PORT1 + `/user/export`, params);
  42. };
  43. // 获取用户状态字典
  44. export const getUserStatus = () => {
  45. return http.get<User.ResStatus[]>(PORT1 + `/user/status`);
  46. };
  47. // 获取用户性别字典
  48. export const getUserGender = () => {
  49. return http.get<User.ResGender[]>(PORT1 + `/user/gender`);
  50. };
  51. // 获取用户部门列表
  52. export const getUserDepartment = () => {
  53. return http.get<User.ResDepartment[]>(PORT1 + `/user/department`, {}, { cancel: false });
  54. };
  55. // 获取用户角色字典
  56. export const getUserRole = () => {
  57. return http.get<User.ResRole[]>(PORT1 + `/user/role`);
  58. };