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