safety-eval-service-frontend/src/pages/Container/Supervision/BasicInfo/RegisteredOrg/Detail/index.js

241 lines
13 KiB
JavaScript
Raw Normal View History

2026-08-10 17:02:48 +08:00
import { Button, Spin, Table, Tag } from "antd";
import { useEffect, useState } from "react";
2026-06-29 16:45:58 +08:00
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
2026-08-10 17:02:48 +08:00
import { Get } from "@cqsjjb/jjb-common-lib/http";
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
import FilingTabs from "~/pages/Container/QualificationReview/FilingTabs";
2026-06-26 17:28:06 +08:00
const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list";
2026-07-13 11:14:27 +08:00
2026-08-10 14:16:49 +08:00
/** Mock 开关存储键(与机构备案管理列表共享,默认开启便于与原型对比) */
const ORG_MOCK_STORAGE_KEY = "registeredOrgMockEnabled";
2026-06-26 17:28:06 +08:00
2026-08-10 14:16:49 +08:00
function getOrgMockEnabled() {
try {
2026-08-10 17:02:48 +08:00
// 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;
}
2026-08-10 14:16:49 +08:00
const stored = localStorage.getItem(ORG_MOCK_STORAGE_KEY);
if (stored === "1") return true;
if (stored === "0") return false;
} catch {
// ignore
}
return true;
2026-06-26 17:28:06 +08:00
}
2026-08-10 17:02:48 +08:00
/**
* 机构基础信息详情 mock与资质备案初审 qual-filing/detail 返回结构同构便于复用 FilingTabs Tab 展示
* 变更时间2026-08-10参考初审详情取数方式重构
*/
2026-08-10 14:16:49 +08:00
const ORG_DETAIL_MOCK = {
2026-08-10 17:02:48 +08:00
id: 1,
filingStatusCode: 1,
filingStatusName: "已备案",
2026-08-10 14:16:49 +08:00
businessScope: ["COAL_MINING", "METAL_NONMETAL_MINING", "PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_SMELTING"],
filingTerritoryName: "重庆市沙坪坝区",
2026-08-10 17:02:48 +08:00
filingUnitName: "重庆安评技术研究院有限公司",
2026-08-10 14:16:49 +08:00
filingUnitTypeName: "本地单位",
2026-08-10 17:02:48 +08:00
creditCode: "915001072028699512",
2026-08-10 14:16:49 +08:00
registerAddress: "重庆市沙坪坝区大学城东路20号",
2026-08-10 17:02:48 +08:00
officeAddress: "重庆市沙坪坝区大学城东路20号重庆科技学院第39栋西南角实习用房三楼",
2026-08-10 14:16:49 +08:00
qualCertNo: "API-2026-001",
2026-08-10 17:02:48 +08:00
infoDisclosureUrl: "https://cqap.example.com",
2026-08-10 14:16:49 +08:00
legalRepresentative: "郑远平",
2026-08-10 17:02:48 +08:00
legalPersonPhone: "023-68705577",
2026-08-10 14:16:49 +08:00
fax: "023-68705578",
contactPhone: "陈芳 / 139****9012",
fixedAssetAmount: 1200,
workplaceArea: 1200,
archiveRoomArea: 80,
fulltimeEvaluatorCount: 25,
registeredEngineerCount: 12,
unitIntro: "重庆安评技术研究院成立于2015年是一家专业从事安全评价、安全咨询、安全技术开发与转让的综合性安全技术服务机构。",
2026-08-10 17:02:48 +08:00
attachmentUrl: JSON.stringify([{ name: "营业执照副本.pdf", url: "https://example.com/license.pdf" }]),
personnelList: [
// technicalDirectorFlag/processControlLeaderFlagtrue 归管理人员(用户要求 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 },
2026-08-10 14:16:49 +08:00
],
materials: [
2026-08-10 17:02:48 +08:00
{ 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" },
2026-08-10 14:16:49 +08:00
],
2026-08-10 17:02:48 +08:00
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: "" },
2026-08-10 14:16:49 +08:00
],
commitment: {
legalRepName: "郑远平",
2026-08-10 17:02:48 +08:00
legalRepSignatureUrl: "https://example.com/sign.png",
2026-08-10 14:16:49 +08:00
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" },
],
};
2026-07-07 15:58:05 +08:00
2026-08-10 14:16:49 +08:00
function parseQueryId(location) {
const search = location?.search || window.location.search || "";
return new URLSearchParams(search).get("id");
2026-06-26 17:28:06 +08:00
}
2026-08-10 17:02:48 +08:00
/**
* 机构基础信息详情原型 mod-filing-detail
* - 数据获取使用变更接口按变更记录 id GET /safetyEval/qual-filing-change/detail5 表聚合
* 六项 Tab 直接复用 FilingTabs基础信息/管理人员/专职评价师/申请材料/设备清单/机构负责人签字
* - 变更记录 TabGET /safetyEval/qual-filing-change/history?filingId=filingId 取详情返回的 filingId
* 返回 changeTime/changeItemName/operatorName/changeCount原型提交类型/审核状态/查看提交件后端未返回待补充
* 变更时间2026-08-10按用户要求改用带 change 的详情接口
*/
2026-06-26 17:28:06 +08:00
function RegisteredOrgDetailPage(props) {
2026-08-10 17:02:48 +08:00
const id = parseQueryId(props.location);
const [detail, setDetail] = useState({});
const [changes, setChanges] = useState([]);
const [loading, setLoading] = useState(Boolean(id));
2026-08-10 14:16:49 +08:00
const mockEnabled = getOrgMockEnabled();
2026-06-26 17:28:06 +08:00
useEffect(() => {
if (!id) {
2026-08-10 17:02:48 +08:00
setLoading(false);
2026-06-26 17:28:06 +08:00
return;
}
2026-08-10 14:16:49 +08:00
if (mockEnabled) {
2026-08-10 17:02:48 +08:00
setDetail(ORG_DETAIL_MOCK);
setChanges(ORG_DETAIL_MOCK.changes);
setLoading(false);
2026-08-10 14:16:49 +08:00
return;
}
2026-06-26 17:28:06 +08:00
let cancelled = false;
2026-08-10 17:02:48 +08:00
setLoading(true);
2026-06-26 17:28:06 +08:00
(async () => {
try {
2026-08-10 17:02:48 +08:00
// 详情变更聚合接口QualFilingChangeAggregationCO基础信息 + materials/equipmentList/commitment/personnelList
const detailRes = await Get(
"/safetyEval/qual-filing-change/detail",
{ id },
{ token: sessionStorage.getItem("token") },
).catch(() => ({ data: {} }));
2026-08-10 14:16:49 +08:00
if (cancelled) return;
2026-08-10 17:02:48 +08:00
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 || []);
2026-07-15 16:13:07 +08:00
} finally {
2026-08-10 17:02:48 +08:00
if (!cancelled) setLoading(false);
2026-06-26 17:28:06 +08:00
}
})();
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 (
2026-08-10 17:02:48 +08:00
<PageLayout title="机构基础信息详情" extra={<Button onClick={goBack}>返回</Button>}>
<p style={{ margin: 0, marginBottom: 24, color: "rgba(0, 0, 0, 0.45)" }}>缺少机构 ID 参数</p>
2026-06-29 16:45:58 +08:00
</PageLayout>
2026-06-26 17:28:06 +08:00
);
}
2026-08-10 17:02:48 +08:00
// 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) => <Tag color={record.statusColor || "default"}>{record.statusName || "-"}</Tag> },
{
title: "操作",
width: 110,
render: (_, record) => (
<PreviewUrlButton url={record.url} size="small">
查看提交件
</PreviewUrlButton>
),
},
]
: [
{ 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 = [
2026-08-10 14:16:49 +08:00
{
key: "changes",
2026-08-10 17:02:48 +08:00
label: "7. 变更记录",
2026-06-26 17:28:06 +08:00
children: (
2026-08-10 14:16:49 +08:00
<Table
size="small"
bordered
rowKey="id"
pagination={false}
2026-08-10 17:02:48 +08:00
dataSource={Array.isArray(changes) ? changes : []}
columns={changeColumns}
2026-06-26 17:28:06 +08:00
/>
),
},
];
return (
2026-08-10 14:16:49 +08:00
<PageLayout
title={
<span>
机构基础信息详情{mockEnabled ? <Tag color="warning" style={{ marginLeft: 8 }}>Mock 演示中</Tag> : null}
</span>
}
history={props.history}
previous
>
2026-08-10 17:02:48 +08:00
<Spin spinning={loading}>
{/* 七项 Tab前六项复用资质备案初审详情组件qual-filing/detail 数据),第 7 项为变更记录 */}
<FilingTabs detail={detail || {}} extraTabs={extraTabs} />
</Spin>
2026-06-29 16:45:58 +08:00
</PageLayout>
2026-06-26 17:28:06 +08:00
);
}
export default RegisteredOrgDetailPage;