roleManagement.js 1013 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const totalCount = 2
  2. const List = [
  3. {
  4. id: '@id',
  5. permission: 'admin',
  6. },
  7. {
  8. id: '@id',
  9. permission: 'editor',
  10. },
  11. ]
  12. module.exports = [
  13. {
  14. url: '/roleManagement/getList',
  15. type: 'post',
  16. response(config) {
  17. const { title = '', pageNo = 1, pageSize = 20 } = config.body
  18. let mockList = List.filter((item) => {
  19. return !(title && item.title.indexOf(title) < 0)
  20. })
  21. const pageList = mockList.filter(
  22. (item, index) =>
  23. index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
  24. )
  25. return {
  26. code: 200,
  27. msg: 'success',
  28. totalCount,
  29. data: pageList,
  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. ]