From 8e6c5c1b69b50162c5a898b177683bb2e31ecacf Mon Sep 17 00:00:00 2001 From: tangjie <122778500@qq.com> Date: Mon, 6 Jul 2026 16:22:51 +0800 Subject: [PATCH] feat --- jjb.config.js | 4 +- src/api/orgInfo/index.js | 69 +++++------------ src/components/AttachmentUpload/index.js | 5 +- .../Container/EnterpriseInfo/OrgInfo/index.js | 77 ++++++++----------- src/pages/Container/EnterpriseInfo/index.js | 66 +++++----------- src/pages/Container/QualApplication/index.js | 2 +- .../QualificationReview/FilingTabs/index.js | 39 +--------- 7 files changed, 79 insertions(+), 183 deletions(-) diff --git a/jjb.config.js b/jjb.config.js index 04111c0..aa068d2 100644 --- a/jjb.config.js +++ b/jjb.config.js @@ -10,7 +10,7 @@ module.exports = { javaGitBranch: "", // 本地联调 safetyEval-service(context-path: /safetyEval,默认端口 8095) // 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095 - API_HOST: "http://192.168.0.149", + API_HOST: "http://192.168.0.152", }, production: { // 应用后端分支名称,部署上线需要 @@ -49,7 +49,7 @@ module.exports = { // 监听端口号 port: "8081", // 服务地址(0.0.0.0 允许局域网 IP 访问) - host: "0.0.0.0", + host: "192.168.0.187", // 是否自动打开浏览器 open: false, diff --git a/src/api/orgInfo/index.js b/src/api/orgInfo/index.js index 69ab1ea..5ae39a1 100644 --- a/src/api/orgInfo/index.js +++ b/src/api/orgInfo/index.js @@ -1,57 +1,30 @@ import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; -import { - fromOrgInfoForm, - fromSingleResponse, - toOrgInfoForm, -} from "../enterpriseInfo/adapter"; -import { apiGet, apiPost, safeAction } from "../enterpriseInfo/http"; -import { setOrgInfoDetailCache } from "../enterpriseInfo/orgBootstrap"; -import { setOrgInfoId } from "../enterpriseInfo/orgContext"; -function persistOrgInfoId(result, rawData) { - const id = result?.data?.id ?? rawData?.id; - if (id) { - setOrgInfoId(id); - } - setOrgInfoDetailCache(result); - return result; -} +export const orgInfoGet = declareRequest( + "orgInfoLoading", + "Get > /safetyEval/org-info/getInfo", + "orgInfoDetail: {} | res.data || {}", +); -function buildSaveHeaders(payload) { - if (payload?.id) { - setOrgInfoId(payload.id); - return { orgInfoId: String(payload.id) }; - } - return {}; -} +export const orgInfoSave = declareRequest( + "orgInfoLoading", + "Post > @/safetyEval/org-info/save", +); -export const orgInfoGet = declareRequest("orgInfoLoading", safeAction(async () => { - const res = await apiGet("/safetyEval/org-info/getInfo", {}, {}, { includeOrgContext: false }); - const result = fromSingleResponse(res, toOrgInfoForm); - return persistOrgInfoId(result, res?.data); -})); +export const orgInfoModify = declareRequest( + "orgInfoLoading", + "Post > @/safetyEval/org-info/modify", +); -export const orgInfoSave = declareRequest("orgInfoLoading", safeAction(async (values) => { - const payload = fromOrgInfoForm(values, { isDraft: false }); - const headers = buildSaveHeaders(payload); - const res = payload.id - ? await apiPost("/safetyEval/org-info/modify", payload, headers) - : await apiPost("/safetyEval/org-info/save", payload, headers); - const result = fromSingleResponse(res, toOrgInfoForm); - persistOrgInfoId(result, res?.data); - return result; -})); +export const orgInfoDraft = declareRequest( + "orgInfoLoading", + "Post > @/safetyEval/org-info/save", +); -export const orgInfoDraft = declareRequest("orgInfoLoading", safeAction(async (values) => { - const payload = fromOrgInfoForm(values, { isDraft: true }); - const headers = buildSaveHeaders(payload); - const res = payload.id - ? await apiPost("/safetyEval/org-info/modify", payload, headers) - : await apiPost("/safetyEval/org-info/save", payload, headers); - const result = fromSingleResponse(res, toOrgInfoForm); - persistOrgInfoId(result, res?.data); - return result; -})); +export const orgInfoDraftModify = declareRequest( + "orgInfoLoading", + "Post > @/safetyEval/org-info/modify", +); export { orgAccountList, diff --git a/src/components/AttachmentUpload/index.js b/src/components/AttachmentUpload/index.js index 0b4947a..40fe12c 100644 --- a/src/components/AttachmentUpload/index.js +++ b/src/components/AttachmentUpload/index.js @@ -43,8 +43,11 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou }} > ({ - label: v, - value: v, - })); - const loadDetail = async () => { try { const res = await props.orgInfoGet(); @@ -60,6 +55,7 @@ function OrgInfoPage(props) { productionDate: res.data.productionDate ? dayjs(res.data.productionDate) : undefined, + attachmentUrls: res.data.attachmentUrls? JSON.parse(res.data.attachmentUrls) :null, }); setHasExistingData(true); setEditing(false); @@ -67,11 +63,6 @@ function OrgInfoPage(props) { setDetail({}); setHasExistingData(false); setEditing(true); - form.setFieldsValue({ - filingType: "确认备案", - filingRecordStatus: "未备案", - attachments: mockUploadFileList("资质申请书.pdf"), - }); } } catch (err) { console.warn("[OrgInfo] loadDetail failed:", err); @@ -107,16 +98,17 @@ function OrgInfoPage(props) { productionDate: formValues.productionDate ? dayjs(formValues.productionDate).format("YYYY-MM-DD") : undefined, + attachmentUrls: formValues.attachmentUrls? JSON.stringify(formValues.attachmentUrls) :null, + authStatusCode: submitType === "draft" ? 0 : 1, + authStatusName: submitType === "draft" ? "草稿" : "已提交", }; setSubmitting(true); let request; if (hasExistingData) { - // 已有数据:仅走修改接口 - request = props.orgInfoSave; + request = props.orgInfoModify; values.id = detail.id; } else { - // 无数据:暂存、提交均走保存接口(草稿/已提交由 authStatusCode 区分) request = submitType === "draft" ? props.orgInfoDraft : props.orgInfoSave; } @@ -133,14 +125,7 @@ function OrgInfoPage(props) { setEditing(false); loadDetail(); } - } catch (err) { - if (err?.errorFields) { - return; - } - message.error( - hasExistingData ? "修改失败,请稍后重试" : "保存失败,请稍后重试", - ); - } finally { + } finally { setSubmitting(false); } }; @@ -150,9 +135,7 @@ function OrgInfoPage(props) { title={
机构信息管理 -
+
新成立或首次使用系统的安全评价机构,可通过系统提供的引导页面,详细填写机构的基本信息。
@@ -174,7 +157,7 @@ function OrgInfoPage(props) { @@ -192,7 +175,7 @@ function OrgInfoPage(props) { @@ -277,13 +260,13 @@ function OrgInfoPage(props) { - + @@ -300,7 +283,7 @@ function OrgInfoPage(props) { @@ -309,7 +292,7 @@ function OrgInfoPage(props) { @@ -326,13 +309,13 @@ function OrgInfoPage(props) { - + @@ -343,13 +326,13 @@ function OrgInfoPage(props) { - + @@ -365,13 +348,13 @@ function OrgInfoPage(props) { - + @@ -408,7 +391,7 @@ function OrgInfoPage(props) { @@ -422,7 +405,7 @@ function OrgInfoPage(props) { @@ -435,7 +418,7 @@ function OrgInfoPage(props) { - + - + - + diff --git a/src/pages/Container/EnterpriseInfo/index.js b/src/pages/Container/EnterpriseInfo/index.js index 641b643..51cdfa0 100644 --- a/src/pages/Container/EnterpriseInfo/index.js +++ b/src/pages/Container/EnterpriseInfo/index.js @@ -1,60 +1,32 @@ -import { message, Spin } from "antd"; -import { useEffect, useState } from "react"; -import { - ensureOrgContext, - isOrgInfoPage, - ORG_INFO_PAGE_PATH, -} from "~/api/enterpriseInfo/orgBootstrap"; +import React, { useEffect, useState } from "react"; +import { NS_ORG_INFO } from "~/enumerate/namespace"; +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Skeleton } from "antd"; -/** - * 企业信息模块入口:进入时 getInfo,有机构则缓存 orgInfoId;无机构则仅允许访问机构信息管理页。 - */ +/** 资质申请管理模块入口:需先有机构信息 */ function EnterpriseInfo(props) { - const [checking, setChecking] = useState(true); - const onOrgInfoPage = isOrgInfoPage(); - + + const [orgInfoId, setOrgInfoId] = useState( + sessionStorage.getItem("orgInfoId"), + ); useEffect(() => { - let cancelled = false; - - ensureOrgContext({ force: true }) - .then((ctx) => { - if (cancelled) { - return; - } - if (ctx?.networkError && onOrgInfoPage) { - message.warning("机构信息加载失败,请确认后端服务已启动"); - } - if (!ctx?.hasOrg && !onOrgInfoPage) { - message.warning("请先完善机构信息"); - //window.location.replace(ORG_INFO_PAGE_PATH); - return; - } - setChecking(false); - }) - .catch((err) => { - console.warn("[EnterpriseInfo] ensureOrgContext failed:", err); - if (!cancelled) { - if (onOrgInfoPage) { - message.warning("机构信息加载失败,请确认后端服务已启动"); - } - setChecking(false); - } + if (!orgInfoId) { + props.orgInfoGet().then((res) => { + setOrgInfoId(res?.data?.id); }); + } + }, []); + console.log(props.location.pathname); - return () => { - cancelled = true; - }; - }, [onOrgInfoPage]); - - if (checking) { - return ; + if(props.location.pathname.includes('EnterpriseInfo/OrgInfo')){ + return props.children; } return (
- {props.children} + {orgInfoId ? props.children : }
); } -export default EnterpriseInfo; +export default Connect([NS_ORG_INFO], true)(EnterpriseInfo); diff --git a/src/pages/Container/QualApplication/index.js b/src/pages/Container/QualApplication/index.js index 03c4dbf..28c467c 100644 --- a/src/pages/Container/QualApplication/index.js +++ b/src/pages/Container/QualApplication/index.js @@ -18,7 +18,7 @@ function QualApplication(props) { return (
- {orgInfoId ? props.children : } + {orgInfoId ? props.children : }
); } diff --git a/src/pages/Container/QualificationReview/FilingTabs/index.js b/src/pages/Container/QualificationReview/FilingTabs/index.js index 70c4167..14afc47 100644 --- a/src/pages/Container/QualificationReview/FilingTabs/index.js +++ b/src/pages/Container/QualificationReview/FilingTabs/index.js @@ -4,11 +4,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { NS_QUAL_REVIEW } from "~/enumerate/namespace"; import StaffViewModal from "~/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal"; import PreviewUrlButton from "~/components/PreviewUrlButton/index"; -import { - MOCK_EQUIP_DETAIL, - CALIBRATION_MAP, -} from "../mockData"; /** * 共享组件:资质备案 5 个标签页(详情 / 审核共用) @@ -25,16 +21,12 @@ const FilingTabs = ({ isReview = false, compliance = {}, onComplianceChange, - onPersonnelView, - onEquipView, + }) => { - const [equipVisible, setEquipVisible] = useState(false); - const [selectedEquip, setSelectedEquip] = useState(null); const [viewId, setViewId] = useState(""); - const baseCols = [ { title: "序号", width: 60, render: (_, __, i) => i + 1 }, { title: "材料名称", dataIndex: "materialContent" }, @@ -188,34 +180,7 @@ const FilingTabs = ({ onCancel={() => setViewId("")} /> - {/* 设备详细信息弹窗 */} - setEquipVisible(false)} - width={600} - footer={} - > - {selectedEquip && ( - - {MOCK_EQUIP_DETAIL.name} - {MOCK_EQUIP_DETAIL.model} - {MOCK_EQUIP_DETAIL.category} - {MOCK_EQUIP_DETAIL.type} - {MOCK_EQUIP_DETAIL.manufacturer} - {MOCK_EQUIP_DETAIL.calibrationType} - {MOCK_EQUIP_DETAIL.flowDesc} - {MOCK_EQUIP_DETAIL.maxFlow} - {MOCK_EQUIP_DETAIL.minFlow} - {MOCK_EQUIP_DETAIL.dualChannel} - {MOCK_EQUIP_DETAIL.calibInitValue} - {MOCK_EQUIP_DETAIL.calibUnit} - - {CALIBRATION_MAP[MOCK_EQUIP_DETAIL.status]?.label} - - - )} - + );