From 2592dc279ec82bf3649a4dbe644c6416263a10ef Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 07 三月 2025 17:10:25 +0800 Subject: [PATCH] 各模块功能新增 --- src/views/satellitetelemetry/SatelliteTelemetry.vue | 220 ++++++++++++++++++++++++++---------------------------- 1 files changed, 106 insertions(+), 114 deletions(-) diff --git a/src/views/satellitetelemetry/SatelliteTelemetry.vue b/src/views/satellitetelemetry/SatelliteTelemetry.vue index 66ed9cc..9cfd538 100644 --- a/src/views/satellitetelemetry/SatelliteTelemetry.vue +++ b/src/views/satellitetelemetry/SatelliteTelemetry.vue @@ -1,32 +1,41 @@ <template> - <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 justify="space-between"> + <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" + ></SatelliteManage> + </el-row> + </el-col> + <el-col span="2"> + <el-row> + <CardButton + name="鍗槦閬ユ祴鏁版嵁" + direction="right" + @click="() => (show = !show)" + ></CardButton> + </el-row> + <el-row class="flex-col"> + <GridStyleTool + @show-rank="handleRankClick" + @show-data="handleDataClick" + @change-color="handleColorClick" + @change-opacity="handleOpacityClick" + ></GridStyleTool> + </el-row> + </el-col> + </el-row> + <GridTool></GridTool> </el-row> - <SatelliteDataMix class="data-mix" @mix-data="handleMixDataClick"> - </SatelliteDataMix> + <!-- <SatelliteDataMix class="data-mix" @mix-data="handleMixDataClick"> + </SatelliteDataMix> --> + <!-- <el-row class="historical" justify="center"> <SatelliteAnimation :loading="animaLoading" @@ -41,45 +50,25 @@ 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'; -import SatelliteProxy from './SatelliteProxy'; +import SatelliteMixTool from './component/SatelliteMixTool.vue'; +import GridStyleTool from './component/GridStyleTool.vue'; +import { SatelliteProxy } from './SatelliteProxy'; import { useFetchData } from '@/composables/fetchData'; import { useSatelliteGridStore } from '@/stores/satellite-grid'; +import { useSceneStore } from '@/stores/scene'; +import { useGridStore } from '@/stores/grid-info'; -// 鏌ヨ闀垮畞鍖鸿鏀垮尯鍒� -function initDistrict() { - 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: '#ffffff' //绾挎潯棰滆壊 - strokeColor: '#0077ff' //绾挎潯棰滆壊 - }); - } - map.setFitView(); //灏嗚鐩栫墿璋冩暣鍒板悎閫傝閲� - } - }); - }); -} +const satelliteProxy = new SatelliteProxy(); +const gridStore = useGridStore(); +gridStore.selectedSatelliteProxy = satelliteProxy; +const sceneStore = useSceneStore(); const satelliteGridStore = useSatelliteGridStore(); + const { loading, fetchData } = useFetchData(10000); const animaLoading = ref(true); const show = ref(true); @@ -89,14 +78,12 @@ // 缃戞牸鏁版嵁璇︽儏 const gridDataDetailMap = new Map(); const gridDataDetailList = ref([]); -// 鍦板浘缃戞牸鐩稿叧瀵硅薄 -let mapViews; // 鏌ヨ缃戞牸淇℃伅鍜岄仴鎰熸暟鎹粍 function onSearch(options) { satelliteGridStore.fetchGridCell(options.id).then(() => { - drawGrid(satelliteGridStore.gridInfo); - initDistrict(); + prepareGrid(satelliteGridStore.gridInfo); + satelliteProxy.drawDistrict('闀垮畞鍖�'); }); satelliteGridStore.fetchGridData(options.id).then(() => { max = satelliteGridStore.gridDataList.length; @@ -131,68 +118,72 @@ } } -function drawGrid(gridInfo) { - SatelliteProxy.clearAll(mapViews); - mapViews = SatelliteProxy.drawPolyline(gridInfo); -} - -// 缁樺埗缃戞牸閬ユ劅鏁版嵁鍊煎拰缃戞牸棰滆壊 -function drawTextAndColor(gridData) { - // SatelliteProxy.clearText(mapViews); - // 鏂囨湰鏍囪 - 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 prepareGrid(gridInfo) { + satelliteProxy.gridPrepare(gridInfo, (polygon) => { + //榧犳爣绉诲叆浜嬩欢 + polygon.on('mouseover', () => { + polygon.setOptions({ + //淇敼澶氳竟褰㈠睘鎬х殑鏂规硶 + strokeWeight: 2, + strokeColor: 'red' + }); }); - } + //榧犳爣绉诲嚭浜嬩欢 + polygon.on('mouseout', () => { + polygon.setOptions({ + strokeWeight: 1, + strokeColor: 'white' + }); + }); + //榧犳爣鐐瑰嚮浜嬩欢 + // polygon.on('click', () => { + // const [lng, lat] = polygon.getExtData(); + // sceneStore.radius = 0.5; + // sceneStore.searchScene(lng, lat); + // }); + }); + satelliteProxy.setGridEvent('click', (e) => { + const polygon = e.target; + const { gridCell } = polygon.getExtData(); + const cellIndex = gridCell.cellIndex; + const gridDataDetail = + satelliteGridStore.selectedGridDataDetail[cellIndex - 1]; + gridStore.selectedGridCellAndDataDetail = { + gridCell, + gridDataDetail + }; + }); +} + +function drawGrid(gridDataDetail) { + satelliteProxy.drawGrid({ + gridDataDetail: gridDataDetail, + useDataTxtColor: true + }); +} + +function handleRowClick(row) { + satelliteGridStore.fetchGridDataDetail(row, drawGrid); } function handleRankClick(rankVisible) { - // rankVisible ? map.add(mapViews.rankLayer) : map.remove(mapViews.rankLayer); - rankVisible ? map.add(mapViews.rankTxt) : map.remove(mapViews.rankTxt); + satelliteProxy.changeVisibility({ showRankTxt: rankVisible }); } function handleDataClick(dataVisible) { - // dataVisible ? map.add(mapViews.dataLayer) : map.remove(mapViews.dataLayer); - dataVisible ? map.add(mapViews.dataTxt) : map.remove(mapViews.dataTxt); + satelliteProxy.changeVisibility({ showDataTxt: dataVisible }); } function handleColorClick(isStandardColor) { - SatelliteProxy.drawColor( - mapViews.gridViews, - selectedGridData, - !isStandardColor - ); + satelliteProxy.drawGrid({ + gridDataDetail: satelliteGridStore.selectedGridDataDetail, + useCustomColor: !isStandardColor, + useDataTxtColor: true + }); +} + +function handleOpacityClick(value) { + satelliteProxy.changeGridOpacity({ opacityValue: value }); } function handleMixDataClick(gridData) { @@ -215,5 +206,6 @@ position: absolute; right: 0; top: 60px; + /* color: #0552f7; */ } </style> -- Gitblit v1.9.3