优化ImportFile

master
LiuJiaNan 2025-12-18 16:30:01 +08:00
parent 47fd256ac8
commit 7ca0eebaf1
2 changed files with 9 additions and 2 deletions

View File

@ -12,13 +12,17 @@ export interface ImportFileProps extends Omit<FormProps, "form"> {
/** 弹窗标题 */
title?: string;
/** 模板文件地址 */
templateUrl: string;
templateUrl?: string;
/** 子组件 */
children?: ReactNode | ((props: { form: FormInstance }) => ReactNode);
/** 确认回调 */
onConfirm: (values: FormValues) => void;
/** 取消回调 */
onCancel: () => void;
/** 导出模板按钮文字,默认 “导出模板” */
exportTemplateButtonText?: ReactNode;
/** 额外按钮 */
extraButtons?: ReactNode;
}
/**

View File

@ -14,6 +14,8 @@ const ImportFile = (props) => {
templateUrl,
labelCol = { span: 4 },
children,
exportTemplateButtonText = "导出模板",
extraButtons,
...restProps
} = props;
@ -55,9 +57,10 @@ const ImportFile = (props) => {
footer={[
templateUrl && (
<Button key="export" onClick={handleExportTemplate}>
导出模板
{exportTemplateButtonText}
</Button>
),
{extraButtons},
<Button key="cancel" onClick={handleClose}>
取消
</Button>,