diff --git a/src/components/AttachmentUpload/index.js b/src/components/AttachmentUpload/index.js index 40fe12c..f632a35 100644 --- a/src/components/AttachmentUpload/index.js +++ b/src/components/AttachmentUpload/index.js @@ -14,7 +14,6 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou label={label} valuePropName="fileList" getValueProps={(value) => { - if (Array.isArray(value)) { return { fileList: value }; } @@ -30,7 +29,6 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou }; }} getValueFromEvent={({ fileList }) => { - return ( fileList?.map((file) => ({ url: file.response?.data?.url || file.url, diff --git a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js index 3862f65..6166564 100644 --- a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js +++ b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js @@ -1,6 +1,16 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; -import { Button, DatePicker, Form, Input, message, Modal, Row, Col, Select, Table, Upload } from "antd"; -import { UploadOutlined } from "@ant-design/icons"; +import { + Button, + DatePicker, + Form, + Input, + message, + Modal, + Row, + Col, + Select, + Table, +} from "antd"; import { useEffect, useRef, useState } from "react"; import dayjs from "dayjs"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; @@ -21,6 +31,7 @@ import { } from "~/enumerate/enterpriseOptions"; import { getBirthDateFromIdCard } from "~/utils"; import { idCardRule, mobileRule } from "~/utils/validators"; +import AttachmentUpload from "~/components/AttachmentUpload"; import StaffViewModal from "../StaffViewModal"; const { router } = tools; @@ -48,17 +59,26 @@ function PersonnelInfoPage(props) { Get("/safetyEval/org-position/page", { current: 1, size: 200 }), ]); if (cancelled) return; - setDeptOptions((deptRes?.data || []).map((d) => ({ label: d.deptName, value: d.id }))); - setPositionOptions((posRes?.data || []).map((p) => ({ - label: p.positionName, - value: p.id, - deptId: p.deptId, - }))); + setDeptOptions( + (deptRes?.data || []).map((d) => ({ + label: d.deptName, + value: d.id, + })), + ); + setPositionOptions( + (posRes?.data || []).map((p) => ({ + label: p.positionName, + value: p.id, + deptId: p.deptId, + })), + ); } catch (err) { console.warn("[PersonnelInfo] load dept/position options failed:", err); } })(); - return () => { cancelled = true; }; + return () => { + cancelled = true; + }; }, []); useEffect(() => { @@ -134,19 +154,37 @@ function PersonnelInfoPage(props) { loading={loading} formLine={[ - + , - + {deptOptions.map((d) => ( - {d.label} + + {d.label} + ))} , - + {positionOptions.map((p) => ( - {p.label} + + {p.label} + ))} , @@ -166,7 +204,7 @@ function PersonnelInfoPage(props) { { title: "用户名称", dataIndex: "userName" }, { title: "账号", dataIndex: "account" }, { title: "部门", dataIndex: "deptName" }, - { title: "岗位", dataIndex: "positionName" }, + { title: "岗位", dataIndex: "postName" }, { title: "证照名称", dataIndex: "certNames", @@ -178,17 +216,51 @@ function PersonnelInfoPage(props) { width: 320, render: (_, record) => ( - - - - - + + ), }, @@ -242,14 +314,21 @@ function PersonnelInfoPage(props) { } function StaffFormModal({ - open, currentId, staffInfoGet, staffInfoAdd, staffInfoEdit, deptOptions, positionOptions, onCancel, onSuccess, + open, + currentId, + staffInfoGet, + staffInfoAdd, + staffInfoEdit, + deptOptions, + positionOptions, + onCancel, + onSuccess, }) { const [form] = Form.useForm(); const [submitting, setSubmitting] = useState(false); const [detailLoading, setDetailLoading] = useState(false); const [deptPositionOptions, setDeptPositionOptions] = useState([]); const [positionLoading, setPositionLoading] = useState(false); - const [uploadFileList, setUploadFileList] = useState([]); const watchedDeptId = Form.useWatch("deptId", form); const wasOpenRef = useRef(false); const inflightDeptRef = useRef(null); @@ -264,7 +343,11 @@ function StaffFormModal({ inflightDeptRef.current = id; setPositionLoading(true); try { - const res = await Get("/safetyEval/org-position/page", { current: 1, size: 200, deptId: id }); + const res = await Get("/safetyEval/org-position/page", { + current: 1, + size: 200, + deptId: id, + }); const options = (res?.data || []).map((p) => ({ label: p.positionName, value: p.id, @@ -286,7 +369,6 @@ function StaffFormModal({ if (!currentId) { form.resetFields(); setDeptPositionOptions([]); - setUploadFileList([]); form.setFieldsValue({ registerEngineerFlag: 2, }); @@ -294,7 +376,6 @@ function StaffFormModal({ } if (!open) { setDeptPositionOptions([]); - setUploadFileList([]); } wasOpenRef.current = open; }, [open, currentId, form]); @@ -303,36 +384,34 @@ function StaffFormModal({ if (!open || !currentId) return; let cancelled = false; setDetailLoading(true); - staffInfoGet({ id: currentId }).then((res) => { - if (cancelled || !res?.data) return; - const data = { ...res.data }; - loadPositionsByDept(data.deptId); - if (cancelled) return; - const setFields = { - ...data, - }; - if (data.birthDate) setFields.birthDate = dayjs(data.birthDate); - const fileList = data.proofMaterialUrl - ? data.proofMaterialUrl.split(",").filter(Boolean).map((url, i) => ({ - uid: `-${i}`, - name: url.split("/").pop() || `附件${i + 1}`, - status: "done", - url, - })) - : []; - setFields.proofMaterialUrl = fileList; - setUploadFileList(fileList); - form.setFieldsValue(setFields); - }).finally(() => { - if (!cancelled) setDetailLoading(false); - }); - return () => { cancelled = true; }; + staffInfoGet({ id: currentId }) + .then((res) => { + if (cancelled || !res?.data) return; + const data = { ...res.data }; + loadPositionsByDept(data.deptId); + if (cancelled) return; + const setFields = { + ...data, + }; + if (data.birthDate) setFields.birthDate = dayjs(data.birthDate); + + if (setFields.proofMaterialUrl) { + setFields.proofMaterialUrl = JSON.parse(setFields.proofMaterialUrl); + } + + form.setFieldsValue(setFields); + }) + .finally(() => { + if (!cancelled) setDetailLoading(false); + }); + return () => { + cancelled = true; + }; }, [open, currentId]); const handleCancel = () => { form.resetFields(); setDeptPositionOptions([]); - setUploadFileList([]); onCancel(); }; @@ -354,7 +433,12 @@ function StaffFormModal({ setSubmitting(true); const payload = { ...values, - genderName: values.genderCode === 1 ? "男" : values.genderCode === 2 ? "女" : undefined, + genderName: + values.genderCode === 1 + ? "男" + : values.genderCode === 2 + ? "女" + : undefined, personTypeCode: values.personTypeName, personTypeName: values.personTypeName, professionalLevelCode: values.professionalLevelName, @@ -364,8 +448,8 @@ function StaffFormModal({ educationLevelCode: values.educationLevelName, educationLevelName: values.educationLevelName, proofMaterialUrl: Array.isArray(values.proofMaterialUrl) - ? values.proofMaterialUrl.map((f) => f.url || f.response?.url).filter(Boolean).join(",") - : "", + ? JSON.stringify(values.proofMaterialUrl) + : undefined, }; if (payload.birthDate && typeof payload.birthDate !== "string") { payload.birthDate = payload.birthDate.format("YYYY-MM-DD"); @@ -406,15 +490,26 @@ function StaffFormModal({ > - + - + - - - + - - - @@ -473,12 +601,20 @@ function StaffFormModal({ - - @@ -487,17 +623,30 @@ function StaffFormModal({ - - - + - + @@ -507,21 +656,11 @@ function StaffFormModal({ - { - if (Array.isArray(e)) return e; - return e?.fileList; - }}> - { - setUploadFileList(info.fileList); - }} - > - - - + @@ -549,4 +688,7 @@ function StaffFormModal({ ); } -export default Connect([NS_STAFF_INFO], true)(AntdTableFuncControl(PersonnelInfoPage)); \ No newline at end of file +export default Connect( + [NS_STAFF_INFO], + true, +)(AntdTableFuncControl(PersonnelInfoPage)); diff --git a/src/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal.js b/src/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal.js index fa082b7..9445c0d 100644 --- a/src/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal.js +++ b/src/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal.js @@ -1,4 +1,4 @@ -import { Button, Descriptions, Modal, Table } from "antd"; +import { Button, Descriptions, Modal, Table, Upload } from "antd"; import { useEffect, useRef, useState } from "react"; import FilePreviewModal, { FilePreviewContent } from "~/components/FilePreviewModal"; import { resolvePreviewSrc } from "~/components/CertPreviewImg"; @@ -85,7 +85,9 @@ export default function StaffViewModal({ } }; - const proofFiles = info.proofMaterials || []; + + const proofMaterialUrl= info.proofMaterialUrl? JSON.parse(info.proofMaterialUrl) : []; + const certPreviewFiles = certPreviewInfo?.certImgs?.length ? certPreviewInfo.certImgs : certPreviewInfo?.certImgFiles || []; @@ -105,25 +107,25 @@ export default function StaffViewModal({ onCancel={onCancel} > - {info.staffName} - {GENDER_MAP[info.gender]} + {info.userName} + {GENDER_MAP[info.genderCode]} {info.birthDate} {info.account} {info.deptName} - {info.positionName} + {info.postName} {info.personType || "基础人员"} {info.qualScope || "-"} - {info.professionalLevel || "-"} + {info.professionalLevelName || "-"} {info.evaluatorCertNo || "-"} - {info.educationType || "-"} - {info.educationLevel || "-"} + {info.educationTypeName || "-"} + {info.educationLevelName || "-"} {info.titleName || "-"} {REGISTER_ENGINEER_MAP[info.registerEngineerFlag] ?? "-"} {info.idCardNo} - {info.education || "-"} - {info.homeAddress} + + {info.currentAddress} {info.officeAddress} {info.graduateSchool} {info.major} @@ -137,26 +139,14 @@ export default function StaffViewModal({ {info.workExperience || "-"} - {proofFiles.length ? ( -
- {proofFiles.map((file, index) => { - const fileName = file.name || file.fileName || `专业能力证明${index + 1}.pdf`; - return ( -
- - {fileName} -
- ); - })} + {proofMaterialUrl.length ? proofMaterialUrl.map((item) => ( + - ) : "-"} + )) : "-" +} diff --git a/src/pages/Container/EnterpriseInfo/ResignationApply/index.js b/src/pages/Container/EnterpriseInfo/ResignationApply/index.js index ed7e681..2bcf588 100644 --- a/src/pages/Container/EnterpriseInfo/ResignationApply/index.js +++ b/src/pages/Container/EnterpriseInfo/ResignationApply/index.js @@ -223,6 +223,7 @@ function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) { setSubmitting(true); values.applyTime = values.applyTime?.format?.("YYYY-MM-DD HH:mm:ss") || values.applyTime; + values.expectedResignDate = values.expectedResignDate?.format?.("YYYY-MM-DD") || values.expectedResignDate; @@ -342,7 +343,9 @@ function ViewModal({ open, currentId, requestDetail, onCancel }) { {info.remark} - {info.reportFileUrl || "-"} + + 查看 + diff --git a/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx b/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx index c784488..364cc2b 100644 --- a/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx +++ b/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx @@ -95,7 +95,7 @@ function OrgPersonnelSelectModalInner(props) { columns={[ { title: "人员姓名", dataIndex: "userName" }, { title: "类型", dataIndex: "personTypeName" }, - { title: "职务", dataIndex: "positionName" }, + { title: "职称", dataIndex: "titleName" }, { title: "操作", diff --git a/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx b/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx index 2724f10..5e86751 100644 --- a/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx +++ b/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx @@ -38,7 +38,7 @@ export default function PersonnelStep({ { title: "序号", width: 60, render: (_, __, index) => index + 1 }, { title: "人员姓名", dataIndex: "userName" }, { title: "类型", dataIndex: "personTypeName" }, - { title: "职务", dataIndex: "positionName" }, + { title: "职称", dataIndex: "titleName" }, { title: "操作", diff --git a/src/pages/Container/QualificationReview/FilingTabs/index.js b/src/pages/Container/QualificationReview/FilingTabs/index.js index 14afc47..b55da78 100644 --- a/src/pages/Container/QualificationReview/FilingTabs/index.js +++ b/src/pages/Container/QualificationReview/FilingTabs/index.js @@ -124,7 +124,7 @@ const FilingTabs = ({ { title: "序号", width: 60, render: (_, __, i) => i + 1 }, { title: "人员姓名", dataIndex: "personName", width: 100 }, { title: "类型", dataIndex: "personTypeName", width: 100 }, - { title: "职务", dataIndex: "positionName", width: 120 }, + { title: "职称", dataIndex: "titleName", width: 100 }, { title: "操作", width: 80, render: (_, record) => (