afterCollectionSearch.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-08-12 09:59:49
  4. * @LastEditTime: 2021-08-12 20:32:24
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: /CostAccountManaSys/mock/afterCollectionSearch.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. year:'2021',
  20. month:'08',
  21. departmentCode:`departmentCode ${index}`,
  22. departmentName:`departmentName ${index}`,
  23. responsibilityCode:`responsibilityCode ${index}`,
  24. responsibilityName:`responsibilityName ${index}`,
  25. accountingCode:`responsibilityCode ${index}`,
  26. accountingName:`responsibilityName ${index}`,
  27. projectCode:`projectCode ${index}`,
  28. projectName:`projectName ${index}`,
  29. isDirectIncome:0,
  30. amount:2000
  31. });
  32. }
  33. // console.log({tableListDataSource});
  34. tableListDataSource.reverse();
  35. return tableListDataSource;
  36. };
  37. let tableListDataSource = genList(1, 100);
  38. function getList(req, res, u) {
  39. let realUrl = u;
  40. if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
  41. realUrl = req.url;
  42. }
  43. const { current = 1, pageSize = 10 } = req.query;
  44. let dataSource = [...tableListDataSource].slice((current - 1) * pageSize, current * pageSize);
  45. const result = {
  46. data: {
  47. list: dataSource,
  48. totalCount: tableListDataSource.length,
  49. pageSize: pageSize,
  50. },
  51. status: 200,
  52. success: true,
  53. };
  54. return res.json(result);
  55. }
  56. function postList(req, res, u, b) {
  57. let realUrl = u;
  58. if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
  59. realUrl = req.url;
  60. }
  61. const { method, body } = req;
  62. tableListDataSource.push({ ...body });
  63. const result = {
  64. status: 200,
  65. msg: '',
  66. };
  67. res.json(result);
  68. }
  69. function delList(req, res, u, b) {
  70. const { method, body } = req;
  71. tableListDataSource = tableListDataSource.filter((item) => !body.includes(item.roleId));
  72. const result = {
  73. status: 200,
  74. msg: '',
  75. };
  76. res.json(result);
  77. }
  78. function getTableList(req, res, u, b){
  79. const data = {
  80. titleMap:{
  81. '1':'泌尿外科1',
  82. '2':'泌尿外科2',
  83. '3':'泌尿外科3',
  84. '3':'泌尿外科4',
  85. '5':'泌尿外科5',
  86. '6':'泌尿外科6'
  87. },
  88. realData:[
  89. {
  90. "1": "医务收入",
  91. "2": 2400,
  92. "3": 2400,
  93. "4": "医务收入4",
  94. "5": 2400,
  95. "6": 2400
  96. },
  97. {
  98. "1": "医务收入",
  99. "2": 2400,
  100. "3": 2400,
  101. "4": "医务收入4",
  102. "5": 2400,
  103. "6": 2400
  104. },
  105. {
  106. "1": "医务收入",
  107. "2": 2400,
  108. "3": 2400,
  109. "4": "医务收入4",
  110. "5": 2400,
  111. "6": 2400
  112. },
  113. {
  114. "1": "医务收入",
  115. "2": 2400,
  116. "3": 2400,
  117. "4": "医务收入4",
  118. "5": 2400,
  119. "6": 2400
  120. },
  121. {
  122. "1": "医务收入",
  123. "2": 2400,
  124. "3": 2400,
  125. "4": "医务收入4",
  126. "5": 2400,
  127. "6": 2400
  128. },
  129. {
  130. "1": "医务收入",
  131. "2": 2400,
  132. "3": 2400,
  133. "4": "医务收入4",
  134. "5": 2400,
  135. "6": 2400
  136. },
  137. {
  138. "1": "医务收入",
  139. "2": 2400,
  140. "3": 2400,
  141. "4": "医务收入4",
  142. "5": 2400,
  143. "6": 2400
  144. },
  145. {
  146. "1": "医务收入",
  147. "2": 2400,
  148. "3": 2400,
  149. "4": "医务收入4",
  150. "5": 2400,
  151. "6": 2400
  152. },
  153. {
  154. "1": "医务收入",
  155. "2": 2400,
  156. "3": 2400,
  157. "4": "医务收入4",
  158. "5": 2400,
  159. "6": 2400
  160. },
  161. {
  162. "1": "医务收入",
  163. "2": 2400,
  164. "3": 2400,
  165. "4": "医务收入4",
  166. "5": 2400,
  167. "6": 2400
  168. },
  169. {
  170. "1": "医务收入",
  171. "2": 2400,
  172. "3": 2400,
  173. "4": "医务收入4",
  174. "5": 2400,
  175. "6": 2400
  176. }
  177. ],
  178. totalMap:{
  179. "1": 1000,
  180. "2": 2400,
  181. "3": 2400,
  182. "4": 400,
  183. "5": 2400,
  184. }
  185. }
  186. const result = {
  187. status: 200,
  188. msg: '',
  189. data:data
  190. };
  191. res.json(result);
  192. }
  193. function getHasBindMenuList(req, res, u, b){
  194. const data = [
  195. {
  196. id:98,name:'菜单98'
  197. },
  198. {
  199. id:92,name:'菜单92'
  200. }
  201. ]
  202. const result = {
  203. status: 200,
  204. msg: '',
  205. data:data
  206. };
  207. res.json(result);
  208. }
  209. function bindList(req, res, u, b) {
  210. const { method, body } = req;
  211. const { roleId, userIds } = body;
  212. const result = {
  213. status: 200,
  214. msg: '',
  215. };
  216. res.json(result);
  217. }
  218. export default {
  219. 'GET /api/costAccount/incomeCollection/collectList': getList,
  220. 'GET /api/costAccount/incomeCollection/collectTableList': getTableList,
  221. 'GET /api/costAccount/role/roleMenus': getHasBindMenuList,
  222. 'POST /api/costAccount/costotherpayments/save': postList,
  223. 'POST /api/costAccount/role/delete': delList,
  224. 'POST /api/costAccount/role/editUserRole': bindList,
  225. };