parent
e76f048fab
commit
05e69e8f74
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* @Description: 模拟数据
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2020-01-11 10:55:33
|
||||
* @LastEditors : tangjiang
|
||||
* @LastEditTime : 2020-01-11 11:58:08
|
||||
*/
|
||||
import { random } from 'lodash';
|
||||
|
||||
const getGuid = () =>
|
||||
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||
/* eslint-disable */
|
||||
let r = (Math.random() * 16) | 0,
|
||||
v = c == 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
|
||||
const fetchData = (startIndex = 0) =>
|
||||
new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(
|
||||
startIndex >= 500 // 总共只有500条数据
|
||||
? []
|
||||
: Array.from({ length: 50 }).map((_, i) => {
|
||||
// 每次返回100条
|
||||
const index = startIndex + i;
|
||||
return {
|
||||
key: getGuid(),
|
||||
index: `${index}`,
|
||||
name: 'John Brown',
|
||||
age: 32,
|
||||
address: 'New York No. 1 Lake Park',
|
||||
};
|
||||
}),
|
||||
);
|
||||
}, random(0, 1.0) * 1000);
|
||||
});
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
render: text => text,
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
title: '使用单位',
|
||||
dataIndex: 'name',
|
||||
// width: 100,
|
||||
},
|
||||
{
|
||||
title: '使用课堂/个',
|
||||
// width: 200,
|
||||
dataIndex: 'age',
|
||||
},
|
||||
{
|
||||
title: '课堂学生/个',
|
||||
// width: 200,
|
||||
dataIndex: 'address',
|
||||
},
|
||||
{
|
||||
title: '选用实训/个',
|
||||
// width: 200,
|
||||
dataIndex: 'address',
|
||||
},
|
||||
{
|
||||
title: '选用实训/个',
|
||||
// width: 200,
|
||||
dataIndex: 'address',
|
||||
}
|
||||
];
|
||||
|
||||
const sumData = [
|
||||
{
|
||||
index: '合计',
|
||||
key: ',4',
|
||||
name: 'Disabled User',
|
||||
age: 99,
|
||||
address: 'Sidney No. 1 Lake Park',
|
||||
},
|
||||
];
|
||||
|
||||
export { columns, fetchData, sumData };
|
Loading…
Reference in new issue