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

123 lines
4.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { Button, Spin, Table } 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 FilingTabs from "~/pages/Container/QualificationReview/FilingTabs";
const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list";
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/detail5 表聚合),
* 六项 Tab 直接复用 FilingTabs基础信息/管理人员/专职评价师/申请材料/设备清单/机构负责人签字)
* - 变更记录 TabGET /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));
useEffect(() => {
if (!id) {
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 (
<PageLayout title="机构基础信息详情" extra={<Button onClick={goBack}>返回</Button>}>
<p style={{ margin: 0, marginBottom: 24, color: "rgba(0, 0, 0, 0.45)" }}>缺少机构 ID 参数</p>
</PageLayout>
);
}
const changeColumns = [
{ 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: (
<Table
size="small"
bordered
rowKey="id"
pagination={false}
dataSource={Array.isArray(changes) ? changes : []}
columns={changeColumns}
/>
),
},
];
return (
<PageLayout
title="机构基础信息详情"
history={props.history}
previous
>
<Spin spinning={loading}>
{/* 七项 Tab前六项复用资质备案初审详情组件qual-filing/detail 数据),第 7 项为变更记录 */}
<FilingTabs detail={detail || {}} extraTabs={extraTabs} />
</Spin>
</PageLayout>
);
}
export default RegisteredOrgDetailPage;