From 0eaaa5b04132d90ef77d3fbf9020da0d3a62f3cc Mon Sep 17 00:00:00 2001 From: yorn <1057707203@qq.com> Date: Thu, 24 Apr 2025 20:51:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=A8=E5=B1=80=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E8=BF=9B=E5=BA=A6=E6=9D=A1=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/reviews/FileInfo.tsx | 26 +- app/components/reviews/ReviewPointsList.tsx | 12 +- app/components/ui/LoadingBar.tsx | 131 +++++++++ app/root.tsx | 2 + app/routes/documents._index.tsx | 307 +++++++++++--------- app/routes/reviews.tsx | 6 +- 6 files changed, 340 insertions(+), 144 deletions(-) create mode 100644 app/components/ui/LoadingBar.tsx 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() { <> {/* 文件信息和操作按钮 */}