dev_1.0.1
tangjie 2026-07-08 10:34:13 +08:00
parent bea20fd297
commit 6f1a2134d3
1 changed files with 62 additions and 33 deletions

View File

@ -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 { useEffect, useState } from "react";
import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import Search from "zy-react-library/components/Search"; import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
import TableList from "zy-react-library/components/Table"; import Table from "@cqsjjb/jjb-react-admin-component/Table";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import useTable from "zy-react-library/hooks/useTable";
import { getEvaluatorDetail, queryEvaluatorPage } from "~/mock/regulator/basicInfo"; import { getEvaluatorDetail, queryEvaluatorPage } from "~/mock/regulator/basicInfo";
const YES_NO_OPTIONS = [ const YES_NO_OPTIONS = [
@ -29,11 +29,31 @@ function EvaluatorInfoPage() {
const [detail, setDetail] = useState(null); const [detail, setDetail] = useState(null);
const [detailLoading, setDetailLoading] = useState(false); const [detailLoading, setDetailLoading] = useState(false);
const [certPreview, setCertPreview] = useState(null); 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(() => { useEffect(() => {
getData(); fetchData();
}, []); }, []);
const openDetail = async (id) => { const openDetail = async (id) => {
@ -61,34 +81,43 @@ function EvaluatorInfoPage() {
</div> </div>
} }
> >
<Search <SearchForm
form={searchForm} form={searchForm}
options={[ loading={loading}
{ name: "evaluatorName", label: "评价师名称", placeholder: "关键字搜索" }, formLine={[
{ name: "orgName", label: "机构名称", placeholder: "关键字搜索" }, <Form.Item key="evaluatorName" name="evaluatorName">
{ <ControlWrapper.Input label="评价师名称" allowClear placeholder="关键字搜索" />
name: "employmentStatus", </Form.Item>,
label: "是否在职", <Form.Item key="orgName" name="orgName">
render: FORM_ITEM_RENDER_ENUM.SELECT, <ControlWrapper.Input label="机构名称" allowClear placeholder="关键字搜索" />
options: YES_NO_OPTIONS, </Form.Item>,
}, <Form.Item key="employmentStatus" name="employmentStatus">
{ <ControlWrapper.Select label="是否在职" allowClear placeholder="请选择" options={YES_NO_OPTIONS} />
name: "registerEngineerFlag", </Form.Item>,
label: "是否注册安全工程师", <Form.Item key="registerEngineerFlag" name="registerEngineerFlag">
render: FORM_ITEM_RENDER_ENUM.SELECT, <ControlWrapper.Select label="是否注册安全工程师" allowClear placeholder="请选择" options={YES_NO_OPTIONS} />
options: YES_NO_OPTIONS, </Form.Item>,
}, <Form.Item key="status" name="status">
{ <ControlWrapper.Select label="状态" allowClear placeholder="请选择" options={STATUS_OPTIONS} />
name: "status", </Form.Item>,
label: "状态",
render: FORM_ITEM_RENDER_ENUM.SELECT,
options: STATUS_OPTIONS,
},
]} ]}
onFinish={getData} onFinish={() => fetchData(1, 10)}
/> />
<TableList <Table
{...tableProps} 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={[ columns={[
{ title: "机构名称", dataIndex: "orgName", ellipsis: true }, { title: "机构名称", dataIndex: "orgName", ellipsis: true },
{ title: "评价师名称", dataIndex: "evaluatorName", width: 120 }, { title: "评价师名称", dataIndex: "evaluatorName", width: 120 },
@ -148,7 +177,7 @@ function EvaluatorInfoPage() {
<Descriptions.Item label="账号">{detail.account}</Descriptions.Item> <Descriptions.Item label="账号">{detail.account}</Descriptions.Item>
</Descriptions> </Descriptions>
<div style={{ marginBottom: 8, fontWeight: 600 }}>资质证照</div> <div style={{ marginBottom: 8, fontWeight: 600 }}>资质证照</div>
<Table <AntTable
size="small" size="small"
bordered bordered
rowKey="id" rowKey="id"