import React, { useState } from 'react'; import { json, type MetaFunction } from '@remix-run/node'; import { useLoaderData, useParams } from '@remix-run/react'; import { Button } from '~/components/ui/Button'; import { Card } from '~/components/ui/Card'; import { Breadcrumb } from '~/components/layout/Breadcrumb'; import type { ReviewResult, RuleCheckResult } from '~/models/review'; import type { File } from '~/models/file'; import { RULE_CHECK_STATUS_LABELS, RULE_CHECK_STATUS_COLORS } from '~/models/review'; export const meta: MetaFunction = () => { return [ { title: "中国烟草AI合同及卷宗审核系统 - 评查详情" }, { name: "description", content: "文件评查详情页面" } ]; }; export const handle = { breadcrumb: '评查详情' }; interface LoaderData { file: File; reviewResult: ReviewResult; reviewPoints: RuleCheckResult[]; fileContent?: string; // 模拟文件内容 } export async function loader({ params }) { const { reviewId } = params; // 模拟数据,实际项目中应从API获取 const file: File = { id: "1", fileName: "2023年度烟草专卖零售许可证.pdf", fileType: "application/pdf", documentTypeId: "2", documentTypeName: "专卖许可证", fileSize: 1024 * 1024 * 2.5, // 2.5MB uploaderId: "1", uploaderName: "张三", status: "completed", reviewStatus: "pass", createdAt: "2023-12-24 14:30", updatedAt: "2023-12-24 16:45" }; const reviewResult: ReviewResult = { id: reviewId, fileId: "1", fileName: "2023年度烟草专卖零售许可证.pdf", totalPoints: 15, passPoints: 6, warningPoints: 7, errorPoints: 2, score: 80, reviewStatus: "warning", reviewedAt: "2023-12-24 16:45", reviewerId: "system", reviewerName: "AI系统", createdAt: "2023-12-24 14:35", updatedAt: "2023-12-24 16:45" }; const reviewPoints: RuleCheckResult[] = [ { id: "1", reviewResultId: reviewId, ruleId: "1", ruleName: "合同主体信息完整性检查", status: "pass", location: "第1页 第3段", content: "甲方:XX烟草公司,地址:XX市XX区XX路XX号,法定代表人:张XX", suggestion: "主体信息完整,符合规范", manualReviewed: false, createdAt: "2023-12-24 14:40", updatedAt: "2023-12-24 14:40" }, { id: "2", reviewResultId: reviewId, ruleId: "2", ruleName: "许可证编号格式检查", status: "warning", location: "第1页 第5段", content: "许可证编号:(2023)12345", suggestion: "许可证编号格式不完全符合规范,建议修改为'烟零许(2023)12345号'", manualReviewed: true, createdAt: "2023-12-24 14:40", updatedAt: "2023-12-24 15:20" }, { id: "3", reviewResultId: reviewId, ruleId: "3", ruleName: "许可证有效期检查", status: "fail", location: "第1页 第8段", content: "有效期:自2023年1月1日", suggestion: "许可证缺少有效期截止日期,必须明确注明有效期限", manualReviewed: false, createdAt: "2023-12-24 14:40", updatedAt: "2023-12-24 14:40" }, { id: "4", reviewResultId: reviewId, ruleId: "4", ruleName: "经营场所信息检查", status: "pass", location: "第1页 第12段", content: "经营场所:XX市XX区XX街XX号,面积:120平方米", suggestion: "经营场所信息完整", manualReviewed: false, createdAt: "2023-12-24 14:40", updatedAt: "2023-12-24 14:40" } ]; // 模拟文件内容,实际项目中应从API获取或使用专用组件展示 const fileContent = `烟草专卖零售许可证 发证机关:XX市烟草专卖局 发证日期:2023年1月1日 甲方:XX烟草公司,地址:XX市XX区XX路XX号,法定代表人:张XX 零售单位名称:XX便利店 许可证编号:(2023)12345 法定代表人/负责人:李XX 经营者类型:个体工商户 有效期:自2023年1月1日 联系电话:123-4567890 经营场所:XX市XX区XX街XX号,面积:120平方米 零售烟草制品品种:卷烟、雪茄烟 特别说明:本许可证不得伪造、变造、转让、涂改。 `; return json({ file, reviewResult, reviewPoints, fileContent }); } export default function ReviewDetail() { const { file, reviewResult, reviewPoints, fileContent } = useLoaderData(); const [activeTab, setActiveTab] = useState('tab-preview'); const [selectedPoint, setSelectedPoint] = useState(null); const handleTabChange = (tabId: string) => { setActiveTab(tabId); }; const handlePointSelect = (pointId: string) => { setSelectedPoint(pointId === selectedPoint ? null : pointId); }; return (

{file.fileName}

{reviewResult.reviewStatus === 'pass' ? '通过' : reviewResult.reviewStatus === 'warning' ? '警告' : '不通过'}
handleTabChange('tab-preview')} > 评查结果
handleTabChange('tab-suggestion')} > AI智能分析
handleTabChange('tab-fileinfo')} > 文件信息
{/* 文件内容预览 */}
                    {fileContent}
                  
{/* 评查点列表 */}
评查结果
{/* 评查统计 */}
{reviewResult.totalPoints}
总计
{reviewResult.passPoints}
通过
{reviewResult.warningPoints}
警告
{reviewResult.errorPoints}
错误
{/* 评查点列表 */}
{reviewPoints.map(point => (
handlePointSelect(point.id)} >
{point.ruleName}
{RULE_CHECK_STATUS_LABELS[point.status]}
{point.location}
{selectedPoint === point.id && (
内容: {point.content}
建议: {point.suggestion}
{point.manualReviewed && 人工审核 }
)}
))}
AI智能分析意见
总体评价
该烟草专卖零售许可证文档基本符合规范要求,但存在部分问题需要修改。主要包括许可证编号格式不标准和缺少有效期截止日期两个问题,其中缺少有效期截止日期属于严重问题,必须补充完善。
主要问题
  • 许可证编号格式不规范 - 当前格式为"(2023)12345",应修改为"烟零许(2023)12345号"
  • 缺少许可证有效期截止日期 - 仅注明了起始日期"自2023年1月1日",缺少截止日期
修改建议
  • 规范许可证编号格式,在前面添加"烟零许",在后面添加"号"
  • 补充完善许可证有效期,明确注明截止日期,如"自2023年1月1日至2023年12月31日"
  • 建议对零售烟草制品品种部分进行细化描述,列明具体品牌类别
文件基本信息
文件名称 {file.fileName}
文件类型 {file.documentTypeName}
文件大小 {(file.fileSize / (1024 * 1024)).toFixed(2)} MB
上传人 {file.uploaderName}
上传时间 {file.createdAt}
评查状态 {reviewResult.reviewStatus === 'pass' ? '通过' : reviewResult.reviewStatus === 'warning' ? '警告' : '不通过'}
评查得分 {reviewResult.score} 分
评查完成时间 {reviewResult.reviewedAt}
评查人 {reviewResult.reviewerName}
评查总点数 {reviewResult.totalPoints} 项
); }