feat
parent
ca9919149e
commit
1052abb276
|
|
@ -832,6 +832,11 @@ function StaffFormModal({
|
||||||
<Select
|
<Select
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
options={REGISTER_ENGINEER_OPTIONS}
|
options={REGISTER_ENGINEER_OPTIONS}
|
||||||
|
onChange={()=>{
|
||||||
|
form.setFieldsValue({
|
||||||
|
registeredSafetyEngineerCert: null,
|
||||||
|
})
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
@ -910,7 +915,11 @@ function StaffFormModal({
|
||||||
label="是否评价师"
|
label="是否评价师"
|
||||||
initialValue={2}
|
initialValue={2}
|
||||||
>
|
>
|
||||||
<Select placeholder="请选择" options={EVALUATOR_OPTIONS} />
|
<Select placeholder="请选择" options={EVALUATOR_OPTIONS} onChange={()=>{
|
||||||
|
form.setFieldsValue({
|
||||||
|
evaluatorCert: null,
|
||||||
|
})
|
||||||
|
}} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
{watchedEvaluatorFlag === 1 && (
|
{watchedEvaluatorFlag === 1 && (
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { CAPABILITY_MAP, CERT_TYPE_MAP } from "~/enumerate/constant";
|
||||||
import StaffViewModal from "~/components/StaffViewModal";
|
import StaffViewModal from "~/components/StaffViewModal";
|
||||||
|
|
||||||
export default function OrgPersonnelSelectModal(props) {
|
export default function OrgPersonnelSelectModal(props) {
|
||||||
const { open, onCancel, onConfirm, existingIds = [] } = props;
|
const { open, onCancel, onConfirm, existingIds = [], managementFlag } = props;
|
||||||
const [searchForm] = Form.useForm();
|
const [searchForm] = Form.useForm();
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||||
const [selectedRows, setSelectedRows] = useState([]);
|
const [selectedRows, setSelectedRows] = useState([]);
|
||||||
|
|
@ -26,6 +26,7 @@ export default function OrgPersonnelSelectModal(props) {
|
||||||
current: page,
|
current: page,
|
||||||
size: pageSize,
|
size: pageSize,
|
||||||
personName: values.personName || undefined,
|
personName: values.personName || undefined,
|
||||||
|
managementFlag: managementFlag || undefined,
|
||||||
});
|
});
|
||||||
if (res?.success !== false) {
|
if (res?.success !== false) {
|
||||||
setDataSource(res?.data || []);
|
setDataSource(res?.data || []);
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,69 @@
|
||||||
import { Button, Modal, Space, Table } from "antd";
|
import { Button, Modal, Space, Table } from "antd";
|
||||||
import { useMemo, useState } from "react";
|
import { useState } from "react";
|
||||||
import { CAPABILITY_MAP, GENDER_MAP } from "~/enumerate/constant";
|
import { CAPABILITY_MAP, CERT_LEVEL_LABEL_BY_TYPE } from "~/enumerate/constant";
|
||||||
|
import {
|
||||||
|
PERSONNEL_POST_TYPE_MAP,
|
||||||
|
TITLE_LEVEL_MAP,
|
||||||
|
} from "~/enumerate/enterpriseOptions";
|
||||||
import StaffViewModal from "~/components/StaffViewModal";
|
import StaffViewModal from "~/components/StaffViewModal";
|
||||||
import OrgPersonnelSelectModal from "./OrgPersonnelSelectModal";
|
import OrgPersonnelSelectModal from "./OrgPersonnelSelectModal";
|
||||||
|
|
||||||
function calcAge(birthDate) {
|
const PersonnelStep = ({ personnelList = [], disabled, onAdd, onRemove, managementFlag }) => {
|
||||||
if (!birthDate) return "-";
|
|
||||||
const birth = new Date(birthDate);
|
|
||||||
if (isNaN(birth.getTime())) return "-";
|
|
||||||
const now = new Date();
|
|
||||||
let age = now.getFullYear() - birth.getFullYear();
|
|
||||||
const m = now.getMonth() - birth.getMonth();
|
|
||||||
if (m < 0 || (m === 0 && now.getDate() < birth.getDate())) age--;
|
|
||||||
return age >= 0 ? age : "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
const PersonnelStep=({
|
|
||||||
personnelList = [],
|
|
||||||
disabled,
|
|
||||||
onAdd,
|
|
||||||
onRemove,
|
|
||||||
})=> {
|
|
||||||
const [selectOpen, setSelectOpen] = useState(false);
|
const [selectOpen, setSelectOpen] = useState(false);
|
||||||
const [viewId, setViewId] = useState("");
|
const [viewId, setViewId] = useState("");
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||||
|
|
||||||
const tableData = useMemo(
|
const existingIds = personnelList.map((item) =>
|
||||||
() => personnelList.map((item) => ({ ...item, age: item.age ?? calcAge(item.birthDate) })),
|
String(item.sourcePersonnelId || item.id || ""),
|
||||||
[personnelList],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const existingIds = personnelList.map((item) => String(item.sourcePersonnelId || item.id || ""));
|
|
||||||
|
|
||||||
const handleBatchRemove = () => {
|
const handleBatchRemove = () => {
|
||||||
const records = selectedRowKeys
|
const records = selectedRowKeys
|
||||||
.map((key) => personnelList.find(
|
.map((key) =>
|
||||||
(item) => String(item.sourcePersonnelId || item.id) === key,
|
personnelList.find(
|
||||||
))
|
(item) => String(item.sourcePersonnelId || item.id) === key,
|
||||||
|
),
|
||||||
|
)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
if (records.length > 0) {
|
if (records.length > 0) {
|
||||||
onRemove?.(records);
|
onRemove?.(records);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: 12 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
marginBottom: 12,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<span style={{ fontWeight: 600 }}>
|
<span style={{ fontWeight: 600 }}>
|
||||||
备案人员信息
|
备案人员信息
|
||||||
<span style={{ marginLeft: 8, color: "rgba(0,0,0,0.45)", fontWeight: 400 }}>
|
<span
|
||||||
|
style={{
|
||||||
|
marginLeft: 8,
|
||||||
|
color: "rgba(0,0,0,0.45)",
|
||||||
|
fontWeight: 400,
|
||||||
|
}}
|
||||||
|
>
|
||||||
当前 {personnelList.length} 人
|
当前 {personnelList.length} 人
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
{!disabled && (
|
{!disabled && (
|
||||||
<Space size="small">
|
<Space size="small">
|
||||||
<Button type="primary" size="small" onClick={() => setSelectOpen(true)}>添加人员信息</Button>
|
<Button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
onClick={() => setSelectOpen(true)}
|
||||||
|
>
|
||||||
|
添加人员信息
|
||||||
|
</Button>
|
||||||
{selectedRowKeys.length > 0 && (
|
{selectedRowKeys.length > 0 && (
|
||||||
<Button danger size="small" onClick={handleBatchRemove}>批量删除</Button>
|
<Button danger size="small" onClick={handleBatchRemove}>
|
||||||
|
批量删除
|
||||||
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
|
|
@ -67,27 +73,89 @@ const PersonnelStep=({
|
||||||
rowKey={(record) => String(record.sourcePersonnelId || record.id)}
|
rowKey={(record) => String(record.sourcePersonnelId || record.id)}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
scroll={{ x: 1200, y: 400 }}
|
scroll={{ x: 1200, y: 400 }}
|
||||||
dataSource={tableData}
|
dataSource={personnelList}
|
||||||
rowSelection={!disabled ? {
|
rowSelection={
|
||||||
selectedRowKeys,
|
!disabled
|
||||||
onChange: setSelectedRowKeys,
|
? {
|
||||||
} : undefined}
|
selectedRowKeys,
|
||||||
|
onChange: setSelectedRowKeys,
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
columns={[
|
columns={[
|
||||||
{ title: "序号", width: 60, render: (_, __, index) => index + 1 },
|
{ title: "序号", width: 60, render: (_, __, index) => index + 1 },
|
||||||
{ title: "人员姓名", dataIndex: "personName" },
|
{ title: "姓名", dataIndex: "personName" },
|
||||||
{ title: "部门", dataIndex: "deptName", ellipsis: true },
|
{
|
||||||
{ title: "岗位", dataIndex: "positionName", ellipsis: true },
|
title: "职务",
|
||||||
{ title: "性别", dataIndex: "genderCode", width: 70, render: (v) => GENDER_MAP[v] || "-" },
|
dataIndex: "personnelPositionType",
|
||||||
{ title: "年龄", dataIndex: "age", width: 70 },
|
width: 120,
|
||||||
{ title: "注册安全工程师", dataIndex: "registerEngineerFlag", width: 120, render: (v) => v === 1 ? "是" : "否" },
|
render: (v) => PERSONNEL_POST_TYPE_MAP[v] || "-",
|
||||||
{ title: "评价师", dataIndex: "evaluatorCertNo", width: 80, render: (v) => v ? "是" : "否" },
|
},
|
||||||
|
{
|
||||||
|
title: "职称",
|
||||||
|
dataIndex: "titleCodeArr",
|
||||||
|
width: 100,
|
||||||
|
render: (list) => {
|
||||||
|
if (!Array.isArray(list) || !list.length) return "-";
|
||||||
|
return list
|
||||||
|
.map(
|
||||||
|
(item) => TITLE_LEVEL_MAP[item.titleCode] || item.titleCode,
|
||||||
|
)
|
||||||
|
.join("、");
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "专业能力",
|
title: "专业能力",
|
||||||
|
dataIndex: "capabilityAssessment",
|
||||||
|
render: (list) => {
|
||||||
|
if (!Array.isArray(list) || !list.length) return "-";
|
||||||
|
return list
|
||||||
|
.map(
|
||||||
|
(item) =>
|
||||||
|
CAPABILITY_MAP[item.professionalCapabilityCode] ||
|
||||||
|
item.professionalCapabilityCode,
|
||||||
|
)
|
||||||
|
.join("、");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "职业资格等级及证书编号",
|
||||||
|
dataIndex: "personnelCertFilingPageCOList",
|
||||||
|
width: 200,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
const codes = record.professionalCapabilityCodeList || [];
|
const cert = (record.personnelCertFilingPageCOList || []).find(
|
||||||
return codes.length
|
(item) => item.certTypeCode === "evaluator",
|
||||||
? codes.map((code) => CAPABILITY_MAP[code] || code).join("、")
|
);
|
||||||
: "-";
|
if (!cert) return "否";
|
||||||
|
const levelMap = CERT_LEVEL_LABEL_BY_TYPE.evaluator || {};
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div>{levelMap[cert.certLevel] || cert.certLevel || "-"}</div>
|
||||||
|
<div style={{ color: "rgba(0,0,0,0.45)" }}>
|
||||||
|
{cert.certNo || "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "是否具有注册安全工程师资格",
|
||||||
|
width: 200,
|
||||||
|
render: (_, record) => {
|
||||||
|
const cert = (record.personnelCertFilingPageCOList || []).find(
|
||||||
|
(item) => item.certTypeCode === "registered_safety_engineer",
|
||||||
|
);
|
||||||
|
if (!cert) return "否";
|
||||||
|
const levelMap =
|
||||||
|
CERT_LEVEL_LABEL_BY_TYPE.registered_safety_engineer || {};
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div>{levelMap[cert.certLevel] || cert.certLevel || "-"}</div>
|
||||||
|
<div style={{ color: "rgba(0,0,0,0.45)" }}>
|
||||||
|
{cert.certNo || "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -99,12 +167,21 @@ const PersonnelStep=({
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => setViewId(record.sourcePersonnelId || record.id)}
|
onClick={() =>
|
||||||
|
setViewId(record.sourcePersonnelId || record.id)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
{!disabled && (
|
{!disabled && (
|
||||||
<Button type="link" size="small" danger onClick={() => onRemove?.(record)}>删除</Button>
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
danger
|
||||||
|
onClick={() => onRemove?.(record)}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
|
|
@ -114,6 +191,7 @@ const PersonnelStep=({
|
||||||
<OrgPersonnelSelectModal
|
<OrgPersonnelSelectModal
|
||||||
open={selectOpen}
|
open={selectOpen}
|
||||||
existingIds={existingIds}
|
existingIds={existingIds}
|
||||||
|
managementFlag={managementFlag}
|
||||||
onCancel={() => setSelectOpen(false)}
|
onCancel={() => setSelectOpen(false)}
|
||||||
onConfirm={(ids, rows) => {
|
onConfirm={(ids, rows) => {
|
||||||
onAdd?.(ids, rows);
|
onAdd?.(ids, rows);
|
||||||
|
|
@ -123,11 +201,11 @@ const PersonnelStep=({
|
||||||
<StaffViewModal
|
<StaffViewModal
|
||||||
open={!!viewId}
|
open={!!viewId}
|
||||||
currentId={viewId}
|
currentId={viewId}
|
||||||
|
|
||||||
onCancel={() => setViewId("")}
|
onCancel={() => setViewId("")}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default PersonnelStep;
|
export default PersonnelStep;
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ function FilingFormPage(props) {
|
||||||
}
|
}
|
||||||
if (!currentDetail?.personnelList?.length) {
|
if (!currentDetail?.personnelList?.length) {
|
||||||
message.warning("请至少添加一位备案人员");
|
message.warning("请至少添加一位备案人员");
|
||||||
setActiveStep("personnel");
|
setActiveStep("managementPersonnel");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!currentDetail?.equipmentList?.length) {
|
if (!currentDetail?.equipmentList?.length) {
|
||||||
|
|
@ -352,11 +352,24 @@ function FilingFormPage(props) {
|
||||||
forceRender: true,
|
forceRender: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "personnel",
|
key: "managementPersonnel",
|
||||||
label: "2. 专职人员备案",
|
label: "2. 管理人员基本情况汇总表",
|
||||||
children: (
|
children: (
|
||||||
<PersonnelStep
|
<PersonnelStep
|
||||||
personnelList={detail?.personnelList || []}
|
personnelList={(detail?.personnelList || []).filter((item) => !!item.personnelPositionType)}
|
||||||
|
disabled={readOnly}
|
||||||
|
onAdd={handlePersonnelAdd}
|
||||||
|
onRemove={handlePersonnelRemove}
|
||||||
|
managementFlag={true}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "personnel",
|
||||||
|
label: "3. 专职安全评价师基本情况汇总表",
|
||||||
|
children: (
|
||||||
|
<PersonnelStep
|
||||||
|
personnelList={(detail?.personnelList || []).filter((item) => !item.personnelPositionType)}
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
onAdd={handlePersonnelAdd}
|
onAdd={handlePersonnelAdd}
|
||||||
onRemove={handlePersonnelRemove}
|
onRemove={handlePersonnelRemove}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue