wujingjing
2025-01-15 575429031e6d2b90394e047b4ff38b541935c1b5
OLMap
已修改2个文件
41 ■■■■■ 文件已修改
src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/model/map/OLMap.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue
@@ -46,7 +46,7 @@
        <!-- Teleport 全屏地图 -->
        <Teleport to=".layout-parent">
            <Transition name="fullscreen">
                <div v-if="isFullscreen" class="absolute inset-0 z-50 w-full h-full">
                <div v-show="isFullscreen" class="absolute inset-0 z-50 w-full h-full">
                    <div ref="fullscreenContainerRef" class="w-full h-full"></div>
                    <div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen">
                        <el-tooltip content="退出全屏(Esc)" placement="top">
@@ -160,22 +160,6 @@
        },
    });
};
// 切换全屏
const toggleFullScreen = async () => {
    isFullscreen.value = !isFullscreen.value;
    // 等待 DOM 更新完成
    await nextTick();
    // 重新初始化地图
    if (isFullscreen.value) {
        closeInfoWindow();
        await initMap(fullscreenContainerRef.value);
    } else {
        // await initMap(containerRef.value);
    }
};
// 初始化地图
const initMap = async (container: HTMLDivElement) => {
    olMap = new OLMap({
@@ -185,6 +169,27 @@
    infoWindowOverlay = olMap.createEleOverlay(infoWindowRef.value);
    olMap.map.addOverlay(infoWindowOverlay);
};
let hasInitFullscreen = false;
// 切换全屏
const toggleFullScreen = async () => {
    isFullscreen.value = !isFullscreen.value;
    // 等待 DOM 更新完成
    await nextTick();
    // 重新初始化地图
    if (isFullscreen.value) {
        closeInfoWindow();
        if (!hasInitFullscreen) {
            await initMap(fullscreenContainerRef.value);
            hasInitFullscreen = true;
        } else {
            olMap.map.addOverlay(infoWindowOverlay);
        }
    } else {
        olMap.map.addOverlay(infoWindowOverlay);
    }
};
//#region ====================== 设备曲线 ======================
const chartDlgIsShow = ref(false);
const equipCurveMapRow = ref(null);
src/model/map/OLMap.ts
@@ -50,7 +50,7 @@
    private eventMap: Map<OLEventType, Function[]>;
    private emit(eventName: OLEventType, ...args: any[]) {
        const handlers = this.eventMap.get(eventName);
        const handlers = this.eventMap?.get(eventName);
        if (handlers) {
            handlers.forEach((handler) => handler(...args));
        }