user.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import request from '@/utils/request'
  2. import {parseStrEmpty} from "@/utils/yamato.js";
  3. import {encryptField} from "@/utils/encrypt.js";
  4. // ユーザーリストを取得
  5. export function listUser(query) {
  6. return request({
  7. url: '/system/user/list',
  8. method: 'get',
  9. params: query
  10. })
  11. }
  12. // ユーザー詳細を取得
  13. export function getUser(userId) {
  14. return request({
  15. url: '/system/user/' + parseStrEmpty(userId),
  16. method: 'get'
  17. })
  18. }
  19. // 新規ユーザーを追加
  20. export function addUser(data) {
  21. return request({
  22. url: '/system/user',
  23. method: 'post',
  24. data: data
  25. })
  26. }
  27. // ユーザー情報を修正
  28. export function updateUser(data) {
  29. return request({
  30. url: '/system/user',
  31. method: 'put',
  32. data: data
  33. })
  34. }
  35. // ユーザーを論理削除
  36. export function delLogicUser(row) {
  37. const { userId, version } = row;
  38. const data = {
  39. userId,
  40. version
  41. }
  42. return request({
  43. url: '/system/user/delLogicUser',
  44. method: 'post',
  45. data: data
  46. })
  47. }
  48. // ユーザーパスワードをリセット
  49. export function resetUserPwd(userId, passwordValue, version) {
  50. let password = encryptField(passwordValue);
  51. const data = {
  52. userId,
  53. password,
  54. version
  55. }
  56. return request({
  57. url: '/system/user/resetPwd',
  58. method: 'put',
  59. data: data
  60. })
  61. }
  62. // ユーザーステータスを変更
  63. export function changeUserStatus(row) {
  64. const { userId, version ,status} = row;
  65. const data = {
  66. userId,
  67. version,
  68. status
  69. }
  70. return request({
  71. url: '/system/user/changeStatus',
  72. method: 'post',
  73. data: data
  74. })
  75. }
  76. // ユーザーパーソナル情報を取得
  77. export function getUserProfile() {
  78. return request({
  79. url: '/system/user/profile',
  80. method: 'get'
  81. })
  82. }
  83. // ユーザーパーソナル情報を修正
  84. export function updateUserProfile(data) {
  85. return request({
  86. url: '/system/user/profile',
  87. method: 'put',
  88. data: data
  89. })
  90. }
  91. // ユーザーパスワードを更新
  92. export function updateUserPwd(data) {
  93. // const data = {
  94. // oldPassword,
  95. // newPassword
  96. // }
  97. return request({
  98. url: '/system/user/profile/updatePwd',
  99. method: 'post',
  100. params: data
  101. })
  102. }
  103. // ユーザーアバターをアップロード
  104. export function uploadAvatar(data) {
  105. return request({
  106. url: '/system/user/profile/avatar',
  107. method: 'post',
  108. headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  109. data: data
  110. })
  111. }
  112. // 認証されたロールを取得
  113. export function getAuthRole(userId) {
  114. return request({
  115. url: '/system/user/authRole/' + userId,
  116. method: 'get'
  117. })
  118. }
  119. // 認証ロールを保存
  120. export function updateAuthRole(data) {
  121. return request({
  122. url: '/system/user/authRole',
  123. method: 'put',
  124. params: data
  125. })
  126. }
  127. // 部門ツリー構造を取得
  128. export function deptTreeSelect() {
  129. return request({
  130. url: '/system/user/deptTree',
  131. method: 'get'
  132. })
  133. }