<template>
|
<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> -->
|
|
<!-- <el-row class="historical" justify="center">
|
<SatelliteAnimation
|
:loading="animaLoading"
|
:grid-data="gridDataDetailList"
|
:mapViews="mapViews"
|
></SatelliteAnimation>
|
</el-row> -->
|
</template>
|
<script setup>
|
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';
|
|
import { ref, onMounted } from 'vue';
|
import gridApi from '@/api/gridApi';
|
import SatelliteManage from './component/SatelliteManage.vue';
|
import SatelliteDataMix from './component/SatelliteDataMix.vue';
|
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';
|
|
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);
|
|
let count = 0,
|
max = 0;
|
// 网格数据详情
|
const gridDataDetailMap = new Map();
|
const gridDataDetailList = ref([]);
|
|
// 查询网格信息和遥感数据组
|
function onSearch(options) {
|
satelliteGridStore.fetchGridCell(options.id).then(() => {
|
prepareGrid(satelliteGridStore.gridInfo);
|
satelliteProxy.drawDistrict('长宁区');
|
});
|
satelliteGridStore.fetchGridData(options.id).then(() => {
|
max = satelliteGridStore.gridDataList.length;
|
// fetchGridDataDetail(satelliteGridStore.gridDataList);
|
});
|
}
|
|
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 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) {
|
satelliteProxy.changeVisibility({ showRankTxt: rankVisible });
|
}
|
|
function handleDataClick(dataVisible) {
|
satelliteProxy.changeVisibility({ showDataTxt: dataVisible });
|
}
|
|
function handleColorClick(isStandardColor) {
|
satelliteProxy.drawGrid({
|
gridDataDetail: satelliteGridStore.selectedGridDataDetail,
|
useCustomColor: !isStandardColor,
|
useDataTxtColor: true
|
});
|
}
|
|
function handleOpacityClick(value) {
|
satelliteProxy.changeGridOpacity({ opacityValue: value });
|
}
|
|
function handleMixDataClick(gridData) {
|
handleRowClick(gridData);
|
}
|
</script>
|
<style scoped>
|
.satellite-manage {
|
}
|
|
.historical {
|
position: absolute;
|
bottom: 10px;
|
left: 0;
|
right: 0;
|
color: #0077ff;
|
}
|
|
.data-mix {
|
position: absolute;
|
right: 0;
|
top: 60px;
|
/* color: #0552f7; */
|
}
|
</style>
|