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

195 lines
6.1 KiB
JavaScript

import React, { useState, useEffect } from "react";
import { Button, Form, Select, Table, Tag } from "antd";
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
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 { REVIEW_STATUS_MAP, EXPERT_STATUS_MAP } from "~/enumerate/constant";
const { router } = tools;
const QualReview = (props) => {
const [form] = Form.useForm();
const { qualReview, queryReviewList } = props;
const {qualReviewList, qualReviewTotal,qualReviewLoading}= qualReview || {};
const handleSearch = () => {
queryReviewList({
...router.query,
supervision: true,
});
};
const handleReset = (values) => {
router.query = {
...router.query,
...values,
current: 1,
size: 10,
};
handleSearch();
};
useEffect(() => {
form.setFieldsValue(router.query);
handleSearch();
}, []);
const columns = [
{
title: "序号",
dataIndex: "id",
width: 60,
fixed: "left",
render: (text, record, index) => index + 1,
},
{ title: "机构名称", dataIndex: "filingUnitName", width: 220, ellipsis: true },
{ title: "机构类型", dataIndex: "filingUnitTypeName", width: 100 },
{ title: "证书编号", dataIndex: "filingNo", width: 140, ellipsis: true },
{ title: "安全评价业务范围", dataIndex: "businessScope", width: 180, ellipsis: true },
{
title: "专家核验",
dataIndex: "expertStatus",
width: 100,
render: (status) => {
const config = EXPERT_STATUS_MAP['pending'];
return config ? <Tag color={config.color}>{config.label}</Tag> : '--';
},
},
{
title: "审核状态",
dataIndex: "filingStatusCode",
width: 100,
render: (_, {filingStatusCode}) => {
const config = REVIEW_STATUS_MAP[filingStatusCode];
return config ? <Tag color={config.color}>{config.label}</Tag> : '--';
},
},
{
title: "操作",
width: 140,
fixed: "right",
render: (_, record) => (
<TableAction>
<Button type="link" size="small" onClick={() => props.history.push(`FilingDetail?id=${record.id}`)}>
查看
</Button>
{record.filingStatusCode === 2 && (
<Button type="link" size="small" onClick={() => props.history.push(`QualReviewForm?id=${record.id}`)}>
审核
</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="orgType">
<ControlWrapper.Select
label="机构类型"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
>
<Select.Option value="本地机构">本地机构</Select.Option>
<Select.Option value="异地机构">异地机构</Select.Option>
</ControlWrapper.Select>
</Form.Item>,
<Form.Item key="businessScope" name="businessScope">
<ControlWrapper.Select
label="安全评价业务范围"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
>
<Select.Option value="石油加工">石油加工</Select.Option>
<Select.Option value="化工">化工</Select.Option>
<Select.Option value="矿山">矿山</Select.Option>
<Select.Option value="建筑施工">建筑施工</Select.Option>
</ControlWrapper.Select>
</Form.Item>,
<Form.Item key="needExpertCheck" name="needExpertCheck">
<ControlWrapper.Select
label="是否专家核验"
placeholder="请选择"
allowClear
style={{ width: "100%" }}
>
<Select.Option value="yes"></Select.Option>
<Select.Option value="no"></Select.Option>
</ControlWrapper.Select>
</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="3">打回</Select.Option>
</ControlWrapper.Select>
</Form.Item>,
]}
onReset={handleReset}
onFinish={(values) => {
router.query = {
...router.query,
...values,
current: 1,
size: 10,
};
handleSearch();
}}
/>
<Table
rowKey="id"
columns={columns}
dataSource={qualReviewList}
scroll={{ y: props.scrollY }}
loading={qualReviewLoading}
pagination={{
total: qualReviewTotal,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (total) => `${total}`,
current: router.query.current || 1,
size: router.query.size || 10,
onChange: (page, size) => {
router.query = {
...router.query,
current: page,
size,
};
handleSearch();
},
}}
/>
</PageLayout>
);
};
export default Connect([NS_QUAL_REVIEW], true)(AntdTableFuncControl(QualReview));