role.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import http from '@/api'
  2. /**
  3. * @name 查询角色信息列表
  4. * @param query 参数
  5. * @returns 返回列表
  6. */
  7. export const listRoleApi = (query: any) => {
  8. return http.get<any>('/system/role/list', query, { loading: true })
  9. }
  10. /**
  11. * @name 根据角色ID查询部门树结构
  12. * @param roleId 角色Id
  13. * @returns 返回列表
  14. */
  15. export const deptTreeSelectApi = (roleId: any) => {
  16. return http.get<any>(`/system/role/deptTree/${roleId}`)
  17. }
  18. /**
  19. * @name 根据角色ID查询菜单下拉树结构
  20. * @param roleId 角色Id
  21. * @returns 返回列表
  22. */
  23. export const roleMenuTreeSelectApi = (roleId: any) => {
  24. return http.get<any>(`/system/menu/roleMenuTreeselect/${roleId}`)
  25. }
  26. /**
  27. * @name 查询角色信息详细
  28. * @param roleId roleId
  29. * @returns returns
  30. */
  31. export const getRoleApi = (roleId: any) => {
  32. return http.get<any>(`/system/role/${roleId}`)
  33. }
  34. /**
  35. * @name 新增角色信息
  36. * @param data data
  37. * @returns returns
  38. */
  39. export const addRoleApi = (data: any) => {
  40. return http.post<any>('/system/role', data, { loading: false })
  41. }
  42. /**
  43. * @name 修改角色信息
  44. * @param data data
  45. * @returns returns
  46. */
  47. export const updateRoleApi = (data: any) => {
  48. return http.put<any>('/system/role', data, { loading: false })
  49. }
  50. /**
  51. * @name 角色数据权限
  52. * @param data data
  53. * @returns returns
  54. */
  55. export const dataScopeApi = (data: any) => {
  56. return http.put<any>('/system/role/dataScope', data, { loading: false })
  57. }
  58. /**
  59. * @name 修改角色状态
  60. * @param data data
  61. * @returns returns
  62. */
  63. export const changeStatusApi = (data: any) => {
  64. return http.put<any>('/system/role/changeStatus', data, { loading: false })
  65. }
  66. /**
  67. * @name 删除角色信息
  68. * @param roleId roleId
  69. * @returns returns
  70. */
  71. export const delRoleApi = (roleId: any) => {
  72. return http.delete<any>(`/system/role/${roleId}`)
  73. }
  74. /**
  75. * @name 下载模板
  76. * @returns returns
  77. */
  78. export const importTemplateApi = () => {
  79. return http.downloadPost('/system/role/importTemplate', {})
  80. }
  81. /**
  82. * @name 导入数据
  83. * @returns returns
  84. */
  85. export const importDataApi = (data: any) => {
  86. return http.post('/system/role/importData', data)
  87. }
  88. /**
  89. * @name 导出数据
  90. * @returns returns
  91. */
  92. export const exportApi = (data: any) => {
  93. return http.downloadPost('/system/role/export', data)
  94. }
  95. /**
  96. * @name 查询角色已授权用户列表
  97. * @param query 参数
  98. * @returns 返回列表
  99. */
  100. export const allocatedUserListApi = (query: any) => {
  101. return http.get<any>(`/system/role/authUser/allocatedList`, query, { loading: true })
  102. }
  103. /**
  104. * @name 查询角色未授权用户列表
  105. * @param query 参数
  106. * @returns 返回列表
  107. */
  108. export const unallocatedUserListApi = (query: any) => {
  109. return http.get<any>(`/system/role/authUser/unallocatedList`, query, { loading: true })
  110. }
  111. /**
  112. * @name 取消用户授权角色
  113. * @param data data
  114. * @returns returns
  115. */
  116. export const authUserCancelApi = (data: any) => {
  117. return http.put<any>('/system/role/authUser/cancel', data, { loading: false })
  118. }
  119. /**
  120. * @name 批量取消用户授权角色
  121. * @param data data
  122. * @returns returns
  123. */
  124. export const authUserCancelAllApi = (data: any) => {
  125. return http.put<any>('/system/role/authUser/cancelAll', data, { loading: false })
  126. }
  127. /**
  128. * @name 授权用户选择
  129. * @param data data
  130. * @returns returns
  131. */
  132. export const authUserSelectAllApi = (data: any) => {
  133. return http.put<any>('/system/role/authUser/selectAll', data, { loading: false })
  134. }