From 4f33e1e616e2a59112a6265073124abd7f0e81ed Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期二, 25 二月 2025 16:00:27 +0800 Subject: [PATCH] 修改地图 --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue | 62 +++++++++++------------------- 1 files changed, 23 insertions(+), 39 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue index 52d3e07..8c57cec 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue @@ -1,42 +1,22 @@ <template> - <div class="h-[60vh] relative"> + <div class="h-[60vh] relative" ref="mapContainerRef"> <!-- 鍘熷鍦板浘瀹瑰櫒 --> <BasicMap - ref="normalMapRef" - v-show="!isFullscreen" - :isFullscreen="false" + ref="mapRef" + :isFullscreen="isFullscreen" class="h-full" :data="data" @markerClick="markerClick" @closeInfoWindow="closeInfoWindow" @toggleFullScreen="toggleFullScreen" - /> - <!-- 鍏ㄥ睆鎸夐挳 --> - <!-- <div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen"> - <el-tooltip content="鍏ㄥ睆灞曞紑" placement="top"> - <div class="ywifont !text-[20px] text-black rounded-lg ywicon-fullscreen"></div> - </el-tooltip> - </div> --> <!-- Teleport 鍏ㄥ睆鍦板浘 --> <Teleport to=".layout-parent"> <Transition name="fullscreen"> <div v-if="isRenderFullscreen" v-show="isFullscreen" class="absolute inset-0 z-50 w-full h-full"> - <BasicMap - ref="fullScreenMapRef" - :isFullscreen="true" - class="h-full" - :data="data" - @markerClick="markerClick" - @closeInfoWindow="closeInfoWindow" - @toggleFullScreen="toggleFullScreen" - /> - <!-- <div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen"> - <el-tooltip content="閫�鍑哄叏灞忥紙Esc锛�" placement="top"> - <div class="ywifont !text-[20px] text-black rounded-lg ywicon-tuichuquanping"></div> - </el-tooltip> - </div> --> + <div ref="fullscreenContainer" class="h-full"></div> + <div class="absolute bottom-0 w-full"> <EquipCurve v-model:isShow="chartDlgIsShow" @@ -47,7 +27,7 @@ :tableHeight="240" /> </div> - <SmallChat class="absolute bottom-0 right-[50%] " :olMap="fullScreenOlMap" /> + <SmallChat class="absolute bottom-0 right-[50%]" :olMap="olMap" /> </div> </Transition> </Teleport> @@ -60,17 +40,15 @@ import EquipCurve from '../components/EquipCurve.vue'; import BasicMap from './BasicMap.vue'; import SmallChat from '/@/components/chat/smallChat/index.vue'; -import { GaoDeSourceType } from '/@/model/map/OLMap'; import { useCompRef } from '/@/utils/types'; -const isRenderFullscreen = ref(false); +const isRenderFullscreen = ref(false); const isFullscreen = ref(false); const props = defineProps(['data']); -const normalMapRef = useCompRef(BasicMap); -const fullScreenMapRef = useCompRef(BasicMap); -const fullScreenOlMap = computed(() => fullScreenMapRef.value?.olMap); +const mapRef = useCompRef(BasicMap); +const fullscreenContainer = ref<HTMLElement>(); const emit = defineEmits(['equipClick', 'closeInfoWindow']); - +const olMap = computed(() => mapRef.value?.olMap); const markerClick = (row) => { if (isFullscreen.value) { showCurve(row); @@ -85,24 +63,30 @@ emit('closeInfoWindow'); } }; - +const mapContainerRef = ref<HTMLDivElement>(null); // 鍒囨崲鍏ㄥ睆 const toggleFullScreen = async () => { + closeInfoWindow(); isFullscreen.value = !isFullscreen.value; - await nextTick(); if (isFullscreen.value) { - const config = normalMapRef.value.olMap.getConfig(); if (!isRenderFullscreen.value) { isRenderFullscreen.value = true; - } else { - // fullScreenMapRef.value.olMap.setConfig(config); + await nextTick(); } + // 灏嗗湴鍥剧粍浠剁Щ鍔ㄥ埌鍏ㄥ睆瀹瑰櫒 + const mapEl = mapRef.value.$el; + fullscreenContainer.value.appendChild(mapEl); + // 鏇存柊鍦板浘澶у皬 + olMap.value?.updateSize(); closeInfoWindow(); } else { - const config = fullScreenMapRef.value.olMap.getConfig(); - // normalMapRef.value.olMap.setConfig(config); + // 灏嗗湴鍥剧粍浠剁Щ鍥炲師浣嶇疆 + const mapEl = mapRef.value.$el; + mapContainerRef.value.appendChild(mapEl); + // 鏇存柊鍦板浘澶у皬 + olMap.value?.updateSize(); } }; -- Gitblit v1.9.3