import { Button, message, Spin } from "antd"; import { useEffect, useState } from "react"; import { ensureOrgContext, ORG_INFO_PAGE_PATH, } from "~/api/enterpriseInfo/orgBootstrap"; import { getOrgInfoId, setOrgInfoId } from "~/api/enterpriseInfo/orgContext"; /** 本地联调默认机构 id(与后端 application-local.yml public-api.org-id 一致) */ const LOCAL_DEV_ORG_INFO_ID = "1"; /** 资质申请管理模块入口:需先有机构信息 */ function QualApplication(props) { const [checking, setChecking] = useState(true); const [blocked, setBlocked] = useState(false); useEffect(() => { let cancelled = false; // 本地独立运行时,优先恢复 session / 默认 orgInfoId,避免 getInfo 无用户关联导致卡死 if (!getOrgInfoId() && !window.__POWERED_BY_QIANKUN__) { setOrgInfoId(LOCAL_DEV_ORG_INFO_ID); } ensureOrgContext({ force: true }) .then((ctx) => { if (cancelled) { return; } if (ctx?.networkError) { message.warning("机构信息加载失败,请确认后端服务已启动"); setChecking(false); return; } if (!ctx?.hasOrg) { message.warning("请先完善机构信息"); setBlocked(true); setChecking(false); return; } setChecking(false); }) .catch((err) => { console.warn("[QualApplication] ensureOrgContext failed:", err); if (!cancelled) { message.warning("机构信息加载失败,请确认后端服务已启动"); setChecking(false); } }); return () => { cancelled = true; }; }, []); if (checking) { return ; } if (blocked) { return (

资质申请管理需先完善机构信息,请前往「企业信息管理 → 机构信息管理」录入并保存。

); } return (
{props.children}
); } export default QualApplication;