From 1788c96aea9247cc36ef8b82734997f1a6a92fb4 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 23 八月 2024 11:07:42 +0800 Subject: [PATCH] 新增新版本。静安区特供版 --- src/utils/map/dialog.js | 53 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/utils/map/dialog.js b/src/utils/map/dialog.js index 54292bd..713af62 100644 --- a/src/utils/map/dialog.js +++ b/src/utils/map/dialog.js @@ -1,6 +1,8 @@ -import { factorName } from '../../constant/factor-name'; -import { factorUnit } from '../../constant/factor-unit'; -import { windDir } from '../../constant/wind-dir'; +import $ from 'jquery'; +import { factorName } from '@/constant/factor-name'; +import { factorUnit } from '@/constant/factor-unit'; +import { windDir } from '@/constant/wind-dir'; +import { map } from './index_old'; export const DialogUtil = { show: true, @@ -19,8 +21,9 @@ * @param {*} onClose 鍏抽棴寮瑰嚭妗嗗洖璋� * @returns */ - createInfoWindow(factorDatas, i, onClose) { + createInfoWindow(deviceCode, factorDatas, i, onClose) { let m = { + deviceCode: deviceCode, data: factorDatas, index: i, window: '', @@ -31,7 +34,8 @@ 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; }, @@ -73,9 +77,9 @@ 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; @@ -102,7 +106,7 @@ n = 0; } var v = f.factorData.toFixed(n); - var unit = factorUnit[f.factorName]; + var unit = factorUnit[f.factorName].unit; if (f.factorName == 'CO') { unit = '渭g/m鲁'; } @@ -124,6 +128,7 @@ var orderList = [ 'VOC', 'H2S', + 'NO', 'NO2', 'CO', 'SO2', @@ -136,7 +141,10 @@ 'WIND_DIRECTION' ]; orderList.forEach((e) => { - content += _contents.get(e); + const c = _contents.get(e); + if (c != undefined) { + content += c; + } }); // content += @@ -152,20 +160,22 @@ // 瀹氫箟椤堕儴鏍囬 var top = document.createElement('div'); // top.className = "info-top"; - top.className = 'ff-content ff-content-top-left ff-content-small-borderless-t info-top'; + top.className = + 'ff-content ff-content-top-left ff-content-small-borderless-t info-top'; var top_b = document.createElement('div'); top_b.className = 'ff-border-bottom'; 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; - closeX.className = 'fa fa-times'; - // eslint-disable-next-line no-undef + var closeX = document.createElement('div'); + $(titleD).text(title); + // titleD.className = 'time'; + closeX.className = 'text-close'; $(closeX).attr('aria-hidden', 'true'); + $(closeX).text('X'); closeX.onclick = function () { marker.close(); marker.window.close(); @@ -185,11 +195,8 @@ refreshV.className = 'refresh-btn'; var refresh = document.createElement('i'); refresh.className = 'fa fa-refresh'; - // eslint-disable-next-line no-undef $(refresh).attr('aria-hidden', 'true'); - // eslint-disable-next-line no-undef $(refresh).css('color', '#ffffffc0'); - // eslint-disable-next-line no-undef $(refresh).css('cursor', 'pointer'); refresh.onclick = function () { // $(this).addClass('fa-spin') @@ -246,13 +253,13 @@ return info; }, - openNewWindow(factorDatas, i, map, position, onClose) { + openNewWindow(deviceCode, factorDatas, i, onClose) { if (!this.show) return; - const window = this.createInfoWindow(factorDatas, i, onClose); - window.open(map, position); + const window = this.createInfoWindow(deviceCode, factorDatas, i, onClose); + window.open(map, factorDatas.lnglats_GD[i]); }, - openNewWindow2(factorData, map, position, onClose) { + openNewWindow2(factorData, position, onClose) { if (!this.show) return; const window = this.createInfoWindow2(factorData, onClose); window.open(map, position); -- Gitblit v1.9.3