import React, { useState, useEffect, useMemo } from "react";
import { Button, Descriptions, Table, Tag, Tabs, Select, Modal, Space, Image } from "antd";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import StaffViewModal from "~/components/StaffViewModal";
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
/**
* 共享组件:资质备案 5 个标签页(详情 / 审核共用)
* @param {Object} props
* @param {Object} props.detail - 备案详情数据
* @param {boolean} [props.isReview=false] - 审核模式(开启后材料上传显示"上传附件"+"符合性"列)
* @param {Object} [props.compliance={}] - 审核模式下的符合性状态
* @param {Function} [props.onComplianceChange] - 符合性变动回调
* @param {Function} [props.onPersonnelView] - 查看人员详情回调(覆盖默认弹窗)
* @param {Function} [props.onEquipView] - 查看设备详情回调 (record) => void(覆盖默认弹窗)
*/
const FilingTabs = ({
detail,
isReview = false,
compliance = {},
onComplianceChange,
}) => {
const [viewId, setViewId] = useState("");
const attachmentList = useMemo(() => {
const v = detail.attachmentUrl;
if (!v) return [];
try {
const p = JSON.parse(v);
return Array.isArray(p) ? p : [];
} catch {
return [];
}
}, [detail.attachmentUrl]);
const baseCols = [
{ title: "序号", width: 60, render: (_, __, i) => i + 1 },
{ title: "材料名称", dataIndex: "materialContent" },
];
const materialCols = isReview
? [
...baseCols,
{ title: "上传附件", dataIndex: "attachmentDesc", width: 120 },
{ title: "格式", dataIndex: "materialFormat", width: 80 },
{ title: "状态", width: 100, render: (_, record) => record.uploadStatusCode === 2 ? {record.uploadStatusName || "已上传"} : {record.uploadStatusName || "待上传"} },
{ title: "符合性", width: 100,
render: (_, record) => (
),
},
]
: [
...baseCols,
{ title: "格式", dataIndex: "materialFormat", width: 80 },
{ title: "状态", width: 100, render: (_, record) => record.uploadStatusCode === 2 ? {record.uploadStatusName || "已上传"} : {record.uploadStatusName || "待上传"} },
{ title: "操作", width: 80, render: (_, record) => 预览 },
];
const commitment= detail.commitment || {};
const items = [
{
key: "info",
label: "1.备案基本信息",
children: (
{Array.isArray(detail.businessScope) ? detail.businessScope.map(item => QUALIFICATION_INDUSTRY_OPTIONS_MAP[item]).join("、") : detail.businessScope || "-"}
{detail.filingTerritoryName}
{detail.filingUnitName}
{detail.filingUnitTypeName}
{detail.creditCode}
{detail.officeAddress}
{detail.registerAddress}
{detail.qualCertNo}
{detail.infoDisclosureUrl}
{detail.legalPersonPhone}
{detail.contactPhone}
{detail.fixedAssetAmount}
{detail.workplaceArea}㎡
{detail.archiveRoomArea}㎡
{detail.fulltimeEvaluatorCount}人
{detail.registeredEngineerCount}人
{detail.unitIntro}
{attachmentList.length
? attachmentList.map((item, i) => {
const isImg = /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(item.url || "");
return isImg ? (
) : (
{item.name || `附件${i + 1}`}
);
})
: "-"}
),
},
{
key: "materials",
label: "2.备案材料上传",
children: (
),
},
{
key: "promise",
label: "3.法定代表人承诺书",
children: (
申请单位法定代表人承诺书
本人{commitment.legalRepName}是{detail.filingUnitName}法定代表人,现代表我单位承诺如下:
一、我单位自愿申请安全评价机构资质。本人已经认真学习、了解并掌握《安全生产法》《行政许可法》《行政处罚法》及《安全评价检测检验机构管理办法》等法律法规的相关规定,知悉开展安全评价工作的法律责任、义务、权力和风险。
二、本人承诺本单位满足《安全评价检测检验机构管理办法》所规定的资质条件要求,本人及单位三年内无重大违法失信行为,申请资质所提交的有关材料真实、合法、有效,并对其真实性、合法性承担相应法律责任,接受并配合有关部门对本单位开展的专业能力审查。
三、如能获准资质,本单位将严格按照法律法规、规章标准的要求开展安全评价活动,遵守执业准则和职业道德,并对作出的安全评价报告结果承担法律责任,自觉接受应急管理部门、煤矿安全监督管理部门等行政执法部门的监督检查。
法定代表人:{commitment.legalRepName}(已签名)
{commitment.legalRepSignatureUrl&&}
(单位盖章)
{commitment.signDate}
),
},
{
key: "personnel",
label: "4.备案人员管理",
children: (
i + 1 },
{ title: "人员姓名", dataIndex: "personName", width: 100 },
{ title: "类型", dataIndex: "personTypeName", width: 100 },
{ title: "职称", dataIndex: "titleName", width: 100 },
{ title: "操作", width: 80,
render: (_, record) => (
),
},
]}
/>
),
},
{
key: "equipment",
label: "5.装备清单",
children: (
i + 1 },
{ title: "装备名称", dataIndex: "deviceName", width: 140 },
{ title: "规格型号", dataIndex: "deviceModel", width: 120 },
{ title: "生产厂家", dataIndex: "manufacturer", width: 140 },
{ title: "计量检定情况", width: 120,
render: (_, record) => {
if (record.calibrationReportUrl) {
return 已上传;
}
return 待上传;
},
},
{ title: "操作", width: 80,
render: (_, record) => (
查看
),
},
]}
/>
),
},
];
return (
<>
{/* 人员详细信息弹窗 */}
setViewId("")}
/>
>
);
};
export default Connect(
[NS_QUAL_REVIEW],
true,
)(FilingTabs);