From c40500d288339cd9b2200f8f909e3cd5471c0c22 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 30 八月 2024 17:38:29 +0800
Subject: [PATCH] 1. 优化3D动画中风向的变化逻辑; 2. 修复折线图切换因子时,数据直接跳转至起始处的问题; 3. 折线图和表格加回风向因子; 4. 优化风向的均值计算为矢量计算,同时最大最小值不显示; 5. 新增表格数据导出功能;

---
 src/utils/map/dialog.js |   79 +++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 41 deletions(-)

diff --git a/src/utils/map/dialog.js b/src/utils/map/dialog.js
index e041443..5c1ada9 100644
--- a/src/utils/map/dialog.js
+++ b/src/utils/map/dialog.js
@@ -3,6 +3,7 @@
 import { factorUnit } from '@/constant/factor-unit';
 import { windDir } from '@/constant/wind-dir';
 import { map } from './index_old';
+import { checkboxOptions } from '@/constant/checkbox-options';
 
 export const DialogUtil = {
   show: true,
@@ -21,8 +22,10 @@
    * @param {*} onClose 鍏抽棴寮瑰嚭妗嗗洖璋�
    * @returns
    */
-  createInfoWindow(factorDatas, i, onClose) {
+  createInfoWindow(deviceType, deviceCode, factorDatas, i, onClose) {
     let m = {
+      deviceType: deviceType,
+      deviceCode: deviceCode,
       data: factorDatas,
       index: i,
       window: '',
@@ -33,27 +36,12 @@
       isCustom: true, //浣跨敤鑷畾涔夌獥浣�
       content: this.createWindowContent(m),
       // eslint-disable-next-line no-undef
-      offset: new AMap.Pixel(16, -45)
+      offset: new AMap.Pixel(16, -45),
+      autoMove: false
     });
     return m.window;
   },
 
-  createInfoWindow2(factorData, onClose) {
-    let m = {
-      time: factorData.time,
-      factorList: factorData.values,
-      window: '',
-      close: onClose
-    };
-    // eslint-disable-next-line no-undef
-    m.window = new AMap.InfoWindow({
-      isCustom: true, //浣跨敤鑷畾涔夌獥浣�
-      content: this.createWindowContent2(m),
-      // eslint-disable-next-line no-undef
-      offset: new AMap.Pixel(16, -45)
-    });
-    return m.window;
-  },
   /**
    * 绔欑偣鏍囪淇℃伅绐椾綋
    */
@@ -72,12 +60,13 @@
   },
 
   createWindowContent2(marker) {
+    const factorTypes = checkboxOptions(marker.deviceType);
     const time = marker.time;
     const factorList = marker.factorList;
     //瀹炰緥鍖栦俊鎭獥浣�
-    // var title = '<div>' + site.name + '</div>' + '<div class="sub-title">缂栧彿:' + site.code + '</div>',
-    var title = '',
-      content = '',
+    // var title = '<div class="time">缂栧彿:' + marker.deviceCode + '</div>';
+    var title = '缂栧彿:' + marker.deviceCode;
+    var content = '',
       tag = '';
 
     tag += "<div class='time'>" + '鏃堕棿: ' + time;
@@ -87,14 +76,17 @@
     var _contents = new Map();
     factorList.forEach((f) => {
       // 鍒犻�変笉鏄剧ず鐨勫洜瀛�
-      if (
-        f.factorName == 'NOI' ||
-        f.factorName == 'LNG' ||
-        f.factorName == 'LAT' ||
-        f.factorName == 'VELOCITY' ||
-        f.factorName == 'TIME' ||
-        f.factorName == 'HEIGHT'
-      ) {
+      // if (
+      //   f.factorName == 'NOI' ||
+      //   f.factorName == 'LNG' ||
+      //   f.factorName == 'LAT' ||
+      //   f.factorName == 'VELOCITY' ||
+      //   f.factorName == 'TIME' ||
+      //   f.factorName == 'HEIGHT'
+      // ) {
+      //   return;
+      // }
+      if (!factorTypes.find((v) => v.name == f.factorName)) {
         return;
       }
 
@@ -126,6 +118,7 @@
     var orderList = [
       'VOC',
       'H2S',
+      'NO',
       'NO2',
       'CO',
       'SO2',
@@ -138,7 +131,10 @@
       'WIND_DIRECTION'
     ];
     orderList.forEach((e) => {
-      content += _contents.get(e);
+      const c = _contents.get(e);
+      if (c != undefined) {
+        content += c;
+      }
     });
 
     // content +=
@@ -161,11 +157,12 @@
     var top_t = document.createElement('div');
     top_t.className = 'ff-border-top';
     var top_c = document.createElement('div');
-    top_c.className = 'ff-border-content flexbox flex-space-between';
+    top_c.className = 'text-clz ff-border-content flexbox flex-space-between';
 
     var titleD = document.createElement('div');
-    var closeX = document.createElement('i');
-    titleD.innerHTML = title;
+    var closeX = document.createElement('div');
+    $(titleD).text(title);
+    // titleD.className = 'time';
     closeX.className = 'text-close';
     $(closeX).attr('aria-hidden', 'true');
     $(closeX).text('X');
@@ -246,15 +243,15 @@
     return info;
   },
 
-  openNewWindow(factorDatas, i, onClose) {
+  openNewWindow(deviceType, deviceCode, factorDatas, i, onClose) {
     if (!this.show) return;
-    const window = this.createInfoWindow(factorDatas, i, onClose);
+    const window = this.createInfoWindow(
+      deviceType,
+      deviceCode,
+      factorDatas,
+      i,
+      onClose
+    );
     window.open(map, factorDatas.lnglats_GD[i]);
-  },
-
-  openNewWindow2(factorData, position, onClose) {
-    if (!this.show) return;
-    const window = this.createInfoWindow2(factorData, onClose);
-    window.open(map, position);
   }
 };

--
Gitblit v1.9.3