Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"antd": "^5.27.0",
"i18next": "^25.8.0",
"jssha": "^3.3.1",
"jszip": "^3.10.1",
"lucide-react": "^0.539.0",
"mammoth": "^1.11.0",
"react": "^18.1.1",
Expand Down
43 changes: 34 additions & 9 deletions frontend/src/pages/DataManagement/Detail/components/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function Overview({ dataset, filesOperation, fetchDataset }) {
pagination,
selectedFiles,
setSelectedFiles,
clearSelection,
previewVisible,
previewFileName,
previewContent,
Expand All @@ -43,18 +44,23 @@ export default function Overview({ dataset, filesOperation, fetchDataset }) {
handleDownloadFile,
handleBatchDeleteFiles,
handleBatchExport,
handleSelectionChange,
handleCreateDirectory,
handleDownloadDirectory,
handleDeleteDirectory,
handleRenameFile,
handleRenameDirectory,
} = filesOperation;

// 文件列表多选配置
// 文件列表多选配置(支持跨页选择)
const rowSelection = {
onChange: (selectedRowKeys: React.Key[], selectedRows: any[]) => {
setSelectedFiles(selectedRowKeys as number[]);
},
selectedRowKeys: selectedFiles,
onChange: handleSelectionChange,
preserveSelectedRowKeys: true, // 关键:跨页时保持选中状态
getCheckboxProps: (record: any) => ({
// 目录和文件都可以选择
name: record.fileName,
}),
};

// 显示删除确认弹窗
Expand Down Expand Up @@ -428,18 +434,36 @@ export default function Overview({ dataset, filesOperation, fetchDataset }) {
{selectedFiles.length > 0 && (
<div className="flex items-center gap-2 p-3 bg-blue-50 rounded-lg border border-blue-200">
<span className="text-sm text-blue-700 font-medium">
{t("dataManagement.detail.selectedFiles", { count: selectedFiles.length })}
已选择 {selectedFiles.length} 项
{(() => {
const dirCount = selectedFiles.filter(id => typeof id === 'string' && id.startsWith('directory-')).length;
const fileCount = selectedFiles.length - dirCount;
if (dirCount > 0 && fileCount > 0) {
return ` (${fileCount} 个文件, ${dirCount} 个文件夹)`;
} else if (dirCount > 0) {
return ` (${dirCount} 个文件夹)`;
} else if (fileCount > 0) {
return ` (${fileCount} 个文件)`;
}
return '';
})()}
</span>
<Button
onClick={clearSelection}
className="ml-auto"
>
取消选择
</Button>
<Button
onClick={handleBatchExport}
className="ml-auto bg-transparent"
className="bg-white"
>
<Download className="w-4 h-4 mr-2" />
{t("dataManagement.actions.batchExport")}
</Button>
<Button
onClick={handleBatchDeleteFiles}
className="text-red-600 hover:text-red-700 hover:bg-red-50 bg-transparent"
danger
>
<Trash2 className="w-4 h-4 mr-2" />
{t("dataManagement.actions.batchDelete")}
Expand Down Expand Up @@ -497,14 +521,15 @@ export default function Overview({ dataset, filesOperation, fetchDataset }) {
rowKey="id"
columns={columns}
dataSource={fileList}
// rowSelection={rowSelection}
scroll={{ x: "max-content", y: 600 }}
rowSelection={rowSelection}
scroll={{ x: "max-content" }}
pagination={{
current: pagination.current,
pageSize: pagination.pageSize,
total: pagination.total,
showTotal: (total) => t("dataManagement.detail.totalItems", { total }),
showSizeChanger: true,
pageSizeOptions: [10, 20, 50, 100],
onChange: (page, pageSize) => {
filesOperation.fetchFiles(filesOperation.pagination.prefix, page, pageSize);
}
Expand Down
Loading
Loading