sysuser.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import request from '@/utils/request'
  2. // 查询用户列表
  3. export function listUser(query) {
  4. return request({
  5. url: '/api/v1/sysUserList',
  6. method: 'get',
  7. params: query
  8. })
  9. }
  10. // 查询用户详细
  11. export function getUser(userId) {
  12. return request({
  13. url: '/api/v1/sysUser/' + userId,
  14. method: 'get'
  15. })
  16. }
  17. export function getUserInit() {
  18. return request({
  19. url: '/api/v1/sysUser/',
  20. method: 'get'
  21. })
  22. }
  23. // 新增用户
  24. export function addUser(data) {
  25. return request({
  26. url: '/api/v1/sysUser',
  27. method: 'post',
  28. data: data
  29. })
  30. }
  31. // 修改用户
  32. export function updateUser(data) {
  33. return request({
  34. url: '/api/v1/sysUser',
  35. method: 'put',
  36. data: data
  37. })
  38. }
  39. // 删除用户
  40. export function delUser(userId) {
  41. return request({
  42. url: '/api/v1/sysUser/' + userId,
  43. method: 'delete'
  44. })
  45. }
  46. // 导出用户
  47. export function exportUser(query) {
  48. return request({
  49. url: '/api/v1/sysUser/export',
  50. method: 'get',
  51. params: query
  52. })
  53. }
  54. // 用户密码重置
  55. export function resetUserPwd(userId, password) {
  56. const data = {
  57. userId,
  58. password
  59. }
  60. return request({
  61. url: '/api/v1/sysUser',
  62. method: 'put',
  63. data: data
  64. })
  65. }
  66. // 用户状态修改
  67. export function changeUserStatus(userId, status) {
  68. const data = {
  69. userId,
  70. status
  71. }
  72. return request({
  73. url: '/api/v1/sysUser',
  74. method: 'put',
  75. data: data
  76. })
  77. }
  78. // 查询用户个人信息
  79. export function getUserProfile() {
  80. return request({
  81. url: '/api/v1/user/profile',
  82. method: 'get'
  83. })
  84. }
  85. // 修改用户个人信息
  86. export function updateUserProfile(data) {
  87. return request({
  88. url: '/api/v1/sysUser/profile',
  89. method: 'put',
  90. data: data
  91. })
  92. }
  93. // 用户密码重置
  94. export function updateUserPwd(oldPassword, newPassword, passwordType) {
  95. const data = {
  96. oldPassword,
  97. newPassword,
  98. passwordType
  99. }
  100. return request({
  101. url: '/api/v1/user/pwd',
  102. method: 'put',
  103. data: data
  104. })
  105. }
  106. // 用户头像上传
  107. export function uploadAvatar(data) {
  108. return request({
  109. url: '/api/v1/user/avatar',
  110. method: 'post',
  111. data: data
  112. })
  113. }
  114. // 下载用户导入模板
  115. export function importTemplate() {
  116. return request({
  117. url: '/api/v1/sysUser/importTemplate',
  118. method: 'get'
  119. })
  120. }