feat
parent
bea20fd297
commit
6f1a2134d3
|
|
@ -1,10 +1,10 @@
|
|||
import { Button, Descriptions, Form, Modal, Table, Tag, Tooltip } from "antd";
|
||||
import { Button, Descriptions, Form, Modal, Tag, Tooltip } from "antd";
|
||||
import { Table as AntTable } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
|
||||
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import TableList from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
|
||||
import Table from "@cqsjjb/jjb-react-admin-component/Table";
|
||||
import { getEvaluatorDetail, queryEvaluatorPage } from "~/mock/regulator/basicInfo";
|
||||
|
||||
const YES_NO_OPTIONS = [
|
||||
|
|
@ -29,11 +29,31 @@ function EvaluatorInfoPage() {
|
|||
const [detail, setDetail] = useState(null);
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
const [certPreview, setCertPreview] = useState(null);
|
||||
const [dataSource, setDataSource] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
const { tableProps, getData } = useTable(queryEvaluatorPage, { form: searchForm });
|
||||
const fetchData = async (page = 1, size = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const formData = searchForm.getFieldsValue();
|
||||
const res = await queryEvaluatorPage({ ...formData, pageIndex: page, pageSize: size });
|
||||
setDataSource(res?.data || []);
|
||||
setTotal(res?.totalCount || 0);
|
||||
}
|
||||
catch {
|
||||
setDataSource([]);
|
||||
setTotal(0);
|
||||
}
|
||||
finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getData();
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
const openDetail = async (id) => {
|
||||
|
|
@ -61,34 +81,43 @@ function EvaluatorInfoPage() {
|
|||
</div>
|
||||
}
|
||||
>
|
||||
<Search
|
||||
<SearchForm
|
||||
form={searchForm}
|
||||
options={[
|
||||
{ name: "evaluatorName", label: "评价师名称", placeholder: "关键字搜索" },
|
||||
{ name: "orgName", label: "机构名称", placeholder: "关键字搜索" },
|
||||
{
|
||||
name: "employmentStatus",
|
||||
label: "是否在职",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
options: YES_NO_OPTIONS,
|
||||
},
|
||||
{
|
||||
name: "registerEngineerFlag",
|
||||
label: "是否注册安全工程师",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
options: YES_NO_OPTIONS,
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
label: "状态",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
options: STATUS_OPTIONS,
|
||||
},
|
||||
loading={loading}
|
||||
formLine={[
|
||||
<Form.Item key="evaluatorName" name="evaluatorName">
|
||||
<ControlWrapper.Input label="评价师名称" allowClear placeholder="关键字搜索" />
|
||||
</Form.Item>,
|
||||
<Form.Item key="orgName" name="orgName">
|
||||
<ControlWrapper.Input label="机构名称" allowClear placeholder="关键字搜索" />
|
||||
</Form.Item>,
|
||||
<Form.Item key="employmentStatus" name="employmentStatus">
|
||||
<ControlWrapper.Select label="是否在职" allowClear placeholder="请选择" options={YES_NO_OPTIONS} />
|
||||
</Form.Item>,
|
||||
<Form.Item key="registerEngineerFlag" name="registerEngineerFlag">
|
||||
<ControlWrapper.Select label="是否注册安全工程师" allowClear placeholder="请选择" options={YES_NO_OPTIONS} />
|
||||
</Form.Item>,
|
||||
<Form.Item key="status" name="status">
|
||||
<ControlWrapper.Select label="状态" allowClear placeholder="请选择" options={STATUS_OPTIONS} />
|
||||
</Form.Item>,
|
||||
]}
|
||||
onFinish={getData}
|
||||
onFinish={() => fetchData(1, 10)}
|
||||
/>
|
||||
<TableList
|
||||
{...tableProps}
|
||||
<Table
|
||||
dataSource={dataSource}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
current: pageIndex,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: true,
|
||||
showTotal: (t) => `共 ${t} 条`,
|
||||
}}
|
||||
onChange={(pag) => {
|
||||
setPageIndex(pag.current);
|
||||
setPageSize(pag.pageSize);
|
||||
fetchData(pag.current, pag.pageSize);
|
||||
}}
|
||||
columns={[
|
||||
{ title: "机构名称", dataIndex: "orgName", ellipsis: true },
|
||||
{ title: "评价师名称", dataIndex: "evaluatorName", width: 120 },
|
||||
|
|
@ -148,7 +177,7 @@ function EvaluatorInfoPage() {
|
|||
<Descriptions.Item label="账号">{detail.account}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<div style={{ marginBottom: 8, fontWeight: 600 }}>资质证照</div>
|
||||
<Table
|
||||
<AntTable
|
||||
size="small"
|
||||
bordered
|
||||
rowKey="id"
|
||||
|
|
|
|||
Loading…
Reference in New Issue