feat(Map): 优化分公司信息展示及数据请求流程

- 修改分公司所属行业字段展示,串联多个分类名称
- 新增接口请求方法 getCorpInfoListAll,用于获取全部企业信息
- 在地图组件中集成接口请求,用于获取分公司数据
- 增加加载中状态指示,提升用户体验
- 调整分公司点数据来源,替换静态点数据为接口数据
- 优化地图初始化逻辑,支持传入接口请求配置
- 修改弹窗点击事件,传递完整分公司数据避免额外请求
- 调整底
master
LiuJiaNan 2026-07-20 20:02:52 +08:00
parent 3145aae56b
commit 226b0a7350
7 changed files with 26 additions and 353 deletions

View File

@ -56,3 +56,7 @@ export const getCorpInfoCorpUserStatisticPage = declareRequest(
"portIndexBasicInfoStatisticPageLoading", "portIndexBasicInfoStatisticPageLoading",
"Post > @/basicInfo/corpInfo/corpUserStatisticPage", "Post > @/basicInfo/corpInfo/corpUserStatisticPage",
); );
export const getCorpInfoListAll = declareRequest(
"biFullLoading",
"Get > /basicInfo/corpInfo/listAll",
);

View File

@ -3,12 +3,12 @@
width: 1000px; width: 1000px;
//height: 168px; //height: 168px;
position: absolute; position: absolute;
bottom: 30px;
left: calc(50% - 500px); left: calc(50% - 500px);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
&.port { &.port {
top: 920px;
.option { .option {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
@ -90,6 +90,7 @@
} }
&.branch_office { &.branch_office {
top: 1020px;
.option { .option {
position: relative; position: relative;
cursor: pointer; cursor: pointer;

View File

@ -34,7 +34,7 @@ const BranchOffice = ({ info, close, enter }) => {
<div className="data-label textColor">所属行业</div> <div className="data-label textColor">所属行业</div>
<div className="data-value"> <div className="data-value">
<span className="label-num textColor line-3"> <span className="label-num textColor line-3">
{info?.industryNames} {[info?.corpTypeName, info?.corpType2Name, info?.corpType3Name, info?.corpType4Name].filter(Boolean).join("/")}
</span> </span>
</div> </div>
</div> </div>

View File

@ -1,8 +1,10 @@
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { useFullscreen, useMount } from "ahooks"; import { useFullscreen, useMount } from "ahooks";
import { message } from "antd"; import { message, Spin } from "antd";
import autoFit from "autofit.js"; import autoFit from "autofit.js";
import { useEffect, useMemo, useReducer, useRef, useState } from "react"; import { useEffect, useMemo, useReducer, useRef, useState } from "react";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import { NS_BI } from "~/enumerate/namespace";
import BottomUtils from "./components/BottomUtils"; import BottomUtils from "./components/BottomUtils";
import CenterUtils from "./components/CenterUtils"; import CenterUtils from "./components/CenterUtils";
import Content from "./components/Content"; import Content from "./components/Content";
@ -23,7 +25,11 @@ import "./index.less";
function Map(props) { function Map(props) {
const query = useGetUrlQuery(); const query = useGetUrlQuery();
const { viewer, mapMethods, initMap, externalEntryPort } = useInitMap(); const { viewer, mapMethods, initMap, externalEntryPort } = useInitMap({
request: {
getCorpInfoListAll: props.getCorpInfoListAll,
},
});
const [isRenderContent, setIsRenderContent] = useState(false); const [isRenderContent, setIsRenderContent] = useState(false);
const fullscreenRef = useRef(null); // 全屏容器的ref const fullscreenRef = useRef(null); // 全屏容器的ref
@ -112,14 +118,14 @@ function Map(props) {
<div id="cesiumContainer" /> <div id="cesiumContainer" />
<div id="contentContainer"> <div id="contentContainer">
{isRenderContent && ( {isRenderContent && (
<> <Spin spinning={props.bi.biFullLoading}>
<Header /> <Header />
<CenterUtils /> <CenterUtils />
<RightUtils history={props.history} isFullscreen={isFullscreen} toggleFullscreen={toggleFullscreen} /> <RightUtils history={props.history} isFullscreen={isFullscreen} toggleFullscreen={toggleFullscreen} />
<BottomUtils /> <BottomUtils />
<Content history={props.history} /> <Content history={props.history} />
<CustomModal /> <CustomModal />
</> </Spin>
)} )}
</div> </div>
</Context.Provider> </Context.Provider>
@ -132,4 +138,4 @@ function Map(props) {
); );
} }
export default Map; export default Connect([NS_BI], true)(Map);

View File

@ -5,10 +5,10 @@ import usePointClickEvent from "./pointClickEvent";
const Cesium = window.Cesium; const Cesium = window.Cesium;
export default function useInitMap() { export default function useInitMap(options) {
// 页面和地图工具共用同一个 Cesium 引用,避免内外各维护一份实例。 // 页面和地图工具共用同一个 Cesium 引用,避免内外各维护一份实例。
const viewer = useRef(null); const viewer = useRef(null);
const mapMethodsValue = useMapMethods(viewer); const mapMethodsValue = useMapMethods(viewer, options.request);
// Context 下游仍按 ref.current 调用地图方法,因此保留原有数据结构。 // Context 下游仍按 ref.current 调用地图方法,因此保留原有数据结构。
const mapMethods = useRef(mapMethodsValue); const mapMethods = useRef(mapMethodsValue);
mapMethods.current = mapMethodsValue; mapMethods.current = mapMethodsValue;

View File

@ -53,347 +53,9 @@ const portPoint = [
}, },
]; ];
const BranchOfficePoint = [
{
corpName: "秦港股份有限公司",
longitude: "",
corpinfoId: "1",
latitude: "",
mapPointName: "秦港股份有限公司",
},
{
corpName: "秦皇岛港新益港务有限公司12",
longitude: "117.81722012173059",
corpinfoId: "035958e685cf4850bc40151c5e0617a6",
latitude: "40.16437937435123",
mapPointName: "秦皇岛港新益港务有限公司12",
},
{
corpName: "测试测试0527-1",
longitude: "118.95108477670387",
corpinfoId: "8ab3328e42974f338942d0506b58d8f3",
latitude: "40.69968157498669",
mapPointName: "测试测试0527-1",
},
{
corpName: "1122公司测试隐患考评",
longitude: "",
corpinfoId: "805c21b0fccb49aba0c409e4eccbfd59",
latitude: "",
mapPointName: "1122公司测试隐患考评",
},
{
corpName: "秦港股份二公司",
longitude: "119.63521",
corpinfoId: "17973964c87346e7a4a737cf252557d9",
latitude: "39.92944",
mapPointName: "秦港股份二公司",
},
{
corpName: "55555",
longitude: "",
corpinfoId: "cdadd26e8fb74ce6a683bc0e5aa69e99",
latitude: "",
mapPointName: "55555",
},
{
corpName: "秦港股份六公司",
longitude: "119.67186",
corpinfoId: "97b87eba9f9c49a0a917c1f412016fb1",
latitude: "39.94193",
mapPointName: "秦港股份六公司",
},
{
corpName: "测试企业信息",
longitude: "",
corpinfoId: "e43c5aeaf9694df3aeddef71654c8cf2",
latitude: "",
mapPointName: "测试企业信息",
},
{
corpName: "秦港股份七公司",
longitude: "119.67172",
corpinfoId: "286dcae730aa43ba82c97a676f9d8ee2",
latitude: "39.94342",
mapPointName: "秦港股份七公司",
},
{
corpName: "秦港股份九公司",
longitude: "119.67623",
corpinfoId: "21590a00ea5e462e9ee44dd332dddc26",
latitude: "39.93108",
mapPointName: "秦港股份九公司",
},
{
corpName: "秦港股份杂货公司",
longitude: "119.58103",
corpinfoId: "033549ed3bd648e49c8a65eb4993ec2f",
latitude: "39.91532",
mapPointName: "秦港股份杂货公司",
},
{
corpName: "秦港股份铁运公司",
longitude: "119.63189",
corpinfoId: "66131d4e5c8f4c8893b80975dca39ac3",
latitude: "39.94252",
mapPointName: "秦港股份铁运公司",
},
{
corpName: "秦港股份流机公司",
longitude: "119.587",
corpinfoId: "f1478d64109445948d819beb6c1b52ee",
latitude: "39.91472",
mapPointName: "秦港股份流机公司",
},
{
corpName: "秦港股份电力公司",
longitude: "119.5996970027171",
corpinfoId: "f21cf733f1354503865af705ecc8dba2",
latitude: "39.919168362236874",
mapPointName: "秦港股份电力公司",
},
{
corpName: "秦港股份船舶公司",
longitude: "119.61417",
corpinfoId: "d7e15394923740bf979efd8c0105063b",
latitude: "39.92033",
mapPointName: "秦港股份船舶公司",
},
{
corpName: "0507-1",
longitude: "119.65480053930092",
corpinfoId: "a29620da401b4f05a73d9f7d629030c5",
latitude: "39.922427338021684",
mapPointName: "0507-1",
},
{
corpName: "秦港股份综服中心",
longitude: "119.62629",
corpinfoId: "c4e000a8245843ad82f8e172ce063671",
latitude: "39.9319",
mapPointName: "秦港股份综服中心",
},
{
corpName: "秦港物资中心",
longitude: "119.66925",
corpinfoId: "9595235dfa334b2898a0e75d160418fa",
latitude: "39.93953",
mapPointName: "秦港物资中心",
},
{
corpName: "秦港教培中心",
longitude: "119.58357",
corpinfoId: "0407e689f75746358326f040e59d1e32",
latitude: "39.92007",
mapPointName: "秦港教培中心",
},
{
corpName: "秦港行政中心",
longitude: "119.59925",
corpinfoId: "bca641ac9978474987b3f0377f82359e",
latitude: "39.91755",
mapPointName: "秦港行政中心",
},
{
corpName: "秦港餐饮中心",
longitude: "119.60255",
corpinfoId: "4e1b8e11c2a94d9eac8cfa07145f9f69",
latitude: "39.91895",
mapPointName: "秦港餐饮中心",
},
{
corpName: "工程项目中心",
longitude: "",
corpinfoId: "7b00458c903a4460aeeb3c189dde7ebb",
latitude: "",
mapPointName: "工程项目中心",
},
{
corpName: "秦港技术中心",
longitude: "119.58399",
corpinfoId: "6692f5f1f14c4544b9f7ca7a59d065db",
latitude: "39.91774",
mapPointName: "秦港技术中心",
},
{
corpName: "河北港口集团数联科技(雄安)有限公司",
longitude: "",
corpinfoId: "5cee11f6152d42e0a08ae38dc6abcfdf",
latitude: "",
mapPointName: "河北港口集团数联科技(雄安)有限公司",
},
{
corpName: "秦港新闻中心",
longitude: "",
corpinfoId: "8d97ef3051724e968024be1e6e6779ba",
latitude: "",
mapPointName: "秦港新闻中心",
},
{
corpName: "秦港财务中心",
longitude: "",
corpinfoId: "7abd8156caa14229bcabc382309e2e94",
latitude: "",
mapPointName: "秦港财务中心",
},
{
corpName: "秦港审计中心",
longitude: "",
corpinfoId: "e2a121b54b8a44569726b12b47f6c2ed",
latitude: "",
mapPointName: "秦港审计中心",
},
{
corpName: "沧州黄骅港矿石港务有限公司",
longitude: "117.8291",
corpinfoId: "f8da1790b1034058ae2efefd69af3284",
latitude: "38.3223",
mapPointName: "沧州黄骅港矿石港务有限公司",
},
{
corpName: "唐山曹妃甸煤炭港务有限公司",
longitude: "118.44159",
corpinfoId: "6aa255d41602497fa0f934a822820df4",
latitude: "38.98158",
mapPointName: "唐山曹妃甸煤炭港务有限公司",
},
{
corpName: "唐山曹妃甸实业港务有限公司",
longitude: "118.53903",
corpinfoId: "8854edee3aa94be496cee676b6d4845a",
latitude: "38.94306",
mapPointName: "唐山曹妃甸实业港务有限公司",
},
{
corpName: "秦皇岛中理",
longitude: "119.61138",
corpinfoId: "e52f138ca0444c55bdae2a429e3cdbfe",
latitude: "39.91428",
mapPointName: "秦皇岛中理",
},
{
corpName: "沧州黄骅港散货港务有限公司",
longitude: "",
corpinfoId: "84a6206738ac4703b277d6245ec111ec",
latitude: "",
mapPointName: "沧州黄骅港散货港务有限公司",
},
{
corpName: "秦山港务",
longitude: "119.69864",
corpinfoId: "1fc6f50705de4fd6a76e80f2fc6e4720",
latitude: "39.93794",
mapPointName: "秦山港务",
},
{
corpName: "唐曹铁路有限公司(小集物流)",
longitude: "",
corpinfoId: "fb6c1a78bc414f109269a677e19a8a80",
latitude: "",
mapPointName: "唐曹铁路有限公司(小集物流)",
},
{
corpName: "新港湾(托管)",
longitude: "119.57749",
corpinfoId: "3baaa68e74514a649338baf8c88b565b",
latitude: "39.90205",
mapPointName: "新港湾(托管)",
},
{
corpName: "沧州黄骅港原油港务有限公司",
longitude: "",
corpinfoId: "fa88fb8186f74c7b995c4f4622379d3b",
latitude: "",
mapPointName: "沧州黄骅港原油港务有限公司",
},
{
corpName: "河北唐山曹妃甸冀同港口有限公司",
longitude: "",
corpinfoId: "5818906b74714c86b697abc8ca23e1a7",
latitude: "",
mapPointName: "河北唐山曹妃甸冀同港口有限公司",
},
{
corpName: "河港港工",
longitude: "119.60725",
corpinfoId: "3a854eefa7894e06aaa1a2611bca80f6",
latitude: "39.92514",
mapPointName: "河港港工",
},
{
corpName: "河港机械",
longitude: "119.65135983055092",
corpinfoId: "1e6dbbe16004402f8d2c0e52afd9a676",
latitude: "39.93524462021923",
mapPointName: "河港机械",
},
{
corpName: "河港城发",
longitude: "",
corpinfoId: "f42d930a7e694123a2d6ad3e546ba695",
latitude: "",
mapPointName: "河港城发",
},
{
corpName: "方宇物业",
longitude: "",
corpinfoId: "90966974de3c4b83aca6f8fd6432d5c2",
latitude: "",
mapPointName: "方宇物业",
},
{
corpName: "河港检测",
longitude: "119.58435",
corpinfoId: "020578a4c1f04bc692ee25145c2efbe5",
latitude: "39.91774",
mapPointName: "河港检测",
},
{
corpName: "测试分公司22354",
longitude: "119.59401996313625",
corpinfoId: "8ac5c5fb138e4828a81ada5849246c80",
latitude: "39.95368714225534",
mapPointName: "测试分公司22354",
},
{
corpName: "测试分公司26201",
longitude: "119.24647177465056",
corpinfoId: "1c3794fa9ae048288585d7a9fafd44d3",
latitude: "39.928680261541466",
mapPointName: "测试分公司26201",
},
{
corpName: "0508-11",
longitude: "",
corpinfoId: "23b0759ebefe413dbc439dc978ed8506",
latitude: "",
mapPointName: "0508-11",
},
{
corpName: "卓云企业",
longitude: "119.44612949064937",
corpinfoId: "13cf0f4ec77e4d98ae8cdd9c3386ae0c",
latitude: "39.91957983420952",
mapPointName: "卓云企业",
},
{
corpName: "0620-1",
longitude: "",
corpinfoId: "f32a6ef1b45e42278dfecd3a5327cdf5",
latitude: "",
mapPointName: "0620-1",
},
{
corpName: "0508-12",
longitude: "",
corpinfoId: "d4be61ffb6554e4085c1dd419d264331",
latitude: "",
mapPointName: "0508-12",
},
];
const Cesium = window.Cesium; const Cesium = window.Cesium;
export default function useMapMethods(viewerRef) { export default function useMapMethods(viewerRef, request) {
// 获取当前 Cesium 实例:初始化前为空,地图方法会在 initMap 完成后被调用。 // 获取当前 Cesium 实例:初始化前为空,地图方法会在 initMap 完成后被调用。
const getViewer = () => viewerRef.current; const getViewer = () => viewerRef.current;
@ -467,11 +129,12 @@ export default function useMapMethods(viewerRef) {
}; };
// 添加分公司点 // 添加分公司点
const addBranchOfficePoint = async (portArea = "", pointInfo = null) => { const addBranchOfficePoint = async (portArea = 1, pointInfo = null) => {
const { data } = await request.getCorpInfoListAll({ portArea, inType: [0, 1, 6] });
mitt.emit(changeCoverMaskVisibleMittKey, true); mitt.emit(changeCoverMaskVisibleMittKey, true);
let branchOfficePoint = []; let branchOfficePoint = [];
if (!pointInfo) { if (!pointInfo) {
branchOfficePoint = filterNull(BranchOfficePoint); branchOfficePoint = filterNull(data);
} }
else { else {
branchOfficePoint = filterNull([pointInfo]); branchOfficePoint = filterNull([pointInfo]);

View File

@ -87,14 +87,13 @@ export default function usePointClickEvent(viewerRef, mapMethods) {
const clickBranchOfficePoint = async (data) => { const clickBranchOfficePoint = async (data) => {
if (data.id === sessionStorage.getItem("mapCurrentBranchOfficeId")) if (data.id === sessionStorage.getItem("mapCurrentBranchOfficeId"))
return; return;
// const { info } = await getCorpInfo({ id: data.id });
const info = {};
const position = getPosition(data.longitude, data.latitude); const position = getPosition(data.longitude, data.latitude);
popupRef.current = new PopupInfo(getViewer(), { popupRef.current = new PopupInfo(getViewer(), {
component: BranchOffice, component: BranchOffice,
position, position,
props: { props: {
info, info: data,
close: closePopup, close: closePopup,
enter: () => { enter: () => {
clickBranchOfficePointEnter(data); clickBranchOfficePointEnter(data);