huibing.xie | 1718f36 | 2018-08-24 14:50:58 +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 | 'hjmc|1': ['后勤处', '财务处', '学生处'], |
| 8 | 'hjid': '@word(5)', |
| 9 | 'dsh|1-1000': 100, |
| 10 | 'shtg|1-1000': 100, |
| 11 | 'shbtg|1-1000': 100 |
| 12 | }] |
| 13 | }).list |
| 14 | |
| 15 | export default{ |
| 16 | getList: config => { |
| 17 | const { pcmc, xh, xm, sfzylx, yx, zy, bj, xslb, pageIndex = 1, pageSize = 20 } = param2Obj(config.url) |
| 18 | const mockList = recordList.filter(item => { |
| 19 | if (pcmc && item.pcmc + '' !== pcmc + '') return false |
| 20 | if (xh && item.xh !== xh) return false |
| 21 | if (xm && item.xm !== xm) return false |
| 22 | if (sfzylx && item.sfzylx !== sfzylx) return false |
| 23 | if (yx && item.yx !== yx) return false |
| 24 | if (zy && item.zy !== zy) return false |
| 25 | if (bj && item.bj !== bj) return false |
| 26 | if (xslb && item.xslb !== xslb) return false |
| 27 | return true |
| 28 | }) |
| 29 | |
| 30 | const pageList = mockList.filter((item, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)) |
| 31 | return { |
| 32 | items: pageList, |
| 33 | recordCount: mockList.length, |
| 34 | code: 200 |
| 35 | } |
| 36 | }, |
| 37 | getLeaveAuditResult: config => { |
| 38 | return { |
| 39 | data: { |
| 40 | zylx: 100, |
| 41 | bzylx: 200 |
| 42 | }, |
| 43 | code: 200 |
| 44 | } |
| 45 | } |
| 46 | } |