import { Button, Spin, Table, Tag } from "antd"; import { useEffect, useState } from "react"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import { Get } from "@cqsjjb/jjb-common-lib/http"; import PreviewUrlButton from "~/components/PreviewUrlButton/index"; import FilingTabs from "~/pages/Container/QualificationReview/FilingTabs"; const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list"; /** Mock 开关存储键(与机构备案管理列表共享,默认开启便于与原型对比) */ const ORG_MOCK_STORAGE_KEY = "registeredOrgMockEnabled"; function getOrgMockEnabled() { try { // URL 参数优先(?mock=1/0),并持久化到 localStorage。变更时间:2026-08-10 const qs = new URLSearchParams(window.location.search); if (qs.has("mock")) { const v = qs.get("mock") === "1"; localStorage.setItem(ORG_MOCK_STORAGE_KEY, v ? "1" : "0"); return v; } const stored = localStorage.getItem(ORG_MOCK_STORAGE_KEY); if (stored === "1") return true; if (stored === "0") return false; } catch { // ignore } return true; } /** * 机构基础信息详情 mock(与资质备案初审 qual-filing/detail 返回结构同构,便于复用 FilingTabs 六 Tab 展示)。 * 变更时间:2026-08-10(参考初审详情取数方式重构) */ const ORG_DETAIL_MOCK = { id: 1, filingStatusCode: 1, filingStatusName: "已备案", businessScope: ["COAL_MINING", "METAL_NONMETAL_MINING", "PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_SMELTING"], filingTerritoryName: "重庆市沙坪坝区", filingUnitName: "重庆安评技术研究院有限公司", filingUnitTypeName: "本地单位", creditCode: "915001072028699512", registerAddress: "重庆市沙坪坝区大学城东路20号", officeAddress: "重庆市沙坪坝区大学城东路20号重庆科技学院第39栋西南角实习用房三楼", qualCertNo: "API-2026-001", infoDisclosureUrl: "https://cqap.example.com", legalRepresentative: "郑远平", legalPersonPhone: "023-68705577", fax: "023-68705578", contactPhone: "陈芳 / 139****9012", fixedAssetAmount: 1200, workplaceArea: 1200, archiveRoomArea: 80, fulltimeEvaluatorCount: 25, registeredEngineerCount: 12, unitIntro: "重庆安评技术研究院成立于2015年,是一家专业从事安全评价、安全咨询、安全技术开发与转让的综合性安全技术服务机构。", attachmentUrl: JSON.stringify([{ name: "营业执照副本.pdf", url: "https://example.com/license.pdf" }]), personnelList: [ // technicalDirectorFlag/processControlLeaderFlag:true 归管理人员(用户要求 2026-08-10) // 学历/专业字段:educationName / basicDisciplineMajorName(用户要求 2026-08-10) { id: 1001, sourcePersonnelId: 1001, personName: "郑远平", positionName: "法定代表人", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "安全工程", workYears: "18年", technicalDirectorFlag: false, processControlLeaderFlag: false }, { id: 1002, sourcePersonnelId: 1002, personName: "张建国", positionName: "技术负责人", titleName: "正高级工程师", educationName: "本科", basicDisciplineMajorName: "化工工艺", workYears: "16年", technicalDirectorFlag: true, processControlLeaderFlag: false }, { id: 1003, sourcePersonnelId: 1003, personName: "王丽萍", positionName: "过程控制负责人", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "安全管理", workYears: "12年", technicalDirectorFlag: false, processControlLeaderFlag: true }, { id: 2001, sourcePersonnelId: 2001, personName: "李明华", positionName: "专职安全评价师", titleName: "高级工程师", educationName: "硕士", basicDisciplineMajorName: "采矿工程", workYears: "12年", evaluatorCertNo: "SJP-2020-001", professionalCapabilityCodeList: ["MINING"], appliedScope: ["METAL_NONMETAL_MINING"], technicalDirectorFlag: false, processControlLeaderFlag: false }, { id: 2002, sourcePersonnelId: 2002, personName: "陈志强", positionName: "专职安全评价师", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "化工工艺", workYears: "10年", evaluatorCertNo: "SJP-2019-023", professionalCapabilityCodeList: ["CHEMICAL_PROCESS"], appliedScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL"], technicalDirectorFlag: false, processControlLeaderFlag: false }, { id: 2003, sourcePersonnelId: 2003, personName: "刘海", positionName: "专职安全评价师", titleName: "工程师", educationName: "本科", basicDisciplineMajorName: "机械工程", workYears: "8年", evaluatorCertNo: "SJP-2021-045", professionalCapabilityCodeList: ["MECHANICAL"], appliedScope: ["METAL_SMELTING"], technicalDirectorFlag: false, processControlLeaderFlag: false }, ], materials: [ { id: 1, materialContent: "申请材料目录.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m1.pdf" }, { id: 2, materialContent: "安全评价机构资质申请书及材料清单.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m2.pdf" }, { id: 3, materialContent: "法人证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m3.pdf" }, { id: 4, materialContent: "截至申请之日三年内无重大违法失信记录的查询证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m4.pdf" }, { id: 5, materialContent: "申请单位法定代表人承诺书.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m5.pdf" }, { id: 6, materialContent: "固定资产法定证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m6.pdf" }, { id: 7, materialContent: "工作场所及档案室面积证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m7.pdf" }, { id: 8, materialContent: "安全评价师专业能力证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m8.pdf" }, { id: 9, materialContent: "专职技术负责人和支撑过程控制负责人证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m9.pdf" }, { id: 10, materialContent: "机构内部管理制度(非受控版).pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m10.pdf" }, ], equipmentList: [ { id: 301, deviceName: "气相色谱仪", deviceModel: "GC-2018", manufacturer: "岛津", equipmentValue: 120000, calibrationReportUrl: "https://example.com/cal1.pdf" }, { id: 302, deviceName: "噪声计", deviceModel: "HS-6288", manufacturer: "杭州爱华", equipmentValue: 8000, calibrationReportUrl: "https://example.com/cal2.pdf" }, { id: 303, deviceName: "粉尘采样器", deviceModel: "FC-5A", manufacturer: "北京劳保所", equipmentValue: 9000, calibrationReportUrl: "" }, ], commitment: { legalRepName: "郑远平", legalRepSignatureUrl: "https://example.com/sign.png", signDate: "2026-06-25 16:42", }, changes: [ { id: 1, submitTime: "2026-07-18 10:24", submitType: "注册提交", changeFields: "基础信息全量提交", submitter: "机构管理员", statusName: "待审核", statusColor: "warning", url: "https://example.com/c1.pdf" }, { id: 2, submitTime: "2026-07-20 15:36", submitType: "补正提交", changeFields: "营业执照、办公地址证明", submitter: "机构管理员", statusName: "已通过", statusColor: "success", url: "https://example.com/c2.pdf" }, ], }; function parseQueryId(location) { const search = location?.search || window.location.search || ""; return new URLSearchParams(search).get("id"); } /** * 机构基础信息详情(原型 mod-filing-detail) * - 数据获取使用变更接口:按变更记录 id 调 GET /safetyEval/qual-filing-change/detail(5 表聚合), * 六项 Tab 直接复用 FilingTabs(基础信息/管理人员/专职评价师/申请材料/设备清单/机构负责人签字) * - 变更记录 Tab:GET /safetyEval/qual-filing-change/history?filingId=(filingId 取详情返回的 filingId) * 返回 changeTime/changeItemName/operatorName/changeCount(原型「提交类型/审核状态/查看提交件」后端未返回,待补充) * 变更时间:2026-08-10(按用户要求改用带 change 的详情接口) */ function RegisteredOrgDetailPage(props) { const id = parseQueryId(props.location); const [detail, setDetail] = useState({}); const [changes, setChanges] = useState([]); const [loading, setLoading] = useState(Boolean(id)); const mockEnabled = getOrgMockEnabled(); useEffect(() => { if (!id) { setLoading(false); return; } if (mockEnabled) { setDetail(ORG_DETAIL_MOCK); setChanges(ORG_DETAIL_MOCK.changes); setLoading(false); return; } let cancelled = false; setLoading(true); (async () => { try { // 详情:变更聚合接口(QualFilingChangeAggregationCO:基础信息 + materials/equipmentList/commitment/personnelList) const detailRes = await Get( "/safetyEval/qual-filing-change/detail", { id }, { token: sessionStorage.getItem("token") }, ).catch(() => ({ data: {} })); if (cancelled) return; const filingId = detailRes?.data?.filingId || id; // 变更记录:history 按原备案 filingId 查询(优先取详情返回的 filingId) const historyRes = await Get( "/safetyEval/qual-filing-change/history", { filingId }, { token: sessionStorage.getItem("token") }, ).catch(() => ({ data: {} })); if (cancelled) return; setDetail(detailRes?.data || {}); // 变更记录:history 返回 { changeCount, records:[{id, changeItemName, changeTime, operatorName}] } setChanges(historyRes?.data?.records || []); } finally { if (!cancelled) setLoading(false); } })(); return () => { cancelled = true; }; }, [id]); const goBack = () => { if (props.history?.goBack && props.history.length > 1) { props.history.goBack(); return; } if (props.history?.push) { props.history.push(LIST_PATH); return; } window.location.href = `/certificate${LIST_PATH}`; }; if (!id) { return ( 返回}>

