data.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { BasicColumn } from '/@/components/Table';
  2. export const columns: BasicColumn[] = [
  3. {
  4. title: 'ID',
  5. dataIndex: 'id',
  6. width: 80,
  7. },
  8. {
  9. title: '姓名',
  10. dataIndex: 'name',
  11. width: 120,
  12. },
  13. {
  14. title: '年龄',
  15. dataIndex: 'age',
  16. width: 80,
  17. },
  18. {
  19. title: '编号',
  20. dataIndex: 'no',
  21. width: 80,
  22. },
  23. {
  24. title: '地址',
  25. dataIndex: 'address',
  26. },
  27. {
  28. title: '开始时间',
  29. dataIndex: 'beginTime',
  30. },
  31. {
  32. title: '结束时间',
  33. dataIndex: 'endTime',
  34. },
  35. ];
  36. export const data: any[] = (() => {
  37. const arr: any[] = [];
  38. for (let index = 0; index < 40; index++) {
  39. arr.push({
  40. id: `${index}`,
  41. name: `${index} John Brown`,
  42. age: `${index + 10}`,
  43. no: `${index}98678`,
  44. address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park',
  45. beginTime: new Date().toLocaleString(),
  46. endTime: new Date().toLocaleString(),
  47. });
  48. }
  49. return arr;
  50. })();
  51. // ["ID", "姓名", "年龄", "编号", "地址", "开始时间", "结束时间"]
  52. export const arrHeader = columns.map((column) => column.title);
  53. // [["ID", "姓名", "年龄", "编号", "地址", "开始时间", "结束时间"],["0", "0 John Brown", "10", "098678"]]
  54. export const arrData = data.map((item) => {
  55. return Object.keys(item).map((key) => item[key]);
  56. });