123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- /*
- * @Author: your name
- * @Date: 2021-08-12 09:59:49
- * @LastEditTime: 2021-08-12 20:32:24
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: /CostAccountManaSys/mock/afterCollectionSearch.js
- */
- // eslint-disable-next-line import/no-extraneous-dependencies
- import moment from 'moment';
- import { parse } from 'url'; // mock tableListDataSource
- const genList = (current, pageSize) => {
- const tableListDataSource = [];
- for (let i = 0; i < pageSize; i += 1) {
- const index = (current - 1) * 10 + i;
- tableListDataSource.push({
- key: index,
- id: index,
- year:'2021',
- month:'08',
- departmentCode:`departmentCode ${index}`,
- departmentName:`departmentName ${index}`,
- responsibilityCode:`responsibilityCode ${index}`,
- responsibilityName:`responsibilityName ${index}`,
- accountingCode:`responsibilityCode ${index}`,
- accountingName:`responsibilityName ${index}`,
- projectCode:`projectCode ${index}`,
- projectName:`projectName ${index}`,
- isDirectIncome:0,
- amount:2000
- });
- }
- // console.log({tableListDataSource});
- tableListDataSource.reverse();
- return tableListDataSource;
- };
- let tableListDataSource = genList(1, 100);
- function getList(req, res, u) {
- let realUrl = u;
- if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
- realUrl = req.url;
- }
- const { current = 1, pageSize = 10 } = req.query;
- let dataSource = [...tableListDataSource].slice((current - 1) * pageSize, current * pageSize);
- const result = {
- data: {
- list: dataSource,
- totalCount: tableListDataSource.length,
- pageSize: pageSize,
- },
- status: 200,
- success: true,
- };
- return res.json(result);
- }
- function postList(req, res, u, b) {
- let realUrl = u;
- if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
- realUrl = req.url;
- }
- const { method, body } = req;
- tableListDataSource.push({ ...body });
- const result = {
- status: 200,
- msg: '',
- };
- res.json(result);
- }
- function delList(req, res, u, b) {
- const { method, body } = req;
- tableListDataSource = tableListDataSource.filter((item) => !body.includes(item.roleId));
- const result = {
- status: 200,
- msg: '',
- };
- res.json(result);
- }
- function getTableList(req, res, u, b){
- const data = {
- titleMap:{
- '1':'泌尿外科1',
- '2':'泌尿外科2',
- '3':'泌尿外科3',
- '3':'泌尿外科4',
- '5':'泌尿外科5',
- '6':'泌尿外科6'
- },
- realData:[
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- },
- {
- "1": "医务收入",
- "2": 2400,
- "3": 2400,
- "4": "医务收入4",
- "5": 2400,
- "6": 2400
- }
- ],
- totalMap:{
- "1": 1000,
- "2": 2400,
- "3": 2400,
- "4": 400,
- "5": 2400,
- }
-
- }
-
- const result = {
- status: 200,
- msg: '',
- data:data
- };
- res.json(result);
- }
- function getHasBindMenuList(req, res, u, b){
- const data = [
- {
- id:98,name:'菜单98'
- },
- {
- id:92,name:'菜单92'
- }
- ]
-
- const result = {
- status: 200,
- msg: '',
- data:data
- };
- res.json(result);
- }
- function bindList(req, res, u, b) {
- const { method, body } = req;
- const { roleId, userIds } = body;
- const result = {
- status: 200,
- msg: '',
- };
- res.json(result);
- }
- export default {
- 'GET /api/costAccount/incomeCollection/collectList': getList,
- 'GET /api/costAccount/incomeCollection/collectTableList': getTableList,
- 'GET /api/costAccount/role/roleMenus': getHasBindMenuList,
- 'POST /api/costAccount/costotherpayments/save': postList,
- 'POST /api/costAccount/role/delete': delList,
- 'POST /api/costAccount/role/editUserRole': bindList,
- };
|