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

256 lines
7.9 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 } from "antd";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import SearchForm from "@cqsjjb/jjb-react-admin-component/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 { VERIFY_STATUS_MAP } from "~/enumerate/constant";
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
import {
FILING_CODE_TO_CONFIRM,
REVIEW_BUSINESS_SCOPE_OPTIONS,
REVIEW_STATUS_CLASS,
REVIEW_UNIT_TYPE_OPTIONS,
toQualReviewPageQuery,
} from "../reviewPageQuery";
import {
getQualReviewMockEnabled,
mockQueryExpertList,
} from "../mockData";
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 || {};
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间2026-08-10
const mockEnabled = getQualReviewMockEnabled();
const loadList = (useMock = mockEnabled) => {
if (useMock) {
const res = mockQueryExpertList(router.query);
props.resetModelState(NS_QUAL_REVIEW, {
qualReviewList: res.data,
qualReviewTotal: res.total,
qualReviewLoading: false,
});
return;
}
queryReviewList({
...toQualReviewPageQuery(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();
}, []);
const renderConfirmStatus = (record) => {
const name = record.filingStatusName || record.statusName;
if (name) {
const color = /待确认|待核验/.test(name)
? "warning"
: /确认通过|已审核|通过/.test(name)
? "success"
: /打回|退回/.test(name)
? "error"
: "default";
return <Tag className={REVIEW_STATUS_CLASS[color] || "tag_default"}>{name}</Tag>;
}
const status = FILING_CODE_TO_CONFIRM[Number(record.filingStatusCode)];
const config = VERIFY_STATUS_MAP[status];
return config ? (
<Tag className={REVIEW_STATUS_CLASS[config.color] || "tag_default"}>
{config.label}
</Tag>
) : (
"--"
);
};
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 || "-";
},
},
{
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>
{/* mock 演示模式展示全部“核验”按钮便于与原型对比;真实模式仅待确认可操作 */}
{(mockEnabled || 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}
defaultExpand
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="confirmStatus" name="confirmStatus">
<ControlWrapper.Select
label="确认状态"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
>
<Select.Option value="pending">待确认</Select.Option>
<Select.Option value="passed">确认通过</Select.Option>
<Select.Option value="rejected">打回</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: 1000, 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));