declare const _default: "import * as React from 'react';\nimport { OverflowToolTip, Table, Empty } from '@/components';\nimport { Button } from 'antd';\nconst { TimeRangeItem } = Table;\nexport interface Props {}\nexport interface State {\n currentPage: number;\n}\nconst dataSource = [];\nconst dataSource1 = [];\nconst dataSource2 = [];\nfor (let i = 0; i < 10; i++) {\n dataSource.push({\n key: i,\n name: '胡彦斌',\n age: 32 + 1,\n address: '西湖区湖底公园1号',\n });\n dataSource1.push({\n key: i,\n name:\n '计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划计划',\n age: 32 + 1,\n address: '西湖区湖底公园1号',\n startTime: '2020-11-20 11:20:00',\n endTime: '2021-11-20 11:20:00',\n });\n}\nconst dataSource3 = [\n { categoryV1: '社会', categoryV2: '天气情况', categoryV3: '气温' },\n { categoryV1: '社会', categoryV2: '天气情况', categoryV3: '异常天气' },\n { categoryV1: '社会', categoryV2: '天气情况', categoryV3: '台风 ' },\n { categoryV1: '社会', categoryV2: '自然灾害', categoryV3: '泥石流 ' },\n { categoryV1: '社会', categoryV2: '自然灾害', categoryV3: '森林火灾 ' },\n { categoryV1: '社会', categoryV2: '油价涨跌', categoryV3: '' },\n { categoryV1: '时政', categoryV2: '人事任免', categoryV3: '大使任命' },\n { categoryV1: '时政', categoryV2: '人事任免', categoryV3: '机构调整改革' },\n];\nconst columns = [\n {\n title: '姓名',\n dataIndex: 'name',\n key: 'name',\n },\n {\n title: '年龄',\n dataIndex: 'age',\n key: 'age',\n sorter: true,\n },\n {\n title: '住址',\n dataIndex: 'address',\n key: 'address',\n },\n];\nconst columns1 = [\n {\n title: 'ID/名称',\n dataIndex: 'name',\n key: 'name',\n width: '200px',\n render: (text, record) => {\n return (\n <>\n \n \n \n );\n },\n },\n {\n title: '年龄',\n dataIndex: 'age',\n key: 'age',\n sorter: true,\n },\n {\n title: '住址',\n dataIndex: 'address',\n key: 'address',\n },\n {\n title: '起止时间',\n dataIndex: 'time',\n key: 'time',\n render: (text, record) => {\n return (\n \n );\n },\n },\n];\n\n// 判断合并数据的行数\nconst getRowSpans = (arr, key) => {\n let sameValueLength = 0;\n const rowSpans = [];\n for (let i = arr.length - 1; i >= 0; i--) {\n if (i === 0) {\n rowSpans[i] = sameValueLength + 1;\n continue;\n }\n if (arr[i][key] === arr[i - 1][key]) {\n rowSpans[i] = 0;\n sameValueLength++;\n } else {\n rowSpans[i] = sameValueLength + 1;\n sameValueLength = 0;\n }\n }\n return rowSpans;\n};\nconst column3 = [\n {\n title: '一级分类',\n dataIndex: 'categoryV1',\n key: 'categoryV1',\n render: (value, _, index) => {\n const obj = {\n children: value,\n props: { rowSpan: 1 },\n };\n obj.props.rowSpan = getRowSpans(dataSource3, 'categoryV1')[index];\n return obj;\n },\n },\n {\n title: '二级分类',\n dataIndex: 'categoryV2',\n key: 'categoryV2',\n render: (value, _, index) => {\n const obj = {\n children: value,\n props: { rowSpan: 1 },\n };\n obj.props.rowSpan = getRowSpans(dataSource3, 'categoryV2')[index];\n return obj;\n },\n },\n {\n title: '三级分类',\n dataIndex: 'categoryV3',\n key: 'categoryV3',\n },\n];\nclass Demo extends React.Component {\n constructor(props: Props) {\n super(props);\n this.state = {\n currentPage: 1,\n };\n }\n onChange = (page, pageSize) => {\n this.setState({\n currentPage: page,\n });\n };\n render() {\n const { currentPage } = this.state;\n return (\n <>\n

单行table

\n this.onChange(page, pageSize)}\n onTableChange={(sorter) => {}}\n dataSource={dataSource}\n columns={columns}\n />\n
\n

双行table

\n this.onChange(page, pageSize)}\n onTableChange={(sorter) => {}}\n dataSource={dataSource1}\n columns={columns1}\n towLine={true}\n />\n
\n

合并单元格table

\n \n
\n

无数据table

\n this.onChange(page, pageSize)}\n onTableChange={(sorter) => {}}\n dataSource={dataSource2}\n columns={columns1}\n towLine={true}\n />\n
\n

自定义无数据样式Table

\n this.onChange(page, pageSize)}\n onTableChange={(sorter) => {}}\n dataSource={dataSource2}\n columns={columns1}\n towLine={true}\n renderEmpty={\n 创建XXX}>\n }\n />\n \n );\n }\n}\n\nexport default Demo;\n"; export default _default;