import React, { useEffect, useState } from "react"; import { Button, Input, Modal, Table, Tag } from "antd"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import PreviewUrlButton from "~/components/PreviewUrlButton"; import { ARCHIVE_TYPE_MAP, ARCHIVE_RECORD_SOURCE_MAP, } from "~/enumerate/constant"; /** 解析文件地址:相对路径拼接 window.fileUrl(与 PreviewUrlButton 保持一致) */ const resolveFileUrl = (raw) => { if (!raw) return ""; const u = String(raw); return /^https?:\/\//i.test(u) ? u : `${window.fileUrl || ""}${u}`; }; /** 项目档案查看弹窗(原型 modal-reg-project-archive) */ function ArchiveModal({ record, loading, fetchFiles, onClose }) { const [query, setQuery] = useState({ pageIndex: 1, pageSize: 10, fileName: "" }); const [list, setList] = useState([]); const [total, setTotal] = useState(0); useEffect(() => { if (!record?.id) return; fetchFiles({ projectId: record.id, ...query }).then((res) => { if (res?.success !== false) { setList(res?.data || []); setTotal(res?.totalCount || 0); } }); }, [record?.id, query]); const handleDownload = (file) => { const url = resolveFileUrl(file.fileUrl); if (!url) return; const a = document.createElement("a"); a.href = url; a.download = file.fileName || ""; a.target = "_blank"; document.body.appendChild(a); a.click(); document.body.removeChild(a); }; const columns = [ { title: "序号", width: 60, render: (_, __, index) => (query.pageIndex - 1) * query.pageSize + index + 1, }, { title: "文件名称", dataIndex: "fileName", ellipsis: true, render: (v, r) => (
{v || "-"}
{r.recordSource === "upload_additional_files" ? "评价机构补充上传" : "业务节点自动归集"}
), }, { title: "档案类型", dataIndex: "archiveType", width: 130, }, { title: "来源", dataIndex: "recordSource", width: 120, render: (v) => v ? ( {ARCHIVE_RECORD_SOURCE_MAP[v]} ) : ( "-" ), }, { title: "业务节点", dataIndex: "businessNode", width: 130, render: (v) => v || "-", }, { title: "操作", width: 120, render: (_, r) => ( 查看 ), }, ]; const processCount = record?.processFileCount ?? 0; const additionalCount = record?.additionalFileCount ?? 0; return (
项目档案查看
查看项目执行过程中由系统形成及机构补充上传的档案资料
} width={1000} footer={} destroyOnHidden onCancel={onClose} className="epd-archive" >
项目名称 {record?.projectName || "-"} {record?.projectNo}
评价机构 {record?.orgName || "-"}
评价类型 {record?.evalTypeName || "-"}
档案数量 {processCount + additionalCount} 份 流程文档 {processCount} / 补充文件 {additionalCount}
setQuery((q) => ({ ...q, fileName: v, pageIndex: 1 }))} className="epd-archive__search" /> `共 ${t} 条`, onChange: (page, pageSize) => setQuery((q) => ({ ...q, pageIndex: page, pageSize })), }} /> ); } export default ArchiveModal;