user.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import http from '@/api'
  2. import { parseStrEmpty } from '@/utils/common'
  3. /**
  4. * @name 查询用户列表
  5. * @param query 参数
  6. * @returns 返回列表
  7. */
  8. export const listUserApi = (query: any) => {
  9. return http.get<any>('/system/user/list', query, { loading: true })
  10. }
  11. /**
  12. * @name 查询用户详细
  13. * @param userId userId
  14. * @returns returns
  15. */
  16. export const getUserApi = (userId?: string) => {
  17. return http.get<any>(`/system/user/` + parseStrEmpty(userId))
  18. }
  19. /**
  20. * @name 查询部门下拉树结构
  21. * @returns returns
  22. */
  23. export const deptTreeSelectApi = () => {
  24. return http.get<any>(`/system/user/deptTree`)
  25. }
  26. /**
  27. * @name 新增用户
  28. * @returns returns
  29. */
  30. export const addUserApi = (data: any) => {
  31. return http.post<any>('/system/user', data, { loading: false })
  32. }
  33. /**
  34. * @name 修改用户
  35. * @returns returns
  36. */
  37. export const updateUserApi = (data: any) => {
  38. return http.put<any>('/system/user', data, { loading: false })
  39. }
  40. /**
  41. * @name 删除用户
  42. * @returns returns
  43. */
  44. export const delUserApi = (userId: any) => {
  45. return http.delete<any>(`/system/user/${userId}`)
  46. }
  47. /**
  48. * @name 用户状态修改
  49. * @param userId userId
  50. * @param status status
  51. * @returns returns
  52. */
  53. export const changeUserStatus = (data: any) => {
  54. return http.put<any>('/system/user/changeStatus', data, { loading: false })
  55. }
  56. /**
  57. * @name 下载模板
  58. * @returns returns
  59. */
  60. export const importTemplateApi = () => {
  61. return http.downloadPost('/system/user/importTemplate', {})
  62. }
  63. /**
  64. * @name 导入数据
  65. * @returns returns
  66. */
  67. export const importDataApi = (params: FormData) => {
  68. return http.post('/system/user/importData', params)
  69. }
  70. /**
  71. * @name 导出数据
  72. * @returns returns
  73. */
  74. export const exportApi = (data: any) => {
  75. return http.downloadPost('/system/user/export', data)
  76. }