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

123 lines
4.3 KiB
JavaScript
Raw Normal View History

2026-08-11 10:40:54 +08:00
import { Button, Spin, Table } from "antd";
2026-08-10 17:02:48 +08:00
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 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
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-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;
}
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-11 10:40:54 +08:00
const changeColumns = [
{ title: "变更时间", dataIndex: "changeTime", width: 160 },
{ title: "变更项", dataIndex: "changeItemName", ellipsis: true },
{ title: "操作人", dataIndex: "operatorName", width: 110 },
];
2026-08-10 17:02:48 +08:00
/** 第 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
2026-08-11 10:40:54 +08:00
title="机构基础信息详情"
2026-08-10 14:16:49 +08:00
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;