diff --git a/frontend/src/api/mapModal/index.ts b/frontend/src/api/mapModal/index.ts index 748784b1..c7a7e0f5 100644 --- a/frontend/src/api/mapModal/index.ts +++ b/frontend/src/api/mapModal/index.ts @@ -70,7 +70,7 @@ export function getStInfoByStcd(params: any) { // 检查电站是否有专题配置数据 export function checkPowerStationTopic(data: any) { return request({ - url: '/api/wmp-sys-server/sys/psbmodulelbb/GetKendoList', + url: '/sys/psbmodulelbb/GetKendoListCust', method: 'post', data }); diff --git a/frontend/src/components/MapModal/index.vue b/frontend/src/components/MapModal/index.vue index 8773b3c1..504e33cc 100644 --- a/frontend/src/components/MapModal/index.vue +++ b/frontend/src/components/MapModal/index.vue @@ -301,7 +301,7 @@ import { checkPowerStationTopic } from '@/api/mapModal'; import { useDraggable } from '@/utils/drag'; -// import { useRouter } from 'vue-router'; +import { useRouter } from 'vue-router'; const modelStore = useModelStore(); const tabsConfig = ref([]); @@ -322,7 +322,7 @@ const isJiangJu = computed(() => { // TODO: 根据实际路由判断逻辑修改 return false; }); -// const router = useRouter(); +const router = useRouter(); /** * 查询电站是否有专题配置数据 @@ -348,7 +348,8 @@ const checkPowerStationTopicData = async (stcd: string) => { ] } }); - hasPowerStatData.value = res?.data?.data && res?.data?.data?.length > 0; + // debugger + hasPowerStatData.value = res?.data && res?.data?.length > 0; } catch (error) { console.error('查询电站专题配置失败:', error); hasPowerStatData.value = false; @@ -359,25 +360,13 @@ const checkPowerStationTopicData = async (stcd: string) => { * 跳转到电站专题页面 */ const gotoEngTopic = () => { - // TODO: 等待电站专题页面创建后,取消注释以下代码 - /* - const url = `/qgc-biz-home/${hbbSearchParams}`; - const menu = { - id: 'dianZhanZhuanTi', - url, - name: '电站专题' - }; - - // 缓存当前电站 stcd(跳转后页面会读取) - localStorage.setItem('modalSelectedEngTopic', JSON.stringify({ stcd: modelStore.params.stcd })); - - // 关闭弹窗 + const stcd = modelStore.params?.stcd; + if (!stcd) return; + router.push({ + path: '/dianZhanZhuanTi/dianZhanZhuanTi', + query: { stcd } + }); handleClose(); - - // 使用 Vue Router 跳转 - // router.push(url); - */ - console.log('电站专题跳转(暂未实现):', modelStore.params.stcd); }; // 环境判断变量(与 React 版本对齐) diff --git a/frontend/src/views/dianZhanZhuanTi/dianZhanZhuanTi.vue b/frontend/src/views/dianZhanZhuanTi/dianZhanZhuanTi.vue index 989b6ef5..7d517816 100644 --- a/frontend/src/views/dianZhanZhuanTi/dianZhanZhuanTi.vue +++ b/frontend/src/views/dianZhanZhuanTi/dianZhanZhuanTi.vue @@ -173,10 +173,11 @@ function onTreeSelect(value: any, item: any) { waitForMapReady(() => { setTimeout(() => { if ((window as any).mapClass) { - (window as any).mapClass.flyTopanto([item.lgtd, item.lttd], 14); + (window as any).mapClass.flyTopanto([Number(item.lgtd), Number(item.lttd)], 12); } }, 0); }); + nextTick(collapseLegend); } /** 在树数据中查找叶子节点对应的父节点(基地级)code */ @@ -260,7 +261,7 @@ watch( watch( () => layoutData.value, (val) => { - if (val?.type) { + if (val?.type && uiStore.mapType !== '3D') { const sk = LAYOUT_GRID_SKELETONS[val.type]; const rows = sk?.gridTemplateRows?.split(' ') || []; const bottomRowHeight = rows[rows.length - 1]; @@ -272,21 +273,30 @@ watch( // ==================== 地图控件位置重置 ==================== function resetMapControlPositions() { - ['#qgc-legendtl', '#map-filter-container', '#map-compassControl', '#map-controller', '#map-monitor', '#map-baselayer'].forEach(sel => { + const legend = document.querySelector('#qgc-legendtl') as HTMLElement; + const controller = document.querySelector('#map-controller') as HTMLElement; + const baselayer = document.querySelector('#map-baselayer') as HTMLElement; + if (legend) { legend.style.left = '0px'; legend.style.bottom = '0px'; } + if (controller) { controller.style.right = '12px'; controller.style.bottom = '114px'; } + if (baselayer) { baselayer.style.right = '60px'; baselayer.style.bottom = '0px'; } + ['#map-filter-container', '#map-compassControl', '#map-monitor'].forEach(sel => { const el = document.querySelector(sel) as HTMLElement; - if (el) { - el.style.left = ''; - el.style.right = ''; - el.style.bottom = ''; - } + if (el) { el.style.left = ''; el.style.right = ''; el.style.bottom = ''; } }); } +/** 收缩图例(仅在展开时点击收起按钮) */ +function collapseLegend() { + const icon = document.querySelector('.legendBtn .icon-fold') as HTMLElement; + icon?.parentElement?.click(); +} + // ==================== 监听 3D/2D 切换 ==================== watch( () => uiStore.mapType, (newType) => { showLayout.value = newType !== '3D'; + nextTick(collapseLegend); } ); @@ -299,17 +309,27 @@ watch( resetMapControlPositions(); const station = dianZhanStation.value; if (station) { - const mc = (window as any).mapClass; - mc?.flyTopanto?.([station.lgtd, station.lttd], 14); + + nextTick(() => { + requestAnimationFrame(() => { + const mc = (window as any).mapClass; + mc?.flyTopanto?.([Number(station.lgtd), Number(station.lttd)], 12); + }); + }); } } else if (showLayout.value) { - // 3D → 2D 完成:重定位控件 + 切回影像底图 + // 3D → 2D 完成:重定位控件 + 飞到当前电站 + 切回影像底图 if (layoutData.value?.type) { const sk = LAYOUT_GRID_SKELETONS[layoutData.value.type]; const rows = sk?.gridTemplateRows?.split(' ') || []; nextTick(() => setMapLegendPos(layoutData.value!.type, layoutData.value, 460, rows[rows.length - 1])); } switchToSatellite(); + const station = dianZhanStation.value; + if (station) { + const mc = (window as any).mapClass; + mc?.flyTopanto?.([Number(station.lgtd), Number(station.lttd)], 14); + } } } );