From 4f1fb28dad6a4df83752dc9b60f504764f8e3dcb Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 03 一月 2025 10:08:54 +0800 Subject: [PATCH] 完善数据融合功能(未完成) --- src/views/satellitetelemetry/SatelliteTelemetry.vue | 177 ++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 122 insertions(+), 55 deletions(-) diff --git a/src/views/satellitetelemetry/SatelliteTelemetry.vue b/src/views/satellitetelemetry/SatelliteTelemetry.vue index 9260b30..fc74865 100644 --- a/src/views/satellitetelemetry/SatelliteTelemetry.vue +++ b/src/views/satellitetelemetry/SatelliteTelemetry.vue @@ -1,32 +1,42 @@ <template> - <div> - <!-- <el-button - class="p-events-auto" - type="info" - icon="Memo" - plain - @click="draw" - > - 缁樺埗缃戞牸 - </el-button> --> - <SatelliteManage - class="satellite-manage" - :gridDataList="gridDataList" - :loading="loading" - @search="onSearch" - @row-click="handleRowClick" - ></SatelliteManage> - <el-row class="historical" justify="center"> - <SatelliteAnimation - :loading="animaLoading" - :grid-data="gridDataDetailList" - :mapViews="mapViews" - ></SatelliteAnimation> - </el-row> - </div> + <el-row class="wrap"> + <el-col span="2"> + <el-row> + <SatelliteManage + v-show="show" + class="satellite-manage" + :gridDataList="satelliteGridStore.gridDataList" + :loading="loading" + @search="onSearch" + @row-click="handleRowClick" + @show-rank="handleRankClick" + @show-data="handleDataClick" + @change-color="handleColorClick" + ></SatelliteManage> + </el-row> + </el-col> + <el-col span="2"> + <el-row> + <CardButton + name="鍗槦閬ユ祴鏁版嵁" + direction="right" + @click="() => (show = !show)" + ></CardButton> + </el-row> + </el-col> + </el-row> + <SatelliteDataMix class="data-mix" @mix-data="handleMixDataClick"> + </SatelliteDataMix> + <!-- <el-row class="historical" justify="center"> + <SatelliteAnimation + :loading="animaLoading" + :grid-data="gridDataDetailList" + :mapViews="mapViews" + ></SatelliteAnimation> + </el-row> --> </template> <script setup> -import { map } from '@/utils/map/index_old'; +import { map, onMapMounted } from '@/utils/map/index_old'; import calculate from '@/utils/map/calculate'; import marks from '@/utils/map/marks'; import grid from '@/utils/map/grid'; @@ -34,15 +44,44 @@ import { ref } from 'vue'; import gridApi from '@/api/gridApi'; import SatelliteManage from './component/SatelliteManage.vue'; +import SatelliteDataMix from './component/SatelliteDataMix.vue'; import SatelliteProxy from './SatelliteProxy'; import { useFetchData } from '@/composables/fetchData'; +import { useSatelliteGridStore } from '@/stores/satellite-grid'; +// 鏌ヨ闀垮畞鍖鸿鏀垮尯鍒� +onMapMounted(()=>{ + // eslint-disable-next-line no-undef + var district = new AMap.DistrictSearch({ + extensions: "all", //杩斿洖琛屾斂鍖鸿竟鐣屽潗鏍囩瓑鍏蜂綋淇℃伅 + level: "district", //璁剧疆鏌ヨ琛屾斂鍖虹骇鍒负鍖� + }); + district.search("闀垮畞鍖�", function (status, result) { + var bounds = result.districtList[0].boundaries; //鑾峰彇鏈濋槼鍖虹殑杈圭晫淇℃伅 + if (bounds) { + for (var i = 0; i < bounds.length; i++) { + //鐢熸垚琛屾斂鍖哄垝 polygon + // eslint-disable-next-line no-undef + var polygon = new AMap.Polygon({ + map: map, //鏄剧ず璇ヨ鐩栫墿鐨勫湴鍥惧璞� + strokeWeight: 3, //杞粨绾垮搴� + path: bounds[i], //澶氳竟褰㈣疆寤撶嚎鐨勮妭鐐瑰潗鏍囨暟缁� + fillOpacity: 0.1, //澶氳竟褰㈠~鍏呴�忔槑搴� + fillColor: "#CCF3FF", //澶氳竟褰㈠~鍏呴鑹� + // strokeColor: "#CC66CC", //绾挎潯棰滆壊 + strokeColor: "#0066ff", //绾挎潯棰滆壊 + }); + } + map.setFitView(); //灏嗚鐩栫墿璋冩暣鍒板悎閫傝閲� + } + }); +}) + +const satelliteGridStore = useSatelliteGridStore(); const { loading, fetchData } = useFetchData(10000); const animaLoading = ref(true); -// 缃戞牸淇℃伅 -let gridInfo = []; -// 缃戞牸鏁版嵁缁� -const gridDataList = ref([]); +const show = ref(true); + let count = 0, max = 0; // 缃戞牸鏁版嵁璇︽儏 @@ -53,27 +92,12 @@ // 鏌ヨ缃戞牸淇℃伅鍜岄仴鎰熸暟鎹粍 function onSearch(options) { - fetchGridCell(options.id); - fetchGridData(options.id); -} - -// 鑾峰彇缃戞牸淇℃伅 -function fetchGridCell(groupId) { - return fetchData(() => { - return gridApi.fetchGridCell(groupId).then((res) => { - gridInfo = res.data; - drawGrid(gridInfo); - }); + satelliteGridStore.fetchGridCell(options.id).then(() => { + drawGrid(satelliteGridStore.gridInfo); }); -} - -// 鑾峰彇閬ユ劅鏁版嵁缁� -function fetchGridData(groupId) { - return gridApi.fetchGridData(groupId).then((res) => { - gridDataList.value = res.data; - count = 0; - max = res.data.length; - fetchGridDataDetail(res.data); + satelliteGridStore.fetchGridData(options.id).then(()=>{ + max = satelliteGridStore.gridDataList.length + fetchGridDataDetail(satelliteGridStore.gridDataList) }); } @@ -113,25 +137,61 @@ function drawTextAndColor(gridData) { // SatelliteProxy.clearText(mapViews); // 鏂囨湰鏍囪 - mapViews.textViews = SatelliteProxy.drawDataText( - mapViews.points, - gridData, - mapViews.textViews - ); + const { textViews: dataTxt, labelsLayer: dataLayer } = + SatelliteProxy.drawDataText( + mapViews.points, + gridData, + mapViews.dataTxt, + mapViews.dataLayer + ); + mapViews.dataTxt = dataTxt; + mapViews.dataLayer = dataLayer; + const { textViews: rankTxt, labelsLayer: rankLayer } = + SatelliteProxy.drawRankText( + mapViews.points, + gridData, + mapViews.rankTxt, + mapViews.rankLayer + ); + mapViews.rankTxt = rankTxt; + mapViews.rankLayer = rankLayer; SatelliteProxy.drawColor(mapViews.gridViews, gridData); } +let selectedGridData; function handleRowClick(row) { if (gridDataDetailMap.has(row.id)) { const gridData = gridDataDetailMap.get(row.id); + selectedGridData = gridData; drawTextAndColor(gridData); } else { gridApi.fetchGridDataDetail(row.id, row.groupId).then((res) => { gridDataDetailMap.set(row.id, res.data); const gridData = res.data; + selectedGridData = gridData; drawTextAndColor(gridData); }); } +} + +function handleRankClick(rankVisible) { + rankVisible ? map.add(mapViews.rankLayer) : map.remove(mapViews.rankLayer); +} + +function handleDataClick(dataVisible) { + dataVisible ? map.add(mapViews.dataLayer) : map.remove(mapViews.dataLayer); +} + +function handleColorClick(isStandardColor) { + SatelliteProxy.drawColor( + mapViews.gridViews, + selectedGridData, + !isStandardColor + ); +} + +function handleMixDataClick(gridData) { + handleRowClick(gridData); } </script> <style scoped> @@ -143,5 +203,12 @@ bottom: 10px; left: 0; right: 0; + color: #0066ff; +} + +.data-mix { + position: absolute; + right: 0; + top: 60px; } </style> -- Gitblit v1.9.3