<template>
|
<el-row class="wrap">
|
<el-col span="2">
|
<!-- <el-button
|
class="p-events-auto"
|
type="info"
|
icon="Memo"
|
plain
|
@click="draw"
|
>
|
绘制网格
|
</el-button> -->
|
<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"
|
></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 class="historical" justify="center">
|
<SatelliteAnimation
|
:loading="animaLoading"
|
:grid-data="gridDataDetailList"
|
:mapViews="mapViews"
|
></SatelliteAnimation>
|
</el-row> -->
|
</el-row>
|
</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);
|
const show = ref(true);
|
|
let count = 0,
|
max = 0;
|
// 网格数据详情
|
const gridDataDetailMap = new Map();
|
const gridDataDetailList = ref([]);
|
// 地图网格相关对象
|
let mapViews;
|
|
// 查询网格信息和遥感数据组
|
function onSearch(options) {
|
satelliteGridStore.fetchGridCell(options.id).then(() => {
|
drawGrid(satelliteGridStore.gridInfo);
|
});
|
satelliteGridStore.fetchGridData(options.id);
|
}
|
|
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);
|
// 文本标记
|
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);
|
}
|
|
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);
|
});
|
}
|
}
|
|
function handleRankClick(rankVisible) {
|
rankVisible ? map.add(mapViews.rankLayer) : map.remove(mapViews.rankLayer);
|
}
|
|
function handleDataClick(dataVisible) {
|
dataVisible ? map.add(mapViews.dataLayer) : map.remove(mapViews.dataLayer);
|
}
|
</script>
|
<style scoped>
|
.satellite-manage {
|
}
|
|
.historical {
|
position: absolute;
|
bottom: 10px;
|
left: 0;
|
right: 0;
|
}
|
</style>
|