|
|
@@ -1,12 +1,4 @@
|
|
|
import './index.css';
|
|
|
-import {
|
|
|
- Download,
|
|
|
- FileAdditionOne,
|
|
|
- FileExcel,
|
|
|
- Refresh,
|
|
|
- Save,
|
|
|
- Upload,
|
|
|
-} from '@icon-park/react';
|
|
|
import {MENU_STORAGE} from '@utils';
|
|
|
import {Button, Space, Upload as AntUpload, UploadProps} from 'antd';
|
|
|
import {useLocation} from 'react-router-dom';
|
|
|
@@ -20,6 +12,14 @@ import {
|
|
|
useContextSection,
|
|
|
} from '@hooks';
|
|
|
import {useSaveSetting} from './hooks';
|
|
|
+import {
|
|
|
+ DownloadOutlined,
|
|
|
+ FileAddOutlined,
|
|
|
+ FileExcelOutlined,
|
|
|
+ ReloadOutlined,
|
|
|
+ SaveOutlined,
|
|
|
+ UploadOutlined,
|
|
|
+} from '@ant-design/icons';
|
|
|
|
|
|
type Props = {
|
|
|
onAdd?: () => void;
|
|
|
@@ -72,59 +72,49 @@ const LDTableTool: FC<PropsWithChildren<Props>> = function({
|
|
|
<section className="ld-table-tool">
|
|
|
<h1 className="ld-table-tool-title">{tableTitle}</h1>
|
|
|
<Space>
|
|
|
- {onAdd && (
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- onClick={onAdd}
|
|
|
- data-testid="add_btn"
|
|
|
- icon={<FileAdditionOne theme="outline" className="anticon" />}
|
|
|
- >
|
|
|
- 新增
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- {onRefresh && (
|
|
|
- <Button
|
|
|
- data-testid="refresh_btn"
|
|
|
- onClick={onRefresh}
|
|
|
- loading={isRefreshing}
|
|
|
- icon={<Refresh theme="outline" className="anticon" />}
|
|
|
- >
|
|
|
- 刷新
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- {onDownload && (
|
|
|
- <Button
|
|
|
- onClick={onDownload}
|
|
|
- icon={<Download theme="outline" className="anticon" />}
|
|
|
- >
|
|
|
- 模板下载
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- {uploadProps && (
|
|
|
- <AntUpload {...uploadProps}>
|
|
|
- <Button
|
|
|
- loading={isUploading}
|
|
|
- icon={<Upload theme="outline" className="anticon" />}
|
|
|
- >
|
|
|
- 模板上传
|
|
|
- </Button>
|
|
|
- </AntUpload>
|
|
|
- )}
|
|
|
- {onExport && (
|
|
|
+ {onAdd && <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={onAdd}
|
|
|
+ data-testid="add_btn"
|
|
|
+ icon={<FileAddOutlined />}
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </Button>}
|
|
|
+ <Button
|
|
|
+ data-testid="refresh_btn"
|
|
|
+ onClick={onRefresh}
|
|
|
+ loading={isRefreshing}
|
|
|
+ icon={<ReloadOutlined />}
|
|
|
+ >
|
|
|
+ 刷新
|
|
|
+ </Button>
|
|
|
+ {onDownload && <Button
|
|
|
+ onClick={onDownload}
|
|
|
+ icon={<DownloadOutlined />}
|
|
|
+ >
|
|
|
+ 模板下载
|
|
|
+ </Button>}
|
|
|
+ {uploadProps && <AntUpload {...uploadProps}>
|
|
|
<Button
|
|
|
- data-testid="export_btn"
|
|
|
- onClick={onExport(tableTitle)}
|
|
|
- loading={isExporting}
|
|
|
- icon={<FileExcel theme="outline" className="anticon" />}
|
|
|
+ loading={isUploading}
|
|
|
+ icon={<UploadOutlined />}
|
|
|
>
|
|
|
- 导出
|
|
|
+ 模板上传
|
|
|
</Button>
|
|
|
- )}
|
|
|
+ </AntUpload>}
|
|
|
+ {onExport && <Button
|
|
|
+ data-testid="export_btn"
|
|
|
+ onClick={onExport(tableTitle)}
|
|
|
+ loading={isExporting}
|
|
|
+ icon={<FileExcelOutlined />}
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </Button>}
|
|
|
<Button
|
|
|
data-testid="save_setting_btn"
|
|
|
loading={isSaveing}
|
|
|
onClick={onSaveClick}
|
|
|
- icon={<Save theme="outline" className="anticon" />}
|
|
|
+ icon={<SaveOutlined />}
|
|
|
>
|
|
|
保存配置
|
|
|
</Button>
|