user.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. import request from '@/config/axios'
  2. function parseStrEmpty(str) {
  3. if (!str || str == "undefined" || str == "null") {
  4. return "";
  5. }
  6. return str;
  7. }
  8. // 查询用户列表
  9. export function listUser(query) {
  10. return request.get({
  11. url: '/system/user/list',
  12. params: query,
  13. });
  14. }
  15. // 查询终端用户列表
  16. export function terminalUserList(query) {
  17. return request.get({
  18. url: '/system/user/listTerminal',
  19. params: query,
  20. });
  21. }
  22. // 查询用户详细
  23. export function getUser(userId) {
  24. return request.get({
  25. url: '/system/user/' + parseStrEmpty(userId),
  26. });
  27. }
  28. // 查询角色列表
  29. export function getRole(deptId) {
  30. return request.get({
  31. url: '/system/dept/getRole?deptId=' + deptId,
  32. });
  33. }
  34. // 新增用户
  35. export function addUser(data) {
  36. return request.post({
  37. url: '/system/user',
  38. data: data,
  39. });
  40. }
  41. // 修改用户
  42. export function updateUser(data) {
  43. return request.put({
  44. url: '/system/user',
  45. data: data,
  46. });
  47. }
  48. // 删除用户
  49. export function delUser(userId) {
  50. return request.delete({
  51. url: '/system/user/' + userId,
  52. });
  53. }
  54. // 用户密码重置
  55. export function resetUserPwd(userId, password) {
  56. const data = {
  57. userId,
  58. password,
  59. };
  60. return request.put({
  61. url: '/system/user/resetPwd',
  62. data: data,
  63. });
  64. }
  65. // 用户状态修改
  66. export function changeUserStatus(userId, status) {
  67. const data = {
  68. userId,
  69. status,
  70. };
  71. return request.put({
  72. url: '/system/user/changeStatus',
  73. data: data,
  74. });
  75. }
  76. // 获取微信二维码
  77. export function getLoginParam() {
  78. return request.get({
  79. url: '/wechat/getWxBindQr',
  80. });
  81. }
  82. // 解除绑定
  83. export function secureBind(data) {
  84. return request.post({
  85. url: '/wechat/cancelBind',
  86. data: data,
  87. });
  88. }
  89. // 查询用户个人信息
  90. export function getUserProfile() {
  91. return request.get({
  92. url: '/system/user/profile',
  93. });
  94. }
  95. // 修改用户个人信息
  96. export function updateUserProfile(data) {
  97. return request.put({
  98. url: '/system/user/profile',
  99. data: data,
  100. });
  101. }
  102. // 用户密码重置
  103. export function updateUserPwd(oldPassword, newPassword) {
  104. const data = {
  105. oldPassword,
  106. newPassword,
  107. };
  108. return request.put({
  109. url: '/system/user/profile/updatePwd',
  110. params: data,
  111. });
  112. }
  113. // 用户头像上传
  114. export function uploadAvatar(data) {
  115. return request.post({
  116. url: '/system/user/profile/avatar',
  117. data: data,
  118. });
  119. }
  120. // 查询授权角色
  121. export function getAuthRole(userId) {
  122. return request.get({
  123. url: '/system/user/authRole/' + userId,
  124. });
  125. }
  126. // 保存授权角色
  127. export function updateAuthRole(data) {
  128. return request.put({
  129. url: '/system/user/authRole',
  130. params: data,
  131. });
  132. }
  133. // 查询机构下拉树结构
  134. export function deptsTreeSelect() {
  135. return request.get({
  136. url: '/system/user/deptTree',
  137. });
  138. }
  139. // 查询子机构下拉树结构
  140. export function deptsTreeSelectSub(showOwner) {
  141. return request.get({
  142. url: '/system/user/deptTree?showOwner=' + showOwner,
  143. });
  144. }
  145. // 查询终端用户列表
  146. export function getByDeptId(query) {
  147. return request.get({
  148. url: '/system/user/getByDeptId',
  149. params: query,
  150. });
  151. }