import Mock from 'mockjs'; /*临期预警设置*/ export default ({mock}) => { if (!mock) return; //新增 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/add"), 'post', () => { return Mock.mock({ code: 1, data: 1 }); }); //删除 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/del"), 'delete', () => { return Mock.mock({ code: 1, data: 1 }); }); //编辑 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/upd"), 'post', () => { return Mock.mock({ code: 1, data: 1 }); }); //修改状态 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/updStatus"), 'post', () => { return Mock.mock({ code: 1, data: 1 }); }); //详情 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/detail"), 'get', () => { const phonePrefix = ['132', '135', '189'] const index = Math.floor(Math.random() * phonePrefix.length) var phone = [] for (let i = 0; i < 15; i++) { phone.push(phonePrefix[index] + Mock.mock(/\d{8}/)) } return Mock.mock({ code: 1, data: { id: '@id', tempExpirationNotifyName: '@ctitle(3,5)', tempExpirationNotifyCode: '@id', createOrgName: '@city()', 'expireBefore1|5-10': 6, 'beforeManagerNotify1|0-1': 0, 'beforeManagerNotifyUser1|3-6': [ { id: '@id', userName: '@cname', } ], 'expireBefore2|5-10': 6, 'beforeManagerNotify2|0-1': 0, 'beforeManagerNotifyUser2|3-6': [ { id: '@id', userName: '@cname', } ], 'expireBefore3|5-10': 6, 'beforeManagerNotify3|0-1': 0, 'beforeManagerNotifyUser3|3-6': [ { id: '@id', userName: '@cname', } ], 'expireAfter1|5-10': 6, 'afterManagerNotify1|0-1': 0, 'afterManagerNotifyUser1|3-6': [ { id: '@id', userName: '@cname', } ], 'expireAfter2|5-10': 6, 'afterManagerNotify2|0-1': 0, 'afterManagerNotifyUser2|3-6': [ { id: '@id', userName: '@cname', } ], 'expireAfter3|5-10': 6, 'afterManagerNotify3|0-1': 0, 'afterManagerNotifyUser3|3-6': [ { id: '@id', userName: '@cname', } ], "notifyWx|0-1": 0, "notifyMobMsg|0-1": 0, "notifyMobMsgWay|0-1": 0, "status|0-1": 0, notifyMob: phone.join(','), 'notifyTime|0-23': 9 }, }); }); //查询列表 Mock.mock(new RegExp("/pc/p/temp/expiration/notify/list"), 'get', () => { return Mock.mock({ code: 1, 'data|10': [ { id: '@id', tempExpirationNotifyName: '@ctitle(3,5)', tempExpirationNotifyCode: '@id', createOrgName: '@city()', "notifyWx|0-1": 0, "notifyMobMsg|0-1": 0, "notifyMobMsgWay|0-1": 0, "status|0-1": 0, }, ] }); }) }