user.js 2.5 KB

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