diff --git a/app/components/reviews/FileInfo.tsx b/app/components/reviews/FileInfo.tsx index 03c9172..5938ef2 100644 --- a/app/components/reviews/FileInfo.tsx +++ b/app/components/reviews/FileInfo.tsx @@ -1,5 +1,6 @@ import { useNavigate } from "@remix-run/react"; -import { toastService } from "~/components/ui/Toast"; +import { useState } from "react"; + interface FileInfoProps { fileInfo: { fileName: string; @@ -11,12 +12,15 @@ interface FileInfoProps { uploadUser?: string; auditStatus?: number; path?: string; + previousRoute?: string; }; onConfirmResults: () => void; } export function FileInfo({ fileInfo, onConfirmResults }: FileInfoProps) { const navigate = useNavigate(); + const [isNavigating, setIsNavigating] = useState(false); + const handleDownloadFile = async () => { try { const urlBefore = 'http://172.18.0.100:9000/docauditai/'; @@ -56,7 +60,22 @@ export function FileInfo({ fileInfo, onConfirmResults }: FileInfoProps) { }; const handleBack = () => { - navigate(-1); + // 防抖处理 - 如果已经在导航中,不重复触发 + if (isNavigating) return; + + // 设置导航状态为true + setIsNavigating(true); + + // 根据来源页面返回 + const previousRoute = fileInfo.previousRoute || 'documents'; + const returnTo = previousRoute === 'documents' + ? "/documents" + : previousRoute === 'filesUpload' + ? "/files/upload" + : "/rules-files"; + + // 立即导航返回 + navigate(returnTo); }; const handleExportReport = () => { @@ -89,8 +108,9 @@ export function FileInfo({ fileInfo, onConfirmResults }: FileInfoProps) { - - - - {/* 搜索筛选区 */} - - - {/* */} - - } - noActionDivider={true} - > -
- - - - - - - - - - - handleDateChange('dateFrom', value)} - onEndDateChange={(value) => handleDateChange('dateTo', value)} - simple={true} - /> -
-
- - - {/* 数据表格 */} - -
+
+ {/* 页面内容,在加载时降低不透明度但不隐藏内容 */} +
+ {/* 页面头部 */} +
+

文档列表

- -
-
- 共 {total} 条记录
-
- + + {/* */} + + } + noActionDivider={true} + > +
+ + + + + + + + + + + handleDateChange('dateFrom', value)} + onEndDateChange={(value) => handleDateChange('dateTo', value)} + simple={true} + /> +
+ + + + {/* 数据表格 */} + +
+
+ + +
+
+ 共 {total} 条记录 +
+
+ +
+
+ + + {/* 分页 */} + - - - {/* 分页 */} - - + + ); } diff --git a/app/routes/reviews.tsx b/app/routes/reviews.tsx index d58257b..6791bc3 100644 --- a/app/routes/reviews.tsx +++ b/app/routes/reviews.tsx @@ -45,6 +45,7 @@ import { // 从ReviewPointsList组件中导入ReviewPoint类型 import { type ReviewPoint } from '~/components/reviews'; import { messageService } from "~/components/ui/MessageModal"; +import { Button } from "~/components/ui/Button"; /** @@ -485,7 +486,10 @@ export default function ReviewDetails() { <> {/* 文件信息和操作按钮 */}