index.jsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import React from 'react';
  2. import { Table } from '../../../../index';
  3. class App extends React.Component {
  4. constructor(props) {
  5. super(props);
  6. this.columns = [
  7. {
  8. title: '需求标题',
  9. dataIndex: 'featureTitle',
  10. },
  11. {
  12. title: '文档',
  13. dataIndex: 'doc',
  14. },
  15. {
  16. title: '需求状态',
  17. dataIndex: 'featureStatus',
  18. },
  19. {
  20. title: '优先级',
  21. dataIndex: 'priority',
  22. },
  23. {
  24. title: 'PM',
  25. dataIndex: 'pm',
  26. },
  27. {
  28. title: '产品线',
  29. dataIndex: 'productLine',
  30. },
  31. {
  32. title: '前端',
  33. dataIndex: 'fe',
  34. },
  35. {
  36. title: '服务端',
  37. dataIndex: 'server',
  38. },
  39. {
  40. title: '创建时间',
  41. dataIndex: 'createTime',
  42. },
  43. {
  44. title: '完成时间',
  45. dataIndex: 'completeTime',
  46. },
  47. ];
  48. this.data = Array.from(
  49. {
  50. length: 200,
  51. },
  52. (_, key) => {
  53. const rowRandom = Math.round(Math.random() * 1000);
  54. const prioritySet = ['P0', 'P1', 'P2'];
  55. const priority = prioritySet[Math.round(Math.random() * 2)];
  56. const featureStatusSet = ['待埋点', '开始', '待需详评', '测试', '已完成'];
  57. const featureStatus = featureStatusSet[Math.round(Math.random() * 4)];
  58. const doc = 'https://semi.design';
  59. const createTime = new Date().valueOf();
  60. return ({
  61. key,
  62. featureTitle: `需求-${rowRandom}`,
  63. doc,
  64. featureStatus,
  65. priority,
  66. pm: 'Li',
  67. productLine: 'Hotsoon',
  68. fe: '石嘉',
  69. server: 'ZhuYi',
  70. createTime,
  71. completeTime: createTime + rowRandom,
  72. });
  73. }
  74. );
  75. this.scroll = { y: 500 };
  76. }
  77. render() {
  78. return (
  79. <>
  80. <Table
  81. title={`数据条数:${this.data.length}`}
  82. rowSelection
  83. columns={this.columns}
  84. dataSource={this.data}
  85. pagination={false}
  86. scroll={this.scroll}
  87. />
  88. </>
  89. );
  90. }
  91. }
  92. export default App;