隐藏上传文件入口,交叉评查的文件查看添加防抖点击,升级pdf加载组件版本优化清晰度
This commit is contained in:
@@ -9,6 +9,7 @@ import { LoadingIndicator } from '../ui/SkeletonScreen';
|
||||
import { updateDocumentAuditStatus, type TaskDocument } from '~/api/cross-checking/cross-files'; // 更新导入
|
||||
import { toastService } from '../ui/Toast';
|
||||
import { formatDate } from '~/utils';
|
||||
import {useRef, useState} from "react";
|
||||
|
||||
// 导出样式链接
|
||||
export const links = () => [];
|
||||
@@ -42,7 +43,16 @@ export function DocumentListModal({
|
||||
onPageChange,
|
||||
onPageSizeChange
|
||||
}: DocumentListModalProps) {
|
||||
|
||||
// 查看按钮防抖
|
||||
const [isnavigating,setIsnavigating] = useState(false)
|
||||
const viewDebounceRef = useRef<number | null>(null)
|
||||
const handleViewClickDebounced = (fileId: string, auditStatus: number | null) => {
|
||||
if(viewDebounceRef.current) return;
|
||||
viewDebounceRef.current = window.setTimeout(()=>{
|
||||
viewDebounceRef.current = null;
|
||||
},1000);
|
||||
void handleReviewFileClick(fileId, auditStatus);
|
||||
}
|
||||
// 查看评查文件
|
||||
const handleReviewFileClick = async (fileId: string, auditStatus: number | null) => {
|
||||
// 检查audit_status是否为0,如果是则更新为2
|
||||
@@ -61,6 +71,7 @@ export function DocumentListModal({
|
||||
|
||||
// 如果有自定义的查看处理函数,则调用它
|
||||
if (onViewFile) {
|
||||
setIsnavigating(true)
|
||||
onViewFile(fileId);
|
||||
}
|
||||
};
|
||||
@@ -250,11 +261,11 @@ export function DocumentListModal({
|
||||
type="default"
|
||||
size="small"
|
||||
icon="ri-eye-line"
|
||||
onClick={() => handleReviewFileClick(file.document_id.toString(), file.audit_status)}
|
||||
onClick={() => handleViewClickDebounced(file.document_id.toString(), file.audit_status)}
|
||||
disabled={file.status !== 'Processed'}
|
||||
className="mr-2"
|
||||
>
|
||||
查看
|
||||
{isnavigating ? '跳转中...' : '查看'}
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -334,8 +334,8 @@ export function FilePreview({ fileContent, activeReviewPointResultId, targetPage
|
||||
{/* 渲染PDF页面组件 */}
|
||||
<Page
|
||||
pageNumber={i} // 当前页码
|
||||
renderTextLayer={true} // 启用文本层,使文本可选择
|
||||
renderAnnotationLayer={true} // 启用注释层,显示PDF内置注释
|
||||
renderTextLayer={false} // 停用文本层,使文本可选择
|
||||
renderAnnotationLayer={false} // 停用注释层,显示PDF内置注释
|
||||
className="border border-gray-300 shadow-md" // 添加边框和阴影样式
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user