style(map): bug:19705、19707

master
LiuJiaNan 2026-07-24 17:07:45 +08:00
parent f23b8d0f0d
commit 297714ce08
4 changed files with 12 additions and 8 deletions

View File

@ -16,11 +16,12 @@ const headerAnimation = {
}; };
function Header() { function Header() {
const { currentPort, currentBranchOffice, mapMethods, portArea, headerTitle, actions } = useContext(Context); const { currentPort, currentBranchOffice, mapMethods, portArea, headerTitle, actions, closePopup } = useContext(Context);
const isPortTitle = headerTitle === "秦港股份安全监管平台"; const isPortTitle = headerTitle === "秦港股份安全监管平台";
const onBack = () => { const onBack = () => {
closePopup();
sessionStorage.removeItem("mapCurrentBranchOfficeId"); sessionStorage.removeItem("mapCurrentBranchOfficeId");
if (!currentPort) { if (!currentPort) {
window.close(); window.close();

View File

@ -42,7 +42,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?.address} {info?.addressBusiness}
</span> </span>
</div> </div>
</div> </div>

View File

@ -25,7 +25,7 @@ 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, closePopup } = useInitMap({
request: { request: {
getCorpInfoListAll: props.getCorpInfoListAll, getCorpInfoListAll: props.getCorpInfoListAll,
}, },
@ -108,8 +108,8 @@ function Map(props) {
}, []); }, []);
const providerValues = useMemo( const providerValues = useMemo(
() => ({ viewer, mapMethods, ...state, actions }), () => ({ viewer, mapMethods, closePopup, ...state, actions }),
[viewer, mapMethods, state, actions], [viewer, mapMethods, closePopup, state, actions],
); );
return ( return (

View File

@ -14,6 +14,8 @@ export default function useInitMap(options) {
mapMethods.current = mapMethodsValue; mapMethods.current = mapMethodsValue;
// 点位点击处理集合:替代原 PointClickEvent class 实例,负责弹窗和层级进入。 // 点位点击处理集合:替代原 PointClickEvent class 实例,负责弹窗和层级进入。
const pointClickEvent = usePointClickEvent(viewer, mapMethodsValue); const pointClickEvent = usePointClickEvent(viewer, mapMethodsValue);
// Cesium 点击事件只在初始化时注册,必须始终使用首次创建的处理器,才能关闭其维护的 Popup 实例。
const pointClickEventRef = useRef(pointClickEvent);
// 获取当前 Cesium 实例,减少内部方法对 ref 结构的重复感知。 // 获取当前 Cesium 实例,减少内部方法对 ref 结构的重复感知。
const getViewer = () => viewer.current; const getViewer = () => viewer.current;
@ -56,10 +58,10 @@ export default function useInitMap(options) {
screenSpaceEventHandler.setInputAction((movement) => { screenSpaceEventHandler.setInputAction((movement) => {
const pick = getViewer().scene.pick(movement.position); const pick = getViewer().scene.pick(movement.position);
if (Cesium.defined(pick) && pick.id?.id) { if (Cesium.defined(pick) && pick.id?.id) {
pointClickEvent.pointClickEvent(pick.id); pointClickEventRef.current.pointClickEvent(pick.id);
} }
else { else {
pointClickEvent.closePopup(); pointClickEventRef.current.closePopup();
} }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK); }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}; };
@ -143,7 +145,7 @@ export default function useInitMap(options) {
if (!id || !name || !hasValidPosition) if (!id || !name || !hasValidPosition)
return false; return false;
pointClickEvent.pointClickEvent({ pointClickEventRef.current.pointClickEvent({
monitorItems: { monitorItems: {
data: { data: {
...data, ...data,
@ -164,5 +166,6 @@ export default function useInitMap(options) {
mapMethods, mapMethods,
initMap, initMap,
externalEntryPort, externalEntryPort,
closePopup: () => pointClickEventRef.current.closePopup(),
}; };
} }