From a0ac379b28daeac8deddfae34f0015935a811bac Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 07 二月 2025 17:39:47 +0800 Subject: [PATCH] 修改细分网格的展示逻辑 --- src/views/satellitetelemetry/SatelliteTelemetry.vue | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/views/satellitetelemetry/SatelliteTelemetry.vue b/src/views/satellitetelemetry/SatelliteTelemetry.vue index 66ed9cc..bcbba00 100644 --- a/src/views/satellitetelemetry/SatelliteTelemetry.vue +++ b/src/views/satellitetelemetry/SatelliteTelemetry.vue @@ -1,6 +1,24 @@ <template> <el-row class="wrap"> <el-col span="2"> + <!-- <div class="p-events-auto"> + <el-button + type="primary" + class="el-button-custom" + size="small" + @click="previousGrid" + > + 涓婁竴涓� + </el-button> + <el-button + type="primary" + class="el-button-custom" + size="small" + @click="nextGrid" + > + 涓嬩竴涓� + </el-button> + </div> --> <el-row> <SatelliteManage v-show="show" @@ -41,7 +59,7 @@ import marks from '@/utils/map/marks'; import grid from '@/utils/map/grid'; -import { ref } from 'vue'; +import { ref, onMounted } from 'vue'; import gridApi from '@/api/gridApi'; import SatelliteManage from './component/SatelliteManage.vue'; import SatelliteDataMix from './component/SatelliteDataMix.vue'; @@ -49,9 +67,19 @@ import { useFetchData } from '@/composables/fetchData'; import { useSatelliteGridStore } from '@/stores/satellite-grid'; +// onMounted(() => { +// initDistrict(); +// }); // 鏌ヨ闀垮畞鍖鸿鏀垮尯鍒� +let polygon; function initDistrict() { onMapMounted(() => { + if (polygon) { + map.remove(polygon); + map.add(polygon); + map.setFitView(); + return + } // eslint-disable-next-line no-undef var district = new AMap.DistrictSearch({ extensions: 'all', //杩斿洖琛屾斂鍖鸿竟鐣屽潗鏍囩瓑鍏蜂綋淇℃伅 @@ -63,7 +91,7 @@ for (var i = 0; i < bounds.length; i++) { //鐢熸垚琛屾斂鍖哄垝 polygon // eslint-disable-next-line no-undef - var polygon = new AMap.Polygon({ + polygon = new AMap.Polygon({ map: map, //鏄剧ず璇ヨ鐩栫墿鐨勫湴鍥惧璞� strokeWeight: 3, //杞粨绾垮搴� path: bounds[i], //澶氳竟褰㈣疆寤撶嚎鐨勮妭鐐瑰潗鏍囨暟缁� @@ -95,8 +123,9 @@ // 鏌ヨ缃戞牸淇℃伅鍜岄仴鎰熸暟鎹粍 function onSearch(options) { satelliteGridStore.fetchGridCell(options.id).then(() => { + SatelliteProxy.clearText(mapViews); drawGrid(satelliteGridStore.gridInfo); - initDistrict(); + initDistrict() }); satelliteGridStore.fetchGridData(options.id).then(() => { max = satelliteGridStore.gridDataList.length; @@ -134,11 +163,30 @@ function drawGrid(gridInfo) { SatelliteProxy.clearAll(mapViews); mapViews = SatelliteProxy.drawPolyline(gridInfo); + // mapViews = SatelliteProxy.drawPolyline([gridInfo[0]]); +} + +let index = 0; +function previousGrid() { + index--; + if (index < 0) { + index = 0; + } + SatelliteProxy.clearAll(mapViews); + mapViews = SatelliteProxy.drawPolyline([satelliteGridStore.gridInfo[index]]); +} + +function nextGrid() { + index++; + if (index > satelliteGridStore.gridInfo.length - 1) { + index = satelliteGridStore.gridInfo.length - 1; + } + SatelliteProxy.clearAll(mapViews); + mapViews = SatelliteProxy.drawPolyline([satelliteGridStore.gridInfo[index]]); } // 缁樺埗缃戞牸閬ユ劅鏁版嵁鍊煎拰缃戞牸棰滆壊 function drawTextAndColor(gridData) { - // SatelliteProxy.clearText(mapViews); // 鏂囨湰鏍囪 const { textViews: dataTxt, labelsLayer: dataLayer } = SatelliteProxy.drawDataText( -- Gitblit v1.9.3