From 7eb2abf43167d9db3fca2e7958b90ff1bea0cead Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 03 三月 2025 13:54:31 +0800
Subject: [PATCH] 污染溯源模块编写中

---
 src/views/satellitetelemetry/SatelliteTelemetry.vue |  204 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 146 insertions(+), 58 deletions(-)

diff --git a/src/views/satellitetelemetry/SatelliteTelemetry.vue b/src/views/satellitetelemetry/SatelliteTelemetry.vue
index 6b37603..9e2998f 100644
--- a/src/views/satellitetelemetry/SatelliteTelemetry.vue
+++ b/src/views/satellitetelemetry/SatelliteTelemetry.vue
@@ -1,61 +1,106 @@
 <template>
-  <div>
-    <!-- <el-button
-      class="p-events-auto"
-      type="info"
-      icon="Memo"
-      plain
-      @click="draw"
-    >
-      缁樺埗缃戞牸
-    </el-button> -->
-    <SatelliteManage
-      class="satellite-manage"
-      :gridDataList="satelliteGridStore.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>
+  <SatelliteMixTool :group-id="3"></SatelliteMixTool>
+
+  <el-row class="wrap">
+    <el-col span="2">
+      <!-- <div class="p-events-auto">
+        <el-button
+          type="primary"
+          class="el-button-custom"
+          size="small"
+          @click="previousGrid"
+        >
+          涓婁竴涓�
+        </el-button>
+        <el-button
+          type="primary"
+          class="el-button-custom"
+          size="small"
+          @click="nextGrid"
+        >
+          涓嬩竴涓�
+        </el-button>
+      </div> -->
+      <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"
+          @change-opacity="handleOpacityClick"
+        ></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';
 
-import { ref } from 'vue';
+import { ref, onMounted } from 'vue';
 import gridApi from '@/api/gridApi';
 import SatelliteManage from './component/SatelliteManage.vue';
-import SatelliteProxy from './SatelliteProxy';
+import SatelliteDataMix from './component/SatelliteDataMix.vue';
+import SatelliteMixTool from './component/SatelliteMixTool.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([]);
-// 鍦板浘缃戞牸鐩稿叧瀵硅薄
-let mapViews;
 
 // 鏌ヨ缃戞牸淇℃伅鍜岄仴鎰熸暟鎹粍
 function onSearch(options) {
   satelliteGridStore.fetchGridCell(options.id).then(() => {
-    drawGrid(satelliteGridStore.gridInfo);
+    prepareGrid(satelliteGridStore.gridInfo);
+    satelliteProxy.drawDistrict('闀垮畞鍖�');
   });
-  satelliteGridStore.fetchGridData(options.id);
+  satelliteGridStore.fetchGridData(options.id).then(() => {
+    max = satelliteGridStore.gridDataList.length;
+    // fetchGridDataDetail(satelliteGridStore.gridDataList);
+  });
 }
 
 function fetchGridDataDetail(dataList) {
@@ -85,37 +130,72 @@
   }
 }
 
-function drawGrid(gridInfo) {
-  SatelliteProxy.clearAll(mapViews);
-  mapViews = SatelliteProxy.drawPolyline(gridInfo);
+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 drawTextAndColor(gridData) {
-  // SatelliteProxy.clearText(mapViews);
-  // 鏂囨湰鏍囪
-  const { textViews: dataTxt, labelsLayer: dataLayer } =
-    SatelliteProxy.drawDataText(mapViews.points, gridData, mapViews.dataTxt);
-  mapViews.dataTxt = dataTxt;
-  mapViews.dataLayer = dataLayer;
-  const { textViews: rankTxt, labelsLayer: rankLayer } =
-    SatelliteProxy.drawRankText(mapViews.points, gridData, mapViews.rankTxt);
-  mapViews.rankTxt = rankTxt;
-  mapViews.rankLayer = rankLayer;
-  SatelliteProxy.drawColor(mapViews.gridViews, gridData);
+function drawGrid(gridDataDetail) {
+  satelliteProxy.drawGrid({ gridDataDetail: gridDataDetail });
 }
 
 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);
-    });
-  }
+  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
+  });
+}
+
+function handleOpacityClick(isOpacity) {
+  satelliteProxy.changeGridOpacity({ isOpacity });
+}
+
+function handleMixDataClick(gridData) {
+  handleRowClick(gridData);
 }
 </script>
 <style scoped>
@@ -127,5 +207,13 @@
   bottom: 10px;
   left: 0;
   right: 0;
+  color: #0077ff;
+}
+
+.data-mix {
+  position: absolute;
+  right: 0;
+  top: 60px;
+  /* color: #0552f7; */
 }
 </style>

--
Gitblit v1.9.3