From 3a3a28d5ea865484f2415d1be17f17e8b86b8ad6 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 18 Jan 2026 17:43:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(export):=20=E8=A7=A3=E5=86=B3=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加对 snake_case 格式字段的兼容支持 - 使用空值合并运算符处理字段缺失情况 - 保持原有 camelCase 字段的向后兼容性 - 确保统计数据正确显示无论后端返回哪种命名格式 --- .../src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx b/frontend/src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx index 8286ba6..ccc6df3 100644 --- a/frontend/src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx +++ b/frontend/src/pages/DataAnnotation/Home/ExportAnnotationDialog.tsx @@ -75,8 +75,9 @@ export default function ExportAnnotationDialog({ .then((res: any) => { const data = res?.data || res; setStats({ - totalFiles: data?.totalFiles || 0, - annotatedFiles: data?.annotatedFiles || 0, + // 兼容 snake_case 和 camelCase + totalFiles: data?.totalFiles ?? data?.total_files ?? 0, + annotatedFiles: data?.annotatedFiles ?? data?.annotated_files ?? 0, }); }) .catch((err) => {