user.js 2.3 KB

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