import { Modal } from '../ui/Modal'; import { Table } from '../ui/Table'; import { Button } from '../ui/Button'; import { FileIcon } from '../ui/FileIcon'; import { FileTypeTag } from '../ui/FileTypeTag'; import { StatusBadge } from '../ui/StatusBadge'; import { Pagination } from '../ui/Pagination'; import { LoadingIndicator } from '../ui/SkeletonScreen'; import type { ReviewFileUI } from '~/api/evaluation_points/rules-files'; // import { updateDocumentAuditStatus } from '~/api/evaluation_points/rules-files'; import { toastService } from '../ui/Toast'; // 导出样式链接 export const links = () => []; interface DocumentListModalProps { isOpen: boolean; onClose: () => void; title: string; files: ReviewFileUI[]; onViewFile?: (fileId: string) => void; loading?: boolean; // 分页相关属性 currentPage?: number; pageSize?: number; total?: number; onPageChange?: (page: number) => void; onPageSizeChange?: (size: number) => void; } export function DocumentListModal({ isOpen, onClose, title, files, onViewFile, loading = false, // 分页属性,使用默认值 currentPage = 1, pageSize = 10, total = 0, onPageChange, onPageSizeChange }: DocumentListModalProps) { // 查看评查文件 const handleReviewFileClick = async (fileId: string, auditStatus: number | null) => { // 检查audit_status是否为0,如果是则更新为2 if (auditStatus === 0 || auditStatus === null) { try { // TODO: 这里需要从父组件传递 userId,或者重新设计这个函数的调用方式 // 暂时跳过状态更新,直接进入查看 // const response = await updateDocumentAuditStatus(fileId, 2, userId); // if (response.error) { // throw new Error(response.error); // } console.warn('DocumentListModal: 跳过审核状态更新,需要传递 userId 参数'); } catch (error) { console.error('更新文件审核状态时出错:', error); toastService.error(`更新文件审核状态时出错:${error instanceof Error ? error.message : '未知错误'}`); return; } } // 如果有自定义的查看处理函数,则调用它 if (onViewFile) { onViewFile(fileId); } }; // 渲染问题摘要 const renderIssues = (file: ReviewFileUI) => { // 如果文件状态为完成 if (file.status === 'Processed') { // 如果没有问题,显示"所有评查点均通过" if (file.warningCount <= 0 && file.failCount <= 0) { return (