roleManagement.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const List = [
  2. {
  3. id: '@id',
  4. role: 'admin',
  5. btnRolesCheckedList: ['read:system', 'write:system', 'delete:system'],
  6. },
  7. {
  8. id: '@id',
  9. role: 'editor',
  10. btnRolesCheckedList: ['read:system', 'write:system'],
  11. },
  12. ]
  13. module.exports = [
  14. {
  15. url: '/roleManagement/getList',
  16. type: 'get',
  17. response(config) {
  18. const { role, pageNo = 1, pageSize = 20 } = config.query
  19. const mockList = List.filter(
  20. (item) => !(role && item.title.indexOf(role) < 0)
  21. )
  22. const list = mockList.filter(
  23. (item, index) =>
  24. index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
  25. )
  26. return {
  27. code: 200,
  28. msg: 'success',
  29. data: { list, ...{ total: mockList.length } },
  30. }
  31. },
  32. },
  33. {
  34. url: '/roleManagement/doEdit',
  35. type: 'post',
  36. response() {
  37. return {
  38. code: 200,
  39. msg: '模拟保存成功',
  40. }
  41. },
  42. },
  43. {
  44. url: '/roleManagement/doDelete',
  45. type: 'post',
  46. response() {
  47. return {
  48. code: 200,
  49. msg: '模拟删除成功',
  50. }
  51. },
  52. },
  53. ]