From 659ce212aef639f2768efafb30ceb221ed0c1c6e Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:58:54 +0800 Subject: [PATCH] fix: fix issues --- app/pages/Import/FileList/UploadConfigModal/index.tsx | 4 ++-- app/pages/Import/FileList/index.tsx | 1 + .../Import/TaskCreate/SchemaConfig/FileMapping/index.tsx | 4 +++- app/pages/Import/TaskCreate/SchemaConfig/index.tsx | 2 +- app/stores/global.ts | 8 +++++--- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/pages/Import/FileList/UploadConfigModal/index.tsx b/app/pages/Import/FileList/UploadConfigModal/index.tsx index 240dbc79..d01e783e 100644 --- a/app/pages/Import/FileList/UploadConfigModal/index.tsx +++ b/app/pages/Import/FileList/UploadConfigModal/index.tsx @@ -96,7 +96,7 @@ const UploadConfigModal = (props: IProps) => { }, [data]); const deletePreviewFile = useCallback((e: React.MouseEvent, index: number) => { e.stopPropagation(); - const isActive = activeItem.uid === data[index].uid; + const isActive = activeItem?.uid === data[index].uid; const newData = data.filter((_, i) => i !== index); const checkedNum = data.reduce((n, file) => n + (file.withHeader & 1), 0); setState({ @@ -175,7 +175,7 @@ const UploadConfigModal = (props: IProps) => { render: value => {value}, }; }) - : [], [previewContent, activeItem]); + : [], [previewContent, activeItem?.withHeader]); const handleConfirm = useCallback(() => { const existFileName = fileList.map((file) => file.name); const repeatFiles = data.filter((file) => existFileName.includes(file.name)); diff --git a/app/pages/Import/FileList/index.tsx b/app/pages/Import/FileList/index.tsx index 1fed645a..75877536 100644 --- a/app/pages/Import/FileList/index.tsx +++ b/app/pages/Import/FileList/index.tsx @@ -120,6 +120,7 @@ const FileList = () => { title={intl.get('common.ask')} okText={intl.get('common.confirm')} cancelText={intl.get('common.cancel')} + disabled={!selectFiles.length} >