新增全局加载进度条组件
This commit is contained in:
@@ -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) {
|
||||
<button
|
||||
className="ant-btn ant-btn-default flex items-center"
|
||||
onClick={() => handleBack()}
|
||||
disabled={isNavigating}
|
||||
>
|
||||
<i className="ri-arrow-left-line mr-1"></i> 返回
|
||||
<i className="ri-arrow-left-line mr-1"></i> {isNavigating ? '返回中...' : '返回'}
|
||||
</button>
|
||||
<button
|
||||
className="ant-btn ant-btn-default flex items-center"
|
||||
|
||||
@@ -1024,9 +1024,15 @@ export function ReviewPointsList({
|
||||
<div className="review-point-header flex justify-between items-start">
|
||||
<div className="review-point-title flex-1 text-left min-w-[25%]">{reviewPoint.title}</div>
|
||||
{/* 评查点所属分组 */}
|
||||
<div className="review-point-location max-w-[40%]">
|
||||
<i className="ri-file-list-line mr-1"></i>
|
||||
<span>{reviewPoint.groupName}</span>
|
||||
<div className="review-point-location max-w-[40%] flex items-center">
|
||||
<i className="ri-file-list-line mr-1 flex-shrink-0"></i>
|
||||
<span
|
||||
className="truncate block whitespace-nowrap overflow-hidden hover:overflow-visible hover:text-clip hover:bg-white hover:shadow-md hover:z-10 hover:text-wrap px-1 rounded"
|
||||
title={reviewPoint.groupName}
|
||||
style={{ cursor: 'text', userSelect: 'all' }}
|
||||
>
|
||||
{reviewPoint.groupName}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center ml-2 flex-shrink-0 max-w-[15%]">
|
||||
{renderStatusBadge(reviewPoint.status, reviewPoint.result)}
|
||||
|
||||
Reference in New Issue
Block a user