diff --git a/src/pages/Container/QualApplication/FilingForm/index.js b/src/pages/Container/QualApplication/FilingForm/index.js index 5366c3b..2271a8f 100644 --- a/src/pages/Container/QualApplication/FilingForm/index.js +++ b/src/pages/Container/QualApplication/FilingForm/index.js @@ -5,13 +5,14 @@ import dayjs from "dayjs"; import { useCallback, useEffect, useRef, useState } from "react"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import { fetchQualFilingDetail, fetchQualChangeDetail } from "~/api/qualFiling"; -import { NS_QUAL_FILING } from "~/enumerate/namespace"; +import { NS_ORG_INFO, NS_QUAL_FILING } from "~/enumerate/namespace"; import { FILING_FORM_MODE } from "~/enumerate/qualFilingOptions"; import { getFilingMaterialTemplate } from "../filingMaterialTemplate"; import { fetchOrgPersonnelOptions, mapEquipRowToFilingEquipment, + mapOrgInfoToFilingBasic, mergeDetailFromForms, } from "../filingPersist"; import { verifyFilingPrerequisites } from "../filingVerify"; @@ -93,6 +94,21 @@ function FilingFormPage(props) { ...prev, materials: getFilingMaterialTemplate(mode), })); + // 非变更模式新建时,用机构基础信息预填基本信息 + if (mode !== FILING_FORM_MODE.CHANGE) { + props.orgInfoGet().then((res) => { + const orgInfo = res?.data; + if (!orgInfo?.id) { + return; + } + const values = mapOrgInfoToFilingBasic(orgInfo); + if (mode === FILING_FORM_MODE.APPLICATION) { + // 申请模式下无资质证书编号字段,避免带入多余提交字段 + delete values.filingNo; + } + basicForm.setFieldsValue(values); + }); + } } }, []); @@ -513,4 +529,4 @@ function FilingFormPage(props) { ); } -export default Connect([NS_QUAL_FILING], true)(FilingFormPage); +export default Connect([NS_QUAL_FILING, NS_ORG_INFO], true)(FilingFormPage); diff --git a/src/pages/Container/QualApplication/filingPersist.js b/src/pages/Container/QualApplication/filingPersist.js index 49b5d64..9a69a48 100644 --- a/src/pages/Container/QualApplication/filingPersist.js +++ b/src/pages/Container/QualApplication/filingPersist.js @@ -17,6 +17,31 @@ export async function fetchOrgPersonnelOptions() { })); } +/** 机构基础信息 -> 备案基本信息表单字段映射 */ +export function mapOrgInfoToFilingBasic(orgInfo = {}) { + return { + filingUnitName: orgInfo.unitName, + creditCode: orgInfo.creditCode, + registerAddress: orgInfo.registerAddress, + officeAddress: orgInfo.businessAddress, + infoDisclosureUrl: orgInfo.infoDisclosureUrl, + filingNo: orgInfo.qualificationCertNo, + legalRepresentative: orgInfo.legalRepresentative, + legalPersonPhone: orgInfo.legalRepresentativePhone, + fax: orgInfo.fax, + contactName: orgInfo.contactName, + contactPhone: orgInfo.contactPhone, + fixedAssetAmount: orgInfo.fixedAssetsTotal, + workplaceArea: orgInfo.workplaceArea, + archiveRoomArea: orgInfo.archiveRoomArea, + fulltimeEvaluatorCount: orgInfo.fulltimeEvaluatorCount, + registeredEngineerCount: orgInfo.registeredEngineerCount, + unitIntro: orgInfo.orgIntro, + businessScope: orgInfo.safetyIndustryCategoryCode, + attachmentUrl: orgInfo.attachmentUrls, + }; +} + export function mapEquipRowToFilingEquipment(row = {}) { const id = asId(row.id); return {