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/enumerate/constant/index.js b/src/enumerate/constant/index.js index 3e85f17..9ef443d 100644 --- a/src/enumerate/constant/index.js +++ b/src/enumerate/constant/index.js @@ -59,6 +59,12 @@ export const GENDER_OPTIONS = [ { label: "女", value: 2 }, ]; +/** 性别编码(1男2女) → 名称 */ +export const GENDER_MAP = { + 1: "男", + 2: "女", +}; + /** 审核结果 */ export const REVIEW_RESULT_OPTIONS = [ { label: "通过", value: 1 }, diff --git a/src/pages/Container/EnterpriseInfo/PersonnelChange/index.js b/src/pages/Container/EnterpriseInfo/PersonnelChange/index.js index 7c01af3..72376ec 100644 --- a/src/pages/Container/EnterpriseInfo/PersonnelChange/index.js +++ b/src/pages/Container/EnterpriseInfo/PersonnelChange/index.js @@ -181,8 +181,8 @@ function PersonnelChangePage(props) { width: 140, render: (_, record) => { const code = record.resignAuditStatus ?? record.auditStatus ?? record.auditStatusCode; - const label = RESIGN_AUDIT_STATUS_LABEL[code] ?? "-"; - return {label}; + return RESIGN_AUDIT_STATUS_LABEL[code] ? {label} : "-"; + }, }, { diff --git a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js index 4010184..adfda40 100644 --- a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js +++ b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js @@ -21,6 +21,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 +49,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 +144,37 @@ function PersonnelInfoPage(props) { loading={loading} formLine={[ - + , - + {deptOptions.map((d) => ( - {d.label} + + {d.label} + ))} , - + {positionOptions.map((p) => ( - {p.label} + + {p.label} + ))} , @@ -166,7 +194,7 @@ function PersonnelInfoPage(props) { { title: "用户名称", dataIndex: "userName" }, { title: "账号", dataIndex: "account" }, { title: "部门", dataIndex: "deptName" }, - { title: "岗位", dataIndex: "positionName" }, + { title: "岗位", dataIndex: "postName" }, { title: "证照名称", dataIndex: "certNames", @@ -178,17 +206,51 @@ function PersonnelInfoPage(props) { width: 320, render: (_, record) => ( - - - - - + + ), }, @@ -242,7 +304,15 @@ 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); @@ -267,7 +337,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, @@ -308,30 +382,29 @@ 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 = () => { @@ -360,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, @@ -370,8 +448,8 @@ function StaffFormModal({ educationLevelCode: values.educationLevelName, educationLevelName: values.educationLevelName, proofMaterialUrl: Array.isArray(values.proofMaterialUrl) - ? values.proofMaterialUrl.map((f) => f.url || f.response?.data?.url).filter(Boolean).join(",") - : "", + ? JSON.stringify(values.proofMaterialUrl) + : undefined, }; if (payload.birthDate && typeof payload.birthDate !== "string") { payload.birthDate = payload.birthDate.format("YYYY-MM-DD"); @@ -412,15 +490,26 @@ function StaffFormModal({ > - + - + - - - + - - - @@ -479,12 +601,20 @@ function StaffFormModal({ - - @@ -493,17 +623,30 @@ function StaffFormModal({ - - - + - + @@ -513,6 +656,11 @@ function StaffFormModal({ + - {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/QualificationCert/index.js b/src/pages/Container/EnterpriseInfo/QualificationCert/index.js index 3cf1b0c..4d090dc 100644 --- a/src/pages/Container/EnterpriseInfo/QualificationCert/index.js +++ b/src/pages/Container/EnterpriseInfo/QualificationCert/index.js @@ -95,7 +95,7 @@ function QualificationCertPage(props) { okText: "是", cancelText: "否", onOk: async () => { - const res = await props.orgQualificationCertRemove({ id }); + const res = await props.orgQualificationCertRemove({ data: id }); if (res?.success !== false) { message.success("删除成功"); getData(); @@ -113,7 +113,7 @@ function QualificationCertPage(props) { cancelText: "否", onOk: async () => { const action = enabled ? props.orgQualificationCertDisable : props.orgQualificationCertEnable; - const res = await action({ id: record.id }); + const res = await action({ data: record.id }); if (res?.success !== false) { message.success("操作成功"); await getData(); @@ -234,15 +234,13 @@ function QualificationCertPage(props) { - + ), }, ]} dataSource={dataSource} - scroll={{ y: props.scrollY }} + scroll={{ y: props.scrollY , x: 1400}} loading={loading} pagination={{ total, @@ -315,7 +313,7 @@ function CertFormModal({ const data = { ...res.data }; data.issueDate = toDayjs(data.issueDate); data.validDate = [toDayjs(data.validStartDate), toDayjs(data.validEndDate)]; - data.certImageUrl = parseCertImageUrl(data.certImageUrl); + data.certImageUrl = data.certImageUrl; form.setFieldsValue(data); } catch (err) { console.warn("[QualificationCert] load detail failed:", err); @@ -336,7 +334,7 @@ function CertFormModal({ setSubmitting(true); values.validStartDate = values.validDate?.[0]; values.validEndDate = values.validDate?.[1]; - values.certImageUrl = stringifyCertImageUrl(values.certImageUrl); + values.certImageUrl = values.certImageUrl?.map((item) => item.url).join(","); if (currentId) values.id = currentId; const request = currentId ? requestEdit : requestAdd; const res = await request(values); @@ -420,7 +418,7 @@ function CertFormModal({