diff --git a/src/api/safetyEvalBusiness/index.js b/src/api/safetyEvalBusiness/index.js index 4bd8446..879bfd8 100644 --- a/src/api/safetyEvalBusiness/index.js +++ b/src/api/safetyEvalBusiness/index.js @@ -181,7 +181,7 @@ export const evalProjectMemberPage = declareRequest( export const evalProjectEstablishedAttachSave = declareRequest( "projectEstablishedAttachSaveLoading", - "Post > /safetyEval/institution/eval-project-member/saveProjectEstablishedAttach", + "Post > @/safetyEval/institution/eval-project-member/saveProjectEstablishedAttach", ); export const evalProjectEstablishedAttachGet = declareRequest( diff --git a/src/api/staffInfo/index.js b/src/api/staffInfo/index.js index 06c0df3..492219e 100644 --- a/src/api/staffInfo/index.js +++ b/src/api/staffInfo/index.js @@ -8,6 +8,12 @@ export const staffInfoList = declareRequest( "staffInfoList: [] | res.data || [] & staffInfoTotal: 0 | res.total || 0", ); +export const staffInfoRegulationPage = declareRequest( + "staffInfoLoading", + "Get > /safetyEval/org-personnel/regulationPage", + "staffInfoList: [] | res.data || [] & staffInfoTotal: 0 | res.total || 0", +); + export const staffInfoDeptPersonCount = declareRequest( "staffInfoLoading", "Get > /safetyEval/org-personnel/deptPersonCount", @@ -46,4 +52,4 @@ export const queryBasicDisciplineMajor = declareRequest( "staffInfoLoading", "Get > /safetyEval/basic-discipline-major", "basicDisciplineMajorList: [] | res.data || []", -); \ No newline at end of file +); diff --git a/src/pages/Container/Supervision/BasicInfo/EvaluatorInfo/index.js b/src/pages/Container/Supervision/BasicInfo/EvaluatorInfo/index.js index 3f2a988..909f0e8 100644 --- a/src/pages/Container/Supervision/BasicInfo/EvaluatorInfo/index.js +++ b/src/pages/Container/Supervision/BasicInfo/EvaluatorInfo/index.js @@ -1,82 +1,86 @@ -import { Button, Descriptions, Form, Modal, Tag, Tooltip, Table } from "antd"; +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, Space, Table, Tag } from "antd"; import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/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 SearchForm from "~/components/SearchForm"; +import StaffResumeModal from "~/components/StaffResumeModal"; +import { NS_ORG_INFO, NS_STAFF_INFO } from "~/enumerate/namespace"; +import { + REGISTER_ENGINEER_OPTIONS, + TITLE_LEVEL_MAP, +} from "~/enumerate/enterpriseOptions"; +import { CERT_LEVEL_LABEL_BY_TYPE } from "~/enumerate/constant"; -import { getEvaluatorDetail, queryEvaluatorPage } from "~/mock/regulator/basicInfo"; - -const YES_NO_OPTIONS = [ - { label: "是", value: 1 }, - { label: "否", value: 0 }, +const EMPLOYMENT_STATUS_OPTIONS = [ + { label: "在职", value: 1 }, + { label: "离职", value: 2 }, ]; -const STATUS_OPTIONS = [ - { label: "正常", value: "normal" }, - { label: "异常", value: "abnormal" }, -]; - -const CERT_STATUS_COLOR = { - normal: "success", - expiring: "warning", - expired: "error", -}; +const REGISTER_ENGINEER_MAP = { 1: "是", 2: "否" }; +const PERSONNEL_STATUS_MAP = { 1: "正常", 2: "异常" }; +const evalCertLevelMap = CERT_LEVEL_LABEL_BY_TYPE.evaluator; function EvaluatorInfoPage(props) { const [searchForm] = Form.useForm(); - const [viewOpen, setViewOpen] = useState(false); - const [detail, setDetail] = useState(null); - const [detailLoading, setDetailLoading] = useState(false); - const [certPreview, setCertPreview] = useState(null); + const [resumeOpen, setResumeOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const [orgOptions, setOrgOptions] = useState([]); 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 loading = props.staffInfo?.staffInfoLoading; + const fetchData = async (page = 1, size = 10) => { - setLoading(true); - try { - const formData = searchForm.getFieldsValue(); - const res = await queryEvaluatorPage({ ...formData, pageIndex: page, pageSize: size }); + const formData = searchForm.getFieldsValue(); + const res = await props.staffInfoRegulationPage({ + ...formData, + current: page, + size, + }); + if (res?.success !== false) { setDataSource(res?.data || []); - setTotal(res?.totalCount || 0); + setTotal(res?.total || 0); + setPageIndex(page); + setPageSize(size); } - catch { - setDataSource([]); - setTotal(0); - } - finally { - setLoading(false); + }; + + const loadOrgOptions = async () => { + try { + const res = await props.registeredOrgList({ current: 1, size: 200 }); + const list = res?.data || []; + setOrgOptions( + list.map((item) => ({ + label: + item.unitName || + item.orgName || + item.name || + item.enterpriseName || + String(item.id), + value: String(item.id), + })), + ); + } catch { + setOrgOptions([]); } }; useEffect(() => { fetchData(); + loadOrgOptions(); }, []); - const openDetail = async (id) => { - setViewOpen(true); - setDetailLoading(true); - const res = await getEvaluatorDetail(id); - setDetail(res?.data || null); - setDetailLoading(false); - }; - - const closeDetail = () => { - setViewOpen(false); - setDetail(null); - setCertPreview(null); - }; - return ( 评价师信息管理
- 监管端查看辖区内评价师备案及资质状态(当前为 Mock 数据)。 + 监管端查看辖区内评价师备案及资质状态。
} @@ -85,28 +89,44 @@ function EvaluatorInfoPage(props) { form={searchForm} loading={loading} formLine={[ - + , - - + + , - - + + , - - , - - + , ]} - onFinish={() => fetchData(1, 10)} + onFinish={() => fetchData(1, pageSize)} + onReset={() => fetchData(1, pageSize)} style={{ - marginBottom: '16px' + marginBottom: "16px", }} /> `共 ${t} 条`, }} onChange={(pag) => { - setPageIndex(pag.current); - setPageSize(pag.pageSize); fetchData(pag.current, pag.pageSize); }} scroll={{ y: props.scrollY }} columns={[ { title: "机构名称", dataIndex: "orgName", ellipsis: true }, - { title: "评价师名称", dataIndex: "evaluatorName", width: 120 }, + { title: "评价师名称", dataIndex: "userName", width: 120 }, { title: "是否注册安全工程师", - dataIndex: "registerEngineerLabel", + dataIndex: "registerEngineerFlag", width: 160, + render: (val) => REGISTER_ENGINEER_MAP[val] || "-", + }, + { + title: "证照名称", + dataIndex: "personnelCertFilingPageCOList", + width: 280, + render: (_, record) => { + const arr = []; + if (record.registeredSafetyEngineerCert) { + arr.push( + + {TITLE_LEVEL_MAP[record.registeredSafetyEngineerCert.certLevel]} + 注册安全工程师 + , + ); + } + if (record.evaluatorCert) { + arr.push( + + {evalCertLevelMap[record.evaluatorCert.certLevel]} + 注册安全评价师 + , + ); + } + return arr.length ? {arr} : "-"; + }, }, - { title: "资格证书", dataIndex: "certificatesSummary", ellipsis: true }, { title: "状态", + dataIndex: "personnelStatus", width: 90, - render: (_, record) => { - const tag = ( - - {record.statusLabel} - - ); - return record.statusTip ? {tag} : tag; - }, + render: (val) => ( + + {PERSONNEL_STATUS_MAP[val] || "正常"} + + ), }, { title: "操作", width: 80, render: (_, record) => ( - + ), }, ]} /> - - {detail && ( - <> - - {detail.name} - {detail.gender} - {detail.birthDate} - {detail.idCard} - {detail.education} - {detail.graduateSchool} - {detail.major} - - - {detail.orgName} - {detail.deptName} - {detail.positionName} - {detail.account} - -
资质证照
-
{ - const tag = ( - - {record.statusLabel} - - ); - return record.statusTip ? {tag} : tag; - }, - }, - { - title: "操作", - width: 90, - render: (_, record) => ( - - ), - }, - ]} - /> - - )} - - - setCertPreview(null)} - > - {certPreview && ( - - {certPreview.certName} - {certPreview.certNo} - {certPreview.issueDate} - {certPreview.expireDate} - {certPreview.statusLabel} - - )} - + {resumeOpen && ( + { + setResumeOpen(false); + setCurrentId(""); + }} + /> + )} ); } -export default AntdTableFuncControl(EvaluatorInfoPage); +export default Connect( + [NS_STAFF_INFO, NS_ORG_INFO], + true, +)(AntdTableFuncControl(EvaluatorInfoPage));