/**
* 文件详情组件
* 显示文件基本信息、合同信息和评查信息
*/
import { ReactNode } from 'react';
// 文件基本信息
interface FileInfo {
fileName: string;
contractNumber: string;
fileSize: string;
fileFormat: string;
pageCount: number;
uploadTime: string;
uploadUser: string;
}
// 合同信息
interface ContractInfo {
contractType: string;
signDate: string;
parties: {
partyA: string;
partyB: string;
};
amount: string;
period: string;
}
// 评查信息
interface ReviewInfo {
reviewTime: string;
reviewModel: string;
ruleGroup: string;
result: string;
issueCount: number;
}
interface FileDetailsProps {
fileInfo: FileInfo;
contractInfo: ContractInfo;
reviewInfo: ReviewInfo;
}
export function FileDetails({ fileInfo, contractInfo, reviewInfo }: FileDetailsProps) {
// 情况状态对应的标签
const renderResultBadge = (result: string) => {
switch (result) {
case 'success':
return (
通过
);
case 'warning':
return (
警告
);
case 'error':
return (
不通过
);
default:
return (
警告
);
}
};
// 渲染信息区块
const renderInfoSection = (title: string, icon: string, color: string, children: ReactNode) => {
return (
{/* 文件基本信息 */}
{renderInfoSection('文件基本信息', 'ri-file-info-line', 'blue', (
{renderInfoRow('文件名称', fileInfo.fileName)}
{renderInfoRow('合同编号', fileInfo.contractNumber)}
{renderInfoRow('文件大小', fileInfo.fileSize)}
{renderInfoRow('文件格式', fileInfo.fileFormat)}
{renderInfoRow('页数', `${fileInfo.pageCount}页`)}
{renderInfoRow('上传时间', fileInfo.uploadTime)}
{renderInfoRow('上传用户', fileInfo.uploadUser)}
))}
{/* 合同信息 */}
{renderInfoSection('合同信息', 'ri-file-paper-2-line', 'green', (
{renderInfoRow('合同类型', contractInfo.contractType)}
{renderInfoRow('签约日期', contractInfo.signDate)}
{renderInfoRow('合同当事人', (
甲方:{contractInfo.parties.partyA}
乙方:{contractInfo.parties.partyB}
))}
{renderInfoRow('合同金额', contractInfo.amount)}
{renderInfoRow('履行期限', contractInfo.period)}
))}
{/* 评查信息 */}
{renderInfoSection('评查信息', 'ri-search-eye-line', 'purple', (
<>
{renderInfoRow('评查时间', reviewInfo.reviewTime)}
{renderInfoRow('评查模型', reviewInfo.reviewModel)}
{renderInfoRow('评查规则组', reviewInfo.ruleGroup)}
{renderInfoRow('评查结果', (
{renderResultBadge(reviewInfo.result)}
(共发现{reviewInfo.issueCount}个问题)
))}
>
))}
);
}