user.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import requestAuth from '@/utils/requestAuth'
  2. // 获取用户列表
  3. export function fetchList(query) {
  4. return requestAuth({
  5. url: '/sysOrgUser/list',
  6. method: 'get',
  7. params: query
  8. })
  9. }
  10. // 创建用户
  11. export function createUser(data) {
  12. return requestAuth({
  13. url: '/sysOrgUser/save',
  14. method: 'post',
  15. data
  16. })
  17. }
  18. // 更新用户
  19. export function updateUser(data) {
  20. return requestAuth({
  21. url: '/sysOrgUser/update',
  22. method: 'post',
  23. data
  24. })
  25. }
  26. // 获取用户详情
  27. export function getUserById(id) {
  28. return requestAuth({
  29. url: '/sysOrgUser/info/' + id,
  30. method: 'get'
  31. })
  32. }
  33. // 删除用户信息
  34. export function deleteUser(data) {
  35. return requestAuth({
  36. url: '/sysOrgUser/delete',
  37. method: 'delete',
  38. data
  39. })
  40. }
  41. // 禁用用户
  42. export function closeUser(id) {
  43. return requestAuth({
  44. url: '/sysOrgUser/update',
  45. method: 'post',
  46. data: {
  47. userId: id,
  48. status: 0
  49. }
  50. })
  51. }
  52. // 启用用户
  53. export function openUser(id) {
  54. return requestAuth({
  55. url: '/sysOrgUser/update',
  56. method: 'post',
  57. data: {
  58. userId: id,
  59. status: 1
  60. }
  61. })
  62. }
  63. // 获取角色树以及用户和角色的关联关系
  64. export function getUserRoleTree(userId) {
  65. return requestAuth({
  66. url: '/sysOrgUserRole/list',
  67. method: 'get',
  68. params: { userId: userId }
  69. })
  70. }
  71. // 更新用户角色关联关系
  72. export function updateUserRole(data) {
  73. return requestAuth({
  74. url: '/sysOrgUserRole/save',
  75. method: 'post',
  76. data
  77. })
  78. }
  79. // 保存用户操作记录
  80. export function saveUserOpRecored(data) {
  81. return requestAuth({
  82. url: '/userOpRecord/save',
  83. method: 'post',
  84. data
  85. })
  86. }
  87. // 获取推荐用户菜单
  88. export function getUseMenu() {
  89. return requestAuth({
  90. url: '/userMenu/userlist',
  91. method: 'get'
  92. })
  93. }
  94. export function channgePass(data) {
  95. return requestAuth({
  96. url: '/changePassword',
  97. method: 'post',
  98. data
  99. })
  100. }