diff --git a/src/components/StaffViewModal/index.js b/src/components/StaffViewModal/index.js
index fae4d9f..c419270 100644
--- a/src/components/StaffViewModal/index.js
+++ b/src/components/StaffViewModal/index.js
@@ -9,6 +9,7 @@ import {
fetchStaffCertListByPersonnelId,
} from "~/api/staffCertificate";
import { fetchOrgPersonnelDetail } from "~/utils/qualFiling/personnelHelper";
+import { TITLE_LEVEL_MAP } from "~/enumerate/enterpriseOptions";
const GENDER_MAP = { 1: "男", 2: "女" };
const REGISTER_ENGINEER_MAP = { 1: "是", 2: "否" };
@@ -152,7 +153,7 @@ export default function StaffViewModal({
{info.educationLevelName || "-"}
- {info.titleName || "-"}
+ {TITLE_LEVEL_MAP[info.titleCode] ?? (info.titleCode || "-")}
{REGISTER_ENGINEER_MAP[info.registerEngineerFlag] ?? "-"}
diff --git a/src/enumerate/enterpriseOptions.js b/src/enumerate/enterpriseOptions.js
index f47067a..c9525af 100644
--- a/src/enumerate/enterpriseOptions.js
+++ b/src/enumerate/enterpriseOptions.js
@@ -173,3 +173,15 @@ export const REGISTER_ENGINEER_OPTIONS = [
{ label: "是", value: 1 },
{ label: "否", value: 2 },
];
+
+/** 职称等级 */
+export const TITLE_LEVEL_OPTIONS = [
+ { value: "SENIOR", label: "高级" },
+ { value: "MIDDLE", label: "中级" },
+ { value: "JUNIOR", label: "初级" },
+];
+
+export const TITLE_LEVEL_MAP = TITLE_LEVEL_OPTIONS.reduce(
+ (acc, cur) => ({ ...acc, [cur.value]: cur.label }),
+ {},
+);
diff --git a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js
index dc27879..fff0113 100644
--- a/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js
+++ b/src/pages/Container/EnterpriseInfo/PersonnelInfo/List/index.js
@@ -28,6 +28,7 @@ import {
PROFESSIONAL_LEVEL_OPTIONS,
QUALIFICATION_INDUSTRY_OPTIONS,
REGISTER_ENGINEER_OPTIONS,
+ TITLE_LEVEL_OPTIONS,
} from "~/enumerate/enterpriseOptions";
import { getBirthDateFromIdCard } from "~/utils";
import { idCardRule, mobileRule } from "~/utils/validators";
@@ -689,11 +690,11 @@ function StaffFormModal({
-
+
diff --git a/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx b/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx
index b8c9fe2..ee21c62 100644
--- a/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx
+++ b/src/pages/Container/QualApplication/FilingForm/components/OrgPersonnelSelectModal.jsx
@@ -2,6 +2,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Form, Input, Modal, Table } from "antd";
import { useEffect, useState } from "react";
import { NS_STAFF_INFO } from "~/enumerate/namespace";
+import { TITLE_LEVEL_MAP } from "~/enumerate/enterpriseOptions";
import StaffViewModal from "~/components/StaffViewModal";
function OrgPersonnelSelectModalInner(props) {
@@ -97,7 +98,7 @@ function OrgPersonnelSelectModalInner(props) {
{ title: "人员姓名", dataIndex: "userName", ellipsis: true },
{ title: "类型", dataIndex: "personTypeName" },
- { title: "职称", dataIndex: "titleName", ellipsis: true },
+ { title: "职称", dataIndex: "titleName", ellipsis: true, render: (_, record) => TITLE_LEVEL_MAP[record.titleCode] ?? (record.titleCode || "-") },
{
title: "操作",
width: 80,
diff --git a/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx b/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx
index 2bfcf65..72c3ca7 100644
--- a/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx
+++ b/src/pages/Container/QualApplication/FilingForm/components/PersonnelStep.jsx
@@ -1,5 +1,6 @@
import { Button, Modal, Space, Table } from "antd";
import { useState } from "react";
+import { TITLE_LEVEL_MAP } from "~/enumerate/enterpriseOptions";
import StaffViewModal from "~/components/StaffViewModal";
import OrgPersonnelSelectModal from "./OrgPersonnelSelectModal";
@@ -38,7 +39,7 @@ const PersonnelStep=({
{ title: "人员姓名", dataIndex: "userName", render: (_, record) => record.userName || record.personName },
{ title: "类型", dataIndex: "personTypeName" },
- { title: "职称", dataIndex: "titleName" },
+ { title: "职称", dataIndex: "titleName", render: (_, record) => TITLE_LEVEL_MAP[record.titleCode] ?? (record.titleCode || "-") },
{
title: "操作",
width: 140,
diff --git a/src/pages/Container/QualApplication/FilingForm/index.js b/src/pages/Container/QualApplication/FilingForm/index.js
index 7a46893..c7a1330 100644
--- a/src/pages/Container/QualApplication/FilingForm/index.js
+++ b/src/pages/Container/QualApplication/FilingForm/index.js
@@ -12,9 +12,9 @@ import { FILING_MATERIAL_TEMPLATE } from "../filingMaterialTemplate";
import {
fetchOrgPersonnelOptions,
mapEquipRowToFilingEquipment,
- mapStaffRowToFilingPersonnel,
+
mergeDetailFromForms,
- persistFilingToBackend,
+
} from "../filingPersist";
import { verifyFilingPrerequisites } from "../filingVerify";
diff --git a/src/pages/Container/QualApplication/filingPersist.js b/src/pages/Container/QualApplication/filingPersist.js
index 63edba4..8f1e03f 100644
--- a/src/pages/Container/QualApplication/filingPersist.js
+++ b/src/pages/Container/QualApplication/filingPersist.js
@@ -1,43 +1,23 @@
-import { fetchQualFilingDetail } from "~/api/qualFiling";
-import { fromPageResponse, toPageQuery, toStaffForm, toEquipForm } from "~/utils/enterpriseInfo/adapter";
+import { fromPageResponse, toPageQuery } from "~/utils/enterpriseInfo/adapter";
import { apiGet } from "~/utils/enterpriseInfo/http";
import { asId } from "~/utils/enterpriseInfo/idUtil";
-import { resolveUploadFileId } from "~/utils/mockUpload";
-import { toApiDate } from "~/utils/dateFormat";
-import { FILING_FORM_MODE } from "~/enumerate/qualFilingOptions";
-import { buildCommitmentContent } from "./filingCommitment";
export async function fetchOrgPersonnelOptions() {
const query = toPageQuery({ current: 1, size: 500 }, { likeStaffName: "userName" });
const res = await apiGet("/safetyEval/org-personnel/page", query);
- const page = fromPageResponse(res, toStaffForm);
- return (page?.data || []).map((row) => ({
- label: row.staffName,
- value: String(row.id),
- staffName: row.staffName,
- positionName: row.positionName,
- titleName: row.titleName,
- personType: row.personType,
- registerEngineerFlag: row.registerEngineerFlag,
- workExperience: row.workExperience,
+ const page = fromPageResponse(res);
+ return (page?.data || []).map((data) => ({
+ label: data.userName,
+ value: String(data.id),
+ staffName: data.userName,
+ positionName: data.postName ?? data.positionName,
+ titleName: data.titleName,
+ personType: data.personTypeName ?? "基础人员",
+ registerEngineerFlag: data.registerEngineerFlag ?? 2,
+ workExperience: data.workExperience,
}));
}
-export function mapStaffRowToFilingPersonnel(row = {}) {
- const id = asId(row.id);
- return {
- id: `local-person-${id}`,
- sourcePersonnelId: id,
- personName: row.staffName,
- userName: row.staffName,
- personTypeName: row.personType,
- positionName: row.positionName,
- titleName: row.titleName,
- registerEngineerFlag: row.registerEngineerFlag,
- workExperience: row.workExperience,
- };
-}
-
export function mapEquipRowToFilingEquipment(row = {}) {
const id = asId(row.id);
return {
@@ -50,227 +30,6 @@ export function mapEquipRowToFilingEquipment(row = {}) {
};
}
-function collectBasicValues(detail = {}) {
- const {
- materials,
- commitment,
- personnelList,
- equipmentList,
- ...basic
- } = detail;
- return basic;
-}
-
-function buildCommitmentPayload(detail) {
- const commitment = detail.commitment || {};
- const filingUnitName = commitment.filingUnitName || detail.filingUnitName || "";
- const legalRepName = commitment.legalRepName || "";
- const legalRepPersonnelId = commitment.legalRepPersonnelId || "";
- return {
- id: commitment.id,
- filingId: detail.id,
- legalRepSignatureUrl: commitment.legalRepSignatureUrl,
- signDate: toApiDate(commitment.signDate),
- legalRepPersonnelId,
- legalRepName,
- commitmentContent: buildCommitmentContent({ legalRepName, filingUnitName }),
- };
-}
-
-function hasCommitmentData(detail = {}) {
- const c = detail.commitment || {};
- return !!(c.legalRepName || c.legalRepPersonnelId || c.signDate || c.legalRepSignatureUrl);
-}
-
-async function ensureBackendMaterials(props, filingId, backendMaterials = []) {
- if ((backendMaterials || []).length > 0) {
- return backendMaterials;
- }
- await props.qualFilingMaterialInitTemplate({ filingId });
- const res = await fetchQualFilingDetail(filingId);
- return res?.data?.materials || [];
-}
-
-async function syncMaterialsUploads(props, localMaterials = [], backendMaterials = []) {
- const uploads = [];
- for (const localMat of localMaterials) {
- if (!localMat?.attachmentUrl) {
- continue;
- }
- const backendMat = backendMaterials.find((m) => Number(m.sortOrder) === Number(localMat.sortOrder));
- if (backendMat?.id && backendMat.attachmentUrl !== localMat.attachmentUrl) {
- uploads.push(props.qualFilingMaterialUpload({
- id: backendMat.id,
- attachmentUrl: localMat.attachmentUrl,
- }));
- }
- }
- if (uploads.length) {
- await Promise.all(uploads);
- }
-}
-
-async function syncPersonnel(props, filingId, localList = [], backendList = []) {
- const backendMap = new Map(
- (backendList || []).map((p) => [String(p.sourcePersonnelId), p]),
- );
- const localIds = new Set(
- localList.map((p) => String(p.sourcePersonnelId)).filter(Boolean),
- );
-
- const deletes = (backendList || [])
- .filter((p) => !localIds.has(String(p.sourcePersonnelId)))
- .map((p) => props.qualFilingPersonnelDelete({ id: p.id }));
-
- if (deletes.length) {
- await Promise.all(deletes);
- }
-
- const toAdd = [...localIds].filter((id) => !backendMap.has(id));
- if (toAdd.length) {
- await props.qualFilingPersonnelBatchAdd({
- filingId,
- sourcePersonnelIds: toAdd,
- });
- }
-}
-
-async function syncEquipment(props, filingId, localList = [], backendList = []) {
- const backendMap = new Map(
- (backendList || []).map((e) => [String(e.sourceEquipmentId), e]),
- );
- const localIds = new Set(
- localList.map((e) => String(e.sourceEquipmentId)).filter(Boolean),
- );
-
- const deletes = (backendList || [])
- .filter((e) => !localIds.has(String(e.sourceEquipmentId)))
- .map((e) => props.qualFilingEquipmentDelete({ id: e.id }));
-
- if (deletes.length) {
- await Promise.all(deletes);
- }
-
- const toAdd = [...localIds].filter((id) => !backendMap.has(id));
- if (toAdd.length) {
- await props.qualFilingEquipmentBatchAdd({
- filingId,
- sourceEquipmentIds: toAdd,
- });
- }
-
- const needCalibration = localList.some((e) => e.calibrationReportUrl);
- if (!needCalibration) {
- return;
- }
-
- const refreshed = await fetchQualFilingDetail(filingId);
- const backendAfter = refreshed?.data?.equipmentList || [];
- const calibrations = [];
- for (const localEquip of localList) {
- if (!localEquip.calibrationReportUrl) {
- continue;
- }
- const backendEquip = backendAfter.find(
- (e) => String(e.sourceEquipmentId) === String(localEquip.sourceEquipmentId),
- );
- if (backendEquip?.id && backendEquip.calibrationReportUrl !== localEquip.calibrationReportUrl) {
- calibrations.push(props.qualFilingEquipmentUploadCalibration({
- id: backendEquip.id,
- attachmentUrl: localEquip.calibrationReportUrl,
- }));
- }
- }
- if (calibrations.length) {
- await Promise.all(calibrations);
- }
-}
-
-/**
- * 将本地表单全量同步到后端(暂存 / 提交确认时调用)
- */
-function getApiErrorMessage(res, fallback) {
- return res?.message || res?.errMessage || fallback;
-}
-
-export async function persistFilingToBackend(props, detail, mode) {
- let filingId = detail.id;
- const basicValues = collectBasicValues(detail);
-
- if (!filingId) {
- const createDraft = mode === FILING_FORM_MODE.FILED
- ? props.qualFilingFiledDraft
- : props.qualFilingDraft;
- const draftRes = await createDraft();
- if (draftRes?.success === false || !draftRes?.data?.id) {
- throw new Error(getApiErrorMessage(draftRes, "创建草稿失败"));
- }
- filingId = draftRes.data.id;
- basicValues.id = filingId;
- }
-
- const saveRes = await props.qualFilingSaveDraft({ ...basicValues, id: filingId });
- if (saveRes?.success === false) {
- throw new Error(getApiErrorMessage(saveRes, "暂存基本信息失败"));
- }
-
- if (detail.attachmentUrl) {
- await props.qualFilingUploadAttachment({
- id: filingId,
- attachmentUrl: detail.attachmentUrl,
- });
- }
-
- let backendDetail = (await fetchQualFilingDetail(filingId))?.data || {};
-
- const backendMaterials = await ensureBackendMaterials(
- props,
- filingId,
- backendDetail.materials,
- );
- await syncMaterialsUploads(props, detail.materials || [], backendMaterials);
-
- if (hasCommitmentData(detail)) {
- const commitmentRes = await props.qualFilingCommitmentSaveOrUpdate(
- buildCommitmentPayload({ ...detail, id: filingId }),
- );
- if (commitmentRes?.success === false) {
- throw new Error(getApiErrorMessage(commitmentRes, "暂存承诺书失败"));
- }
- }
-
- const hasPersonnel = (detail.personnelList || []).length > 0;
- const hasEquipment = (detail.equipmentList || []).length > 0;
-
- if (hasPersonnel || hasEquipment) {
- backendDetail = (await fetchQualFilingDetail(filingId))?.data || backendDetail;
- }
-
- if (hasPersonnel) {
- await syncPersonnel(
- props,
- filingId,
- detail.personnelList || [],
- backendDetail.personnelList || [],
- );
- }
-
- if (hasEquipment) {
- if (hasPersonnel) {
- backendDetail = (await fetchQualFilingDetail(filingId))?.data || backendDetail;
- }
- await syncEquipment(
- props,
- filingId,
- detail.equipmentList || [],
- backendDetail.equipmentList || [],
- );
- }
-
- const finalDetail = await fetchQualFilingDetail(filingId);
- return finalDetail?.data || { id: filingId };
-}
-
export function mergeDetailFromForms(detail, { basicValues, commitmentValues }) {
return {
diff --git a/src/pages/Container/QualApplication/filingVerify.js b/src/pages/Container/QualApplication/filingVerify.js
index f6024de..52c5695 100644
--- a/src/pages/Container/QualApplication/filingVerify.js
+++ b/src/pages/Container/QualApplication/filingVerify.js
@@ -13,11 +13,11 @@ function ratio(count, total) {
}
function includesSeniorTitle(titleName = "") {
- return String(titleName).includes("高级");
+ return titleName === "SENIOR";
}
function includesMidTitle(titleName = "") {
- return String(titleName).includes("中级") || includesSeniorTitle(titleName);
+ return titleName === "MIDDLE" || titleName === "SENIOR";
}
function isRegisterEngineer(record = {}) {
diff --git a/src/pages/Container/QualificationReview/FilingTabs/index.js b/src/pages/Container/QualificationReview/FilingTabs/index.js
index d031ac3..47f128b 100644
--- a/src/pages/Container/QualificationReview/FilingTabs/index.js
+++ b/src/pages/Container/QualificationReview/FilingTabs/index.js
@@ -4,7 +4,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import StaffViewModal from "~/components/StaffViewModal";
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
-import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
+import { QUALIFICATION_INDUSTRY_OPTIONS_MAP, TITLE_LEVEL_MAP } from "~/enumerate/enterpriseOptions";
/**
@@ -153,7 +153,7 @@ const FilingTabs = ({
{ title: "人员姓名", dataIndex: "personName", width: 100 },
{ title: "类型", dataIndex: "personTypeName", width: 100 },
- { title: "职称", dataIndex: "titleName", width: 100 },
+ { title: "职称", dataIndex: "titleName", width: 100, render: (_, record) => TITLE_LEVEL_MAP[record.titleCode] ?? (record.titleCode || "-") },
{ title: "操作", width: 80,
render: (_, record) => (