wholeHospCostSetting.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-08-10 09:24:14
  4. * @LastEditTime: 2021-08-10 09:36:12
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: /CostAccountManaSys/mock/wholeHospCostSetting.js
  8. */
  9. // eslint-disable-next-line import/no-extraneous-dependencies
  10. import moment from 'moment';
  11. import { parse } from 'url'; // mock tableListDataSource
  12. const genList = (current, pageSize) => {
  13. const tableListDataSource = [];
  14. for (let i = 0; i < pageSize; i += 1) {
  15. const index = (current - 1) * 10 + i;
  16. tableListDataSource.push({
  17. key: index,
  18. id: index,
  19. paymentsType:1,
  20. paymentsName:`paymentsName ${index}`
  21. });
  22. }
  23. // console.log({tableListDataSource});
  24. tableListDataSource.reverse();
  25. return tableListDataSource;
  26. };
  27. let tableListDataSource = genList(1, 100);
  28. function getList(req, res, u) {
  29. let realUrl = u;
  30. if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
  31. realUrl = req.url;
  32. }
  33. const { current = 1, pageSize = 10 } = req.query;
  34. let dataSource = [...tableListDataSource].slice((current - 1) * pageSize, current * pageSize);
  35. const result = {
  36. data: {
  37. list: dataSource,
  38. totalCount: tableListDataSource.length,
  39. pageSize: pageSize,
  40. },
  41. status: 200,
  42. success: true,
  43. };
  44. return res.json(result);
  45. }
  46. function postList(req, res, u, b) {
  47. let realUrl = u;
  48. if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
  49. realUrl = req.url;
  50. }
  51. const { method, body } = req;
  52. tableListDataSource.push({ ...body });
  53. const result = {
  54. status: 200,
  55. msg: '',
  56. };
  57. res.json(result);
  58. }
  59. function delList(req, res, u, b) {
  60. const { method, body } = req;
  61. tableListDataSource = tableListDataSource.filter((item) => !body.includes(item.roleId));
  62. const result = {
  63. status: 200,
  64. msg: '',
  65. };
  66. res.json(result);
  67. }
  68. function getHasBindList(req, res, u, b){
  69. const data = {
  70. id:98,
  71. allocation:1,
  72. incomeType:2,
  73. shareParamCode:98,
  74. shareParamName:'shareParamName 98',
  75. incomeFieldNum:98,
  76. incomeFileName:'incomeFileName 98',
  77. costCorresponding:98,
  78. costCorrespondingName:'costCorrespondingName 98'
  79. }
  80. const result = {
  81. status: 200,
  82. msg: '',
  83. data:data
  84. };
  85. res.json(result);
  86. }
  87. function getHasBindMenuList(req, res, u, b){
  88. const data = [
  89. {
  90. id:98,name:'菜单98'
  91. },
  92. {
  93. id:92,name:'菜单92'
  94. }
  95. ]
  96. const result = {
  97. status: 200,
  98. msg: '',
  99. data:data
  100. };
  101. res.json(result);
  102. }
  103. function bindList(req, res, u, b) {
  104. const { method, body } = req;
  105. const { roleId, userIds } = body;
  106. const result = {
  107. status: 200,
  108. msg: '',
  109. };
  110. res.json(result);
  111. }
  112. export default {
  113. 'GET /api/costAccount/costotherpayments/list': getList,
  114. 'GET /api/costAccount/costotherpayments': getHasBindList,
  115. 'GET /api/costAccount/role/roleMenus': getHasBindMenuList,
  116. 'POST /api/costAccount/costotherpayments/save': postList,
  117. 'POST /api/costAccount/role/delete': delList,
  118. 'POST /api/costAccount/role/editUserRole': bindList,
  119. };