玛尔挡水温监测系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import request from '@/utils/request'
  2. import { encrypt } from '@/utils/jsencrypt'
  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' + (userId ? '/' + 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. // 加密密码
  44. password = encrypt(password)
  45. const data = {
  46. userId,
  47. password
  48. }
  49. return request({
  50. url: '/system/user/resetPwd',
  51. method: 'put',
  52. data: data
  53. })
  54. }
  55. // 用户状态修改
  56. export function changeUserStatus(userId, status) {
  57. const data = {
  58. userId,
  59. status
  60. }
  61. return request({
  62. url: '/system/user/changeStatus',
  63. method: 'put',
  64. data: data
  65. })
  66. }
  67. // 查询授权角色
  68. export function getAuthRole(userId) {
  69. return request({
  70. url: '/system/user/authRole/' + userId,
  71. method: 'get'
  72. })
  73. }
  74. // 保存授权角色
  75. export function updateAuthRole(data) {
  76. return request({
  77. url: '/system/user/authRole',
  78. method: 'put',
  79. params: data
  80. })
  81. }
  82. // 查询角色已授权用户列表
  83. export function allocatedUserList(query) {
  84. return request({
  85. url: '/system/user/authUser/allocatedList',
  86. method: 'get',
  87. params: query
  88. })
  89. }
  90. // 查询角色未授权用户列表
  91. export function unallocatedUserList(query) {
  92. return request({
  93. url: '/system/user/authUser/unallocatedList',
  94. method: 'get',
  95. params: query
  96. })
  97. }
  98. /**
  99. * 个人中心相关
  100. */
  101. // 查询用户个人信息
  102. export function getUserProfile() {
  103. return request({
  104. url: '/system/user/profile',
  105. method: 'get'
  106. })
  107. }
  108. // 修改用户个人信息
  109. export function updateUserProfile(data) {
  110. return request({
  111. url: '/system/user/profile',
  112. method: 'put',
  113. data: data
  114. })
  115. }
  116. // 用户密码重置
  117. export function updateUserPwd(oldPassword, newPassword) {
  118. // 加密密码
  119. oldPassword = encrypt(oldPassword)
  120. newPassword = encrypt(newPassword)
  121. const data = {
  122. oldPassword,
  123. newPassword
  124. }
  125. return request({
  126. url: '/system/user/profile/updatePwd',
  127. method: 'put',
  128. params: data
  129. })
  130. }
  131. // 用户头像上传
  132. export function uploadAvatar(data) {
  133. return request({
  134. url: '/system/user/profile/avatar',
  135. method: 'put',
  136. data: data
  137. })
  138. }