91 lines
3.1 KiB
TypeScript
91 lines
3.1 KiB
TypeScript
/**
|
|
* 交叉评查文件信息组件
|
|
*/
|
|
|
|
interface FileInfoProps {
|
|
fileInfo: {
|
|
fileName: string;
|
|
contractNumber: string;
|
|
fileSize?: string;
|
|
fileFormat?: string;
|
|
pageCount?: number;
|
|
uploadTime?: string;
|
|
uploadUser?: string;
|
|
auditStatus?: number;
|
|
path?: string;
|
|
previousRoute?: string;
|
|
fileType?: string;
|
|
};
|
|
onConfirmResults: () => void;
|
|
}
|
|
|
|
export function FileInfo({ fileInfo, onConfirmResults }: FileInfoProps) {
|
|
|
|
const handleDownloadFile = () => {
|
|
if (fileInfo.path) {
|
|
// 创建一个隐藏的下载链接
|
|
const link = document.createElement('a');
|
|
link.href = fileInfo.path;
|
|
link.download = fileInfo.fileName;
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
} else {
|
|
alert('文件路径不存在,无法下载');
|
|
}
|
|
};
|
|
|
|
const handleExportReport = () => {
|
|
alert('导出交叉评查报告功能');
|
|
};
|
|
|
|
return (
|
|
<div className="mb-4 file-info-header">
|
|
<div className="flex justify-between items-center">
|
|
<div className="flex-1">
|
|
{/* 文件基本信息已在面包屑区域显示,这里可以不重复显示 */}
|
|
</div>
|
|
|
|
{/* 操作按钮区域 */}
|
|
<div className="flex items-center gap-3">
|
|
{/* 下载原文件按钮 */}
|
|
<button
|
|
onClick={handleDownloadFile}
|
|
className="inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
|
>
|
|
<i className="fas fa-download mr-1.5"></i>
|
|
下载原文件
|
|
</button>
|
|
|
|
{/* 导出评查报告按钮 */}
|
|
<button
|
|
onClick={handleExportReport}
|
|
className="inline-flex items-center px-3 py-1.5 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
>
|
|
<i className="fas fa-file-export mr-1.5"></i>
|
|
导出评查报告
|
|
</button>
|
|
|
|
{/* 确认评查结果按钮 - 只在未审核通过时显示 */}
|
|
{fileInfo.auditStatus !== 1 && (
|
|
<button
|
|
onClick={onConfirmResults}
|
|
className="inline-flex items-center px-3 py-1.5 text-sm font-medium text-white bg-green-600 border border-transparent rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"
|
|
>
|
|
<i className="fas fa-check mr-1.5"></i>
|
|
确认评查结果
|
|
</button>
|
|
)}
|
|
|
|
{/* 已确认状态显示 */}
|
|
{fileInfo.auditStatus === 1 && (
|
|
<span className="inline-flex items-center px-3 py-1.5 text-sm font-medium text-green-700 bg-green-100 border border-green-200 rounded-md">
|
|
<i className="fas fa-check-circle mr-1.5"></i>
|
|
评查结果已确认
|
|
</span>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|