添加zorro,alain样例
This commit is contained in:
@ -10,7 +10,7 @@ for (let i = 0; i < 46; i += 1) {
|
||||
href: 'https://ant.design',
|
||||
avatar: [
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png'
|
||||
][i % 2],
|
||||
no: `TradeCode ${i}`,
|
||||
title: `一个任务名称 ${i}`,
|
||||
@ -20,11 +20,11 @@ for (let i = 0; i < 46; i += 1) {
|
||||
status: Math.floor(Math.random() * 10) % 4,
|
||||
updatedAt: new Date(`2017-07-${i < 18 ? '0' + (Math.floor(i / 2) + 1) : Math.floor(i / 2) + 1}`),
|
||||
createdAt: new Date(`2017-07-${i < 18 ? '0' + (Math.floor(i / 2) + 1) : Math.floor(i / 2) + 1}`),
|
||||
progress: Math.ceil(Math.random() * 100),
|
||||
progress: Math.ceil(Math.random() * 100)
|
||||
});
|
||||
}
|
||||
|
||||
function getRule(params: any): any[] {
|
||||
function getRule(params: any): any {
|
||||
let ret = [...list];
|
||||
if (params.sorter) {
|
||||
const s = params.sorter.split('_');
|
||||
@ -36,22 +36,23 @@ function getRule(params: any): any[] {
|
||||
});
|
||||
}
|
||||
if (params.statusList && params.statusList.length > 0) {
|
||||
ret = ret.filter((data) => params.statusList.indexOf(data.status) > -1);
|
||||
ret = ret.filter(data => params.statusList.indexOf(data.status) > -1);
|
||||
}
|
||||
if (params.no) {
|
||||
ret = ret.filter((data) => data.no.indexOf(params.no) > -1);
|
||||
ret = ret.filter(data => data.no.indexOf(params.no) > -1);
|
||||
}
|
||||
return ret;
|
||||
return { data: ret, success: true };
|
||||
}
|
||||
|
||||
function removeRule(nos: string): boolean {
|
||||
nos.split(',').forEach((no) => {
|
||||
const idx = list.findIndex((w) => w.no === no);
|
||||
function removeRule(nos: string): any {
|
||||
nos.split(',').forEach(no => {
|
||||
const idx = list.findIndex(w => w.no === no);
|
||||
if (idx !== -1) {
|
||||
list.splice(idx, 1);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
||||
return { data: true, success: true };
|
||||
}
|
||||
|
||||
function saveRule(description: string): void {
|
||||
@ -61,7 +62,7 @@ function saveRule(description: string): void {
|
||||
href: 'https://ant.design',
|
||||
avatar: [
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png'
|
||||
][i % 2],
|
||||
no: `TradeCode ${i}`,
|
||||
title: `一个任务名称 ${i}`,
|
||||
@ -71,12 +72,12 @@ function saveRule(description: string): void {
|
||||
status: Math.floor(Math.random() * 10) % 2,
|
||||
updatedAt: new Date(),
|
||||
createdAt: new Date(),
|
||||
progress: Math.ceil(Math.random() * 100),
|
||||
progress: Math.ceil(Math.random() * 100)
|
||||
});
|
||||
}
|
||||
|
||||
export const RULES = {
|
||||
'/rule': (req: MockRequest) => getRule(req.queryString),
|
||||
'DELETE /rule': (req: MockRequest) => removeRule(req.queryString.nos),
|
||||
'POST /rule': (req: MockRequest) => saveRule(req.body.description),
|
||||
'POST /rule': (req: MockRequest) => getRule(req.queryString),
|
||||
'POST /delete/rule': (req: MockRequest) => removeRule(req.body.nos),
|
||||
// 'POST /rule': (req: MockRequest) => saveRule(req.body.description)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user