huibing.xie | 4e36a1e | 2018-08-27 15:06:55 +0800 | [diff] [blame^] | 1 | import Mock from 'mockjs' |
| 2 | import { param2Obj } from '@/utils' |
| 3 | |
| 4 | const recordList = Mock.mock({ |
| 5 | 'list|4': [{ |
| 6 | 'id': '@increment', |
| 7 | 'zy|1': ['市场营销', '人力资源管理', '自动化'], |
| 8 | 'zyid|1': [27, 28, 29], |
| 9 | 'zylx|1-1000': 100, |
| 10 | 'bzylx|1-1000': 100 |
| 11 | }] |
| 12 | }).list |
| 13 | |
| 14 | export default{ |
| 15 | getList: config => { |
| 16 | const { pcmc, yx, pageIndex = 1, pageSize = 20 } = param2Obj(config.url) |
| 17 | const mockList = recordList.filter(item => { |
| 18 | if (pcmc && item.pcmc + '' !== pcmc + '') return false |
| 19 | if (yx && item.yx && item.yx + '' !== yx + '') return false |
| 20 | return true |
| 21 | }) |
| 22 | |
| 23 | const pageList = mockList.filter((item, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)) |
| 24 | return { |
| 25 | items: pageList, |
| 26 | recordCount: mockList.length, |
| 27 | code: 200 |
| 28 | } |
| 29 | }, |
| 30 | getLeaveAuditResult: config => { |
| 31 | return { |
| 32 | data: { |
| 33 | zylx: 100, |
| 34 | bzylx: 200 |
| 35 | }, |
| 36 | code: 200 |
| 37 | } |
| 38 | } |
| 39 | } |