# Table
通用Table组件

## props

| 参数 | 说明 | 类型 | 默认值 |
| :-----| :---- | :---- | :---- |
| columns | 列配置 | Array<{ dataIndex: string }>
| dataSource? | 数据源 | Array
| url? | 获取数据url地址 | string | 
| query? | 查询参数 | object |
| rowKey? | 唯一key，当前数据源中不能重复 | string | id
| extra? | 额外 | Array<{ dataIndex: string; render: Function}> |
| rowSelectionType? | 是否可选择 | 'checkbox' or 'radio'
| flat? | 扁平化显示，适用于详情页列表 | boolean? | false
| maxShowLine? | flat为true，可通过只参数控制显示条数，超过滚动 | boolean or number | 15
| preserveSelectedRows? | 为true时,query变化将不会清除已选数据 | boolean | false
| toolNode? | 底部工具栏，已有选择数据显示 | (selectNum: number): ReactNode |
| hanlderQuery? | 处理query，并将处理后的query传入url body | (query: T): T |
| hanlderResult? | 处理result | (result: any): { rows: [], count: number } |
| onDoubleClick? | 双击事件 | (row: RecordType): void; |

### columns Array<{ColumnProps}>
| 参数 | 说明 | 类型 | 默认值 |
| :-----| :---- | :---- | :---- |
| format | 自动format | 'money' or 'time' or 'date'
| isTooltip | 使用tooltip | 'boolean | false

### extra Array<{ExtraItemProps}>
| 参数 | 说明 | 类型 | 默认值 |
| :-----| :---- | :---- | :---- |
| dataIndex | 对应column item dataIndex | string
| render | 自定义渲染tbody th | (text: string, record: RecordType, index: number): ReactNode;
| headerRender? | 自定义渲染thead th | (): ReactNode
| required? | 是否显示必填标记，只控制UI | boolean


## ref

### getSelectedRows
获取用户选中的行
```JS
const [rows, rowKeys] = tableRef.current?.getSelectedRows();
```

### removeSelectedRows
取消选中的行
```JS
tableRef.current?.removeSelectedRows([rowKey]);
```

### onRefresh
重新获取数据
```JS
tableRef.current?.onRefresh();
```

### getDataSource
获取dataSource
```JS
const dataSource = tableRef.current?.getDataSource();
```