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,9 @@
   * @param {*} onClose 关闭弹出框回调
   * @returns
   */
  createInfoWindow(deviceCode, factorDatas, i, onClose) {
  createInfoWindow(deviceType, deviceCode, factorDatas, i, onClose) {
    let m = {
      deviceType: deviceType,
      deviceCode: deviceCode,
      data: factorDatas,
      index: i,
@@ -40,22 +42,6 @@
    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;
  },
  /**
   * 站点标记信息窗体
   */
@@ -74,6 +60,7 @@
  },
  createWindowContent2(marker) {
    const factorTypes = checkboxOptions(marker.deviceType);
    const time = marker.time;
    const factorList = marker.factorList;
    //实例化信息窗体
@@ -89,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;
      }
@@ -253,15 +243,15 @@
    return info;
  },
  openNewWindow(deviceCode, factorDatas, i, onClose) {
  openNewWindow(deviceType, deviceCode, factorDatas, i, onClose) {
    if (!this.show) return;
    const window = this.createInfoWindow(deviceCode, 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);
  }
};