refactor(annotation): 简化注释数据导出下载逻辑

- 移除前端手动创建 a 标签下载文件的方式
- 将文件名参数传递给后端 API 函数
- 利用 download 函数内置的下载处理机制
- 简化 ExportAnnotationDialog 组件中的导出流程
- 更新 annotation.api.ts 中的 downloadAnnotationsUsingGet 函数签名
- 直接通过 API 调用完成文件下载和命名
This commit is contained in:
2026-01-30 17:33:14 +08:00
parent 6dfed934a5
commit a4cdaecf8a
2 changed files with 11 additions and 18 deletions

View File

@@ -109,12 +109,13 @@ export function downloadAnnotationsUsingGet(
projectId: string,
format: ExportFormat = "json",
onlyAnnotated: boolean = true,
includeData: boolean = false
includeData: boolean = false,
filename?: string
) {
const params = new URLSearchParams({
format,
only_annotated: String(onlyAnnotated),
include_data: String(includeData),
});
return download(`/api/annotation/export/projects/${projectId}/download?${params.toString()}`);
return download(`/api/annotation/export/projects/${projectId}/download?${params.toString()}`, null, filename);
}