user.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import request from '@/utils/request'
  2. import { praseStrEmpty } from "@/utils/huyi";
  3. // 查询用户列表
  4. export function listUser(query) {
  5. return request({
  6. url: '/system/ownUser/list',
  7. method: 'get',
  8. params: query
  9. })
  10. }
  11. // 查询用户详细
  12. export function getUser(userId) {
  13. return request({
  14. url: '/system/user/' + praseStrEmpty(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. export function delUser(userId) {
  35. return request({
  36. url: '/system/user/' + userId,
  37. method: 'delete'
  38. })
  39. }
  40. // 用户密码重置
  41. export function resetUserPwd(userId, password) {
  42. const data = {
  43. userId,
  44. password
  45. }
  46. return request({
  47. url: '/system/user/resetPwd',
  48. method: 'put',
  49. data: data
  50. })
  51. }
  52. // 用户状态修改
  53. export function changeUserStatus(userId, status) {
  54. const data = {
  55. userId,
  56. status
  57. }
  58. return request({
  59. url: '/system/user/changeStatus',
  60. method: 'put',
  61. data: data
  62. })
  63. }
  64. // 查询用户个人信息
  65. export function getUserProfile(sscDomain) {
  66. console.log(sscDomain)
  67. return request({
  68. url: '/system/user/profile/'+sscDomain,
  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 nameList(userId) {
  102. return request({
  103. url: '/system/ownUser/listUser/'+ userId,
  104. method: 'get',
  105. })
  106. }
  107. // 查询当前用户
  108. export function getNowUser() {
  109. return request({
  110. url: '/system/ownUser/getNowUser',
  111. method: 'get'
  112. })
  113. }
  114. // 根据企业id获取部门与角色信息
  115. export function getRoleDept(companyId) {
  116. return request({
  117. url: '/system/user/getRoleDept/' + companyId,
  118. method: 'get'
  119. })
  120. }
  121. // 查询此用户下关联的企业
  122. export function companyList(userId) {
  123. return request({
  124. url: '/system/ownUser/' + praseStrEmpty(userId),
  125. method: 'get'
  126. })
  127. }