From d5eebdbae1beac85555a05a2e0b1c858a62893c7 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 18 七月 2024 17:42:11 +0800
Subject: [PATCH] 1. 修正点击折线图数据点图消失问题

---
 src/views/historymode/HistoryMode.vue |   78 ++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/src/views/historymode/HistoryMode.vue b/src/views/historymode/HistoryMode.vue
index f9b89f9..9421a94 100644
--- a/src/views/historymode/HistoryMode.vue
+++ b/src/views/historymode/HistoryMode.vue
@@ -1,10 +1,13 @@
 <template>
   <div class="p-events-none m-t-2">
-    <el-row v-show="status == 0" justify="center">
+    <el-row justify="center" align="middle" class="top-wrap">
       <SearchBar
+        v-show="status == 0"
         :search-time="searchTime"
+        :loading="loading"
         @search="fetchHistroyData"
       ></SearchBar>
+      <TrajectoryState v-show="status != 0" :status="status"></TrajectoryState>
     </el-row>
     <el-row class="m-t-2">
       <FactorRadio
@@ -17,6 +20,14 @@
         class="m-t-2"
         :factor="factorDatas.factor[factorType]"
       ></FactorLegend>
+    </el-row>
+    <el-row class="historical" justify="center">
+      <HistoricalTrajectory
+        :factor-datas="factorDatas"
+        :factor-type="factorType"
+        @change="(e) => (status = e)"
+        @stop="draw"
+      ></HistoricalTrajectory>
     </el-row>
     <TrendAnalysis
       class="trend-analysis"
@@ -32,11 +43,6 @@
       :factor-datas="factorDatas"
       :device-type="deviceType"
     ></DataSheet>
-    <el-row class="historical" justify="center">
-      <HistoricalTrajectory
-        @change="(e) => (status = e)"
-      ></HistoricalTrajectory>
-    </el-row>
   </div>
 </template>
 
@@ -44,6 +50,7 @@
 import Layer from '@/utils/map/3dLayer';
 import marks from '@/utils/map/marks';
 import sector from '@/utils/map/sector';
+import mapUtil from '@/utils/map/util';
 import { DialogUtil } from '@/utils/map/dialog';
 import monitorDataApi from '@/api/monitorDataApi';
 import { useFetchData } from '@/composables/fetchData';
@@ -52,6 +59,7 @@
 import { FactorDatas } from '@/model/FactorDatas';
 import TrendAnalysis from './component/TrendAnalysis.vue';
 import DataSheet from './component/DataSheet.vue';
+import { ElMessageBox, ElNotification, ElMessage } from 'element-plus';
 
 export default {
   components: { TrendAnalysis, DataSheet },
@@ -82,31 +90,43 @@
   },
   watch: {
     factorType(nValue, oValue) {
-      if (nValue != oValue) {
+      if (nValue != oValue && this.status == 0) {
         this.draw();
       }
     }
   },
   methods: {
+    // 妫�鏌ユ暟鎹粡绾害鏄惁鍚堟硶
+    checkDataIsValid(index) {
+      const lnglats_GD = this.factorDatas.lnglats_GD[index];
+      const time = this.factorDatas.times[index];
+      if (lnglats_GD[0] == 0 && lnglats_GD[1] == 0) {
+        ElMessage({
+          message: `${time}鐨勬暟鎹粡绾害鏃犳晥`,
+          type: 'warning'
+        });
+        return false;
+      } else {
+        this.locateIndex = index;
+        return true;
+      }
+    },
     // 鐩戝惉鎶樼嚎鍥惧拰琛ㄦ牸鐨勭偣鍑讳簨浠�
     handelIndexChange(index) {
-      this.locateIndex = index;
-      this.drawSector(index);
+      if (this.checkDataIsValid(index)) {
+        this.drawSector(index);
+      }
     },
     draw() {
-      // todo 鍒锋柊鍥句緥
+      // 鍒锋柊鍥句緥
       const factor = this.factorDatas.factor[this.factorType];
+      sector.clearSector();
       this.drawRoadMap(factor);
       this.drawMassMarks(factor);
     },
     // 缁樺埗3D璧拌璺嚎鍥�
     drawRoadMap(e) {
-      //   this.factorMode = factorMode;
-      // this.factorType = factorType;
-      // this.factorName = factorName;
       this.factorDatas.refreshHeight(this.factorType);
-      // this.mapMaker.setFactorType(factorType);
-      // if (!this.mapMaker.runStatus()) {
 
       Layer.drawRoadMap(this.factorDatas, e, this.merge, this.setCenter);
       // }
@@ -115,21 +135,22 @@
       marks.drawMassMarks(this.factorDatas, e, (index) => {
         // 鏌ヨ鑼冨洿鍐呯殑鐩戞祴绔欑偣
         // SceneUtil.searchByCoordinate(lnglat[0], lnglat[1], distance);
-        // 3. 瓒嬪娍鍥捐烦杞畾浣�
-        // const progress = FChart.locate(lineChart.chart, lineChart.option, i, _factor.factorName);
-        // 4. 琛ㄦ牸鏁版嵁璺宠浆瀹氫綅
-        // Table.locate(i);
-        this.drawSector(index);
-        this.locateIndex = index;
+        if (this.checkDataIsValid(index)) {
+          this.drawSector(index);
+        }
       });
+      // 璋冩暣鍦板浘瑙嗚
+      mapUtil.setBound(this.factorDatas.lnglats_GD);
     },
     drawSector(index) {
-      // 1. 缁樺埗鎵囧舰鍖哄煙
-      sector.drawSector(this.factorDatas, index);
+      // 1. 缁樺埗鏂版墖褰㈠尯鍩�
+      const pr = sector.drawSector(this.factorDatas, index);
+      // 璋冩暣瑙嗚灞呬腑鏄剧ず
+      mapUtil.setFitSector(pr);
       // 2. 缁樺埗瀵硅瘽妗�
       DialogUtil.openNewWindow(this.factorDatas, index, () => {
         // 绉婚櫎鎵囧舰鍖哄煙
-        // clearSector3();
+        sector.clearSector();
       });
     },
     onFetchData(type, data) {
@@ -184,10 +205,17 @@
   },
   mounted() {
     this.fetchRealTimeData();
+  },
+  unmounted() {
+    mapUtil.clearMap();
   }
 };
 </script>
 <style scoped>
+.top-wrap {
+  height: 40px;
+}
+
 .trend-analysis {
   position: absolute;
   left: 0;
@@ -202,7 +230,7 @@
 
 .historical {
   position: absolute;
-  bottom: 0;
+  bottom: 10px;
   left: 0;
   right: 0;
 }

--
Gitblit v1.9.3