From f996c7437b0a7d4e7bafeb7c71b7c86b7170c8bd Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 27 二月 2025 17:15:13 +0800 Subject: [PATCH] 地图图标展示 --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue | 60 +++++++++++++++++++++++++++--------------------------------- 1 files changed, 27 insertions(+), 33 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 66c202e..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,31 +1,22 @@ <template> - <div class="h-[60vh] relative"> + <div class="h-[60vh] relative" ref="mapContainerRef"> <!-- 鍘熷鍦板浘瀹瑰櫒 --> <BasicMap - ref="normalMapRef" - v-show="!isFullscreen" + 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" :config="fullScreenMapConfig" class="h-full" :data="data" @markerClick="markerClick" @closeInfoWindow="closeInfoWindow" /> - <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" @@ -36,6 +27,7 @@ :tableHeight="240" /> </div> + <SmallChat class="absolute bottom-0 right-[50%]" :olMap="olMap" /> </div> </Transition> </Teleport> @@ -44,19 +36,19 @@ <script setup lang="ts"> import 'ol/ol.css'; -import { nextTick, onDeactivated, onMounted, onUnmounted, ref } from 'vue'; +import { computed, nextTick, onDeactivated, onMounted, onUnmounted, ref } from 'vue'; import EquipCurve from '../components/EquipCurve.vue'; import BasicMap from './BasicMap.vue'; +import SmallChat from '/@/components/chat/smallChat/index.vue'; import { useCompRef } from '/@/utils/types'; -import { GaoDeSourceType } from '/@/model/map/OLMap'; -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 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); @@ -71,29 +63,30 @@ emit('closeInfoWindow'); } }; +const mapContainerRef = ref<HTMLDivElement>(null); - -const fullScreenMapConfig = ref({ - sourceType: GaoDeSourceType.Vector, - markerIsVisible: true, -}); // 鍒囨崲鍏ㄥ睆 const toggleFullScreen = async () => { + closeInfoWindow(); isFullscreen.value = !isFullscreen.value; - await nextTick(); if (isFullscreen.value) { - const config = normalMapRef.value.olMap.getConfig(); if (!isRenderFullscreen.value) { - fullScreenMapConfig.value = config; 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(); } }; @@ -121,6 +114,7 @@ onMounted(async () => { // 娣诲姞 ESC 閿洃鍚� document.addEventListener('keydown', handleEscKey); + // toggleFullScreen(); }); onDeactivated(async () => { -- Gitblit v1.9.3