From 96da92e9056c9c02e77867998424d623261daab0 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 25 七月 2024 15:09:32 +0800
Subject: [PATCH] 1. 添加地图罗盘的显隐 2. 修复数据表格中O3数据列实际显示NO2的值的问题 3. 优化风向的中文描述

---
 src/views/historymode/HistoryMode.vue |   82 +++++++++++++++++++++++++++++++----------
 1 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/src/views/historymode/HistoryMode.vue b/src/views/historymode/HistoryMode.vue
index 817a150..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 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"
@@ -39,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';
@@ -47,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 },
@@ -70,36 +83,50 @@
       drawMode: 0,
       searchTime: [],
       // 褰撳墠閫変腑楂樹寒鐨勬暟鎹偣绱㈠紩
-      locateIndex: undefined
+      locateIndex: undefined,
+      // 杞ㄨ抗鍔ㄧ敾鐘舵��
+      status: 0
     };
   },
   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);
       // }
@@ -108,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) {
@@ -177,10 +205,17 @@
   },
   mounted() {
     this.fetchRealTimeData();
+  },
+  unmounted() {
+    mapUtil.clearMap();
   }
 };
 </script>
 <style scoped>
+.top-wrap {
+  height: 40px;
+}
+
 .trend-analysis {
   position: absolute;
   left: 0;
@@ -192,4 +227,11 @@
   right: 0;
   top: 0;
 }
+
+.historical {
+  position: absolute;
+  bottom: 10px;
+  left: 0;
+  right: 0;
+}
 </style>

--
Gitblit v1.9.3