缺少机构 ID 参数

); } // mock 演示下 changes 为原型完整列;真实接口仅返回 变更时间/变更项/操作人 const changeColumns = mockEnabled || changes[0]?.submitTime ? [ { title: "提交时间", dataIndex: "submitTime", width: 150 }, { title: "提交类型", dataIndex: "submitType", width: 100 }, { title: "变更字段", dataIndex: "changeFields", ellipsis: true }, { title: "提交人", dataIndex: "submitter", width: 100 }, { title: "审核状态", width: 100, render: (_, record) => {record.statusName || "-"} }, { title: "操作", width: 110, render: (_, record) => ( 查看提交件 ), }, ] : [ { title: "变更时间", dataIndex: "changeTime", width: 160 }, { title: "变更项", dataIndex: "changeItemName", ellipsis: true }, { title: "操作人", dataIndex: "operatorName", width: 110 }, ]; /** 第 7 个 Tab:变更记录(原型 mod-filing-detail 变更记录 Tab)。变更时间:2026-08-10 */ const extraTabs = [ { key: "changes", label: "7. 变更记录", children: ( ), }, ]; return ( 机构基础信息详情{mockEnabled ? Mock 演示中 : null} } history={props.history} previous > {/* 七项 Tab:前六项复用资质备案初审详情组件(qual-filing/detail 数据),第 7 项为变更记录 */} ); } export default RegisteredOrgDetailPage;