¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | | </template> |
| | | <script setup> |
| | | import { map } from '@/utils/map/index_old'; |
| | | import calculate from '@/utils/map/calculate'; |
| | | import marks from '@/utils/map/marks'; |
| | | import grid from '@/utils/map/grid'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import gridApi from '@/api/gridApi'; |
| | | import SatelliteManage from './component/SatelliteManage.vue'; |
| | | import SatelliteProxy from './SatelliteProxy'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { useSatelliteGridStore } from '@/stores/satellite-grid'; |
| | | |
| | | const satelliteGridStore = useSatelliteGridStore(); |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | const animaLoading = ref(true); |
| | | // ç½æ ¼ä¿¡æ¯ |
| | | let gridInfo = []; |
| | | // ç½æ ¼æ°æ®ç» |
| | | const gridDataList = ref([]); |
| | | let count = 0, |
| | | max = 0; |
| | | // ç½æ ¼æ°æ®è¯¦æ
|
| | | const gridDataDetailMap = new Map(); |
| | | const gridDataDetailList = ref([]); |
| | | // å°å¾ç½æ ¼ç¸å
³å¯¹è±¡ |
| | | let mapViews; |
| | | |
| | | // æ¥è¯¢ç½æ ¼ä¿¡æ¯åé¥ææ°æ®ç» |
| | | 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); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | // è·åé¥ææ°æ®ç» |
| | | function fetchGridData(groupId) { |
| | | return gridApi.fetchGridData(groupId).then((res) => { |
| | | gridDataList.value = res.data; |
| | | count = 0; |
| | | max = res.data.length; |
| | | fetchGridDataDetail(res.data); |
| | | }); |
| | | } |
| | | |
| | | function fetchGridDataDetail(dataList) { |
| | | dataList.forEach((d) => { |
| | | gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => { |
| | | gridDataDetailMap.set(d.id, res.data); |
| | | // const gridData = res.data; |
| | | // drawTextAndColor(gridData); |
| | | finish(); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function finish() { |
| | | count++; |
| | | if (count == max) { |
| | | animaLoading.value = false; |
| | | const list = []; |
| | | gridDataDetailMap.forEach((value, key) => { |
| | | list.push(value); |
| | | }); |
| | | |
| | | gridDataDetailList.value = list.sort((a, b) => { |
| | | return a.dataId - b.dataId; |
| | | }); |
| | | console.log(gridDataDetailList.value); |
| | | } |
| | | } |
| | | |
| | | function drawGrid(gridInfo) { |
| | | SatelliteProxy.clearAll(mapViews); |
| | | mapViews = SatelliteProxy.drawPolyline(gridInfo); |
| | | } |
| | | |
| | | // ç»å¶ç½æ ¼é¥ææ°æ®å¼åç½æ ¼é¢è² |
| | | function drawTextAndColor(gridData) { |
| | | // SatelliteProxy.clearText(mapViews); |
| | | // ææ¬æ è®° |
| | | mapViews.textViews = SatelliteProxy.drawDataText( |
| | | mapViews.points, |
| | | gridData, |
| | | mapViews.textViews |
| | | ); |
| | | SatelliteProxy.drawColor(mapViews.gridViews, gridData); |
| | | } |
| | | |
| | | function handleRowClick(row) { |
| | | if (gridDataDetailMap.has(row.id)) { |
| | | const gridData = gridDataDetailMap.get(row.id); |
| | | drawTextAndColor(gridData); |
| | | } else { |
| | | gridApi.fetchGridDataDetail(row.id, row.groupId).then((res) => { |
| | | gridDataDetailMap.set(row.id, res.data); |
| | | const gridData = res.data; |
| | | drawTextAndColor(gridData); |
| | | }); |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | .satellite-manage { |
| | | } |
| | | |
| | | .historical { |
| | | position: absolute; |
| | | bottom: 10px; |
| | | left: 0; |
| | | right: 0; |
| | | } |
| | | </style> |