safety-eval-service-frontend/src/pages/Container/QualificationReview/ExpertVerification/index.js

262 lines
8.2 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 React, { useEffect, useState } from "react";
import { Button, Form, Select, Table, Tag, Tooltip } from "antd";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import SearchForm from "~/components/SearchForm";
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
import { tools } from "@cqsjjb/jjb-common-lib";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
import {
REVIEW_BUSINESS_SCOPE_OPTIONS,
REVIEW_RESULT_OPTIONS,
REVIEW_STATUS_CLASS,
REVIEW_UNIT_TYPE_OPTIONS,
} from "../reviewPageQuery";
import "../QualReview/index.less";
const { router } = tools;
/**
* 专家资料核验(原型 mod-qual-expert
* - 搜索:机构名称 / 机构类型 / 业务范围 / 确认状态
* - 操作:查看(复用 FilingDetail、核验进入审核表单页 QualReviewForm?mode=expert
* 与原型 openExpertReviewForm() 打开 mod-qual-review-form 一致,页面内「审核操作」打开专家核验弹窗)
*/
const ExpertVerification = (props) => {
const [form] = Form.useForm();
const { qualReview, queryReviewList } = props;
const { qualReviewList, qualReviewTotal, qualReviewLoading } = qualReview || {};
const loadList = () => {
queryReviewList({
...router.query,
supervision: true,
applyTypeCode: 1,
});
};
const handleSearch = () => {
loadList();
};
const handleReset = (values) => {
router.query = {
...router.query,
...values,
current: 1,
size: 10,
};
handleSearch();
};
useEffect(() => {
form.setFieldsValue(router.query);
loadList();
}, []);
// 2026-08-14 修复:确认状态列与搜索列对齐(基于 filingStatusCode2待确认/1确认通过/3打回
const renderConfirmStatus = (record) => {
const status = Number(record.filingStatusCode);
const CONF = {
1: { label: "确认通过", color: "success" },
2: { label: "待确认", color: "warning" },
3: { label: "打回", color: "error" },
};
const config = CONF[status];
return config ? (
<Tag className={REVIEW_STATUS_CLASS[config.color] || "tag_default"}>
{config.label}
</Tag>
) : (
"--"
);
};
// 2026-08-14 调整:专家核验列——优先展示 expert_result(结果),鼠标悬浮 Tooltip 展示 expert_opinion(意见)
// 若结果为空但有意见,则展示意见内容。
const renderExpertCheck = (record) => {
const item = REVIEW_RESULT_OPTIONS.find((r) => r.value === Number(record.expertResult));
const opinion = record.expertOpinion;
// 结果与意见均无 → 显示 "-"
if (!item && !opinion) return "-";
const content = item ? (
<Tag className={REVIEW_STATUS_CLASS[item.value === 1 ? "success" : item.value === 3 ? "error" : "warning"] || "tag_default"}>
{item.label}
</Tag>
) : (
<span className="text-muted">待核验</span>
);
// 有意见时用 Tooltip 悬浮展示完整意见
return opinion ? (
<Tooltip title={opinion} overlayStyle={{ maxWidth: 320 }}>
<span style={{ cursor: "help" }}>{content}</span>
</Tooltip>
) : content;
};
const columns = [
{
title: "序号",
width: 60,
fixed: "left",
render: (_, __, index) => index + 1,
},
{ title: "机构名称", dataIndex: "filingUnitName", width: 220, ellipsis: true },
{ title: "机构类型", dataIndex: "filingUnitTypeName", width: 100 },
{ title: "证书编号", dataIndex: "qualCertNo", width: 140, ellipsis: true },
{
title: "安全评价业务范围",
dataIndex: "businessScope",
width: 180,
ellipsis: true,
render: (_, record) => {
if (Array.isArray(record.businessScope)) {
return record.businessScope
.map((item) => QUALIFICATION_INDUSTRY_OPTIONS_MAP[item] || item)
.join("、");
}
return record.businessScope || "-";
},
},
// 2026-08-14 调整:专家核验(优先展示 expertResult悬浮 Tooltip 展示 expertOpinion
{
title: "专家核验",
dataIndex: "expertResult",
width: 120,
render: (_, record) => renderExpertCheck(record),
},
{
title: "确认状态",
dataIndex: "filingStatusCode",
width: 100,
render: (_, record) => renderConfirmStatus(record),
},
{
title: "操作",
width: 140,
fixed: "right",
render: (_, record) => (
<TableAction>
<Button
type="link"
size="small"
onClick={() => props.history.push(`FilingDetail?id=${record.id}`)}
>
查看
</Button>
{/* 仅待确认状态可操作 */}
{Number(record.filingStatusCode) === 2 && (
<Button
type="link"
size="small"
onClick={() =>
props.history.push(`QualReviewForm?id=${record.id}&mode=expert`)
}
>
核验
</Button>
)}
</TableAction>
),
},
];
return (
<PageLayout title="专家资料核验">
<SearchForm
style={{ marginBottom: 24 }}
form={form}
loading={qualReviewLoading}
formLine={[
<Form.Item key="filingUnitName" name="filingUnitName">
<ControlWrapper.Input label="机构名称" placeholder="请输入机构名称" allowClear />
</Form.Item>,
<Form.Item key="filingUnitTypeName" name="filingUnitTypeName">
<ControlWrapper.Select
label="机构类型"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
options={REVIEW_UNIT_TYPE_OPTIONS}
/>
</Form.Item>,
<Form.Item key="businessScope" name="businessScope">
<ControlWrapper.Select
label="安全评价业务范围"
placeholder="请选择"
allowClear
showSearch
optionFilterProp="label"
style={{ width: "100%" }}
options={REVIEW_BUSINESS_SCOPE_OPTIONS}
/>
</Form.Item>,
<Form.Item key="filingStatusCode" name="filingStatusCode">
<ControlWrapper.Select
label="确认状态"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
>
<Select.Option value={2}>待确认</Select.Option>
<Select.Option value={1}>确认通过</Select.Option>
<Select.Option value={3}>打回</Select.Option>
</ControlWrapper.Select>
</Form.Item>,
]}
onReset={handleReset}
onFinish={(values) => {
router.query = {
...router.query,
...values,
current: 1,
size: 10,
};
handleSearch();
}}
/>
<div className="toolbar">
<div className="toolbarLeft">
<span className="totalText">
<strong>{qualReviewTotal || 0}</strong>
</span>
</div>
</div>
<Table
rowKey="id"
columns={columns}
dataSource={Array.isArray(qualReviewList) ? qualReviewList : []}
rowSelection={{}}
scroll={{ x: 1400, y: props.scrollY }}
loading={qualReviewLoading}
pagination={{
total: qualReviewTotal,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (total) => `${total}`,
current: router.query.current || 1,
pageSize: router.query.size || 10,
onChange: (page, pageSize) => {
router.query = {
...router.query,
current: page,
size: pageSize,
};
handleSearch();
},
}}
/>
</PageLayout>
);
};
export default Connect(
[NS_QUAL_REVIEW],
true,
)(AntdTableFuncControl(ExpertVerification));