From 3832a82fb79d4cec4cca5e2854e54953f2095ef8 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 06 九月 2024 16:55:08 +0800 Subject: [PATCH] 1. 添加溯源清单功能 2. 修复切换至走航监测界面后,之前正在加载的历史数据依旧展示至地图的问题 3. 添加折线图下载图片功能; 4. 添加数据导出功能; 5. 添加设备管理功能; 6. 添加数据弹框和溯源清单开关功能; 7. 优化3D里面的颜色展示逻辑,底部颜色由原来的因子最小值颜色改为当前量级的上一个量级对应的颜色 --- src/utils/map/dialog.js | 146 ++++++++++++++++++++++++++++-------------------- 1 files changed, 85 insertions(+), 61 deletions(-) diff --git a/src/utils/map/dialog.js b/src/utils/map/dialog.js index 54292bd..c7403eb 100644 --- a/src/utils/map/dialog.js +++ b/src/utils/map/dialog.js @@ -1,17 +1,17 @@ -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'; +import { checkboxOptions } from '@/constant/checkbox-options'; +import { useToolboxStore } from '@/stores/toolbox'; + +const toolboxStore = useToolboxStore(); export const DialogUtil = { - show: true, - toggleDataDialog() { - this.show = !this.show; - if (this.show) { - return '鏁版嵁寮规锛氬紑'; - } else { - return '鏁版嵁寮规锛氬叧'; - } - }, + // 褰撳墠鎵撳紑鐨勫脊妗嗗強浣嶇疆鍧愭爣 + marker: undefined, + lnglat: undefined, /** * 鍒涘缓寮瑰嚭妗� * @param {*} factorDatas 鐩戞祴鏁版嵁 @@ -19,8 +19,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: '', @@ -31,27 +33,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; + return m; }, - 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; - }, /** * 绔欑偣鏍囪淇℃伅绐椾綋 */ @@ -70,12 +57,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; @@ -85,14 +73,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; } @@ -102,7 +93,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 +115,7 @@ var orderList = [ 'VOC', 'H2S', + 'NO', 'NO2', 'CO', 'SO2', @@ -136,7 +128,10 @@ 'WIND_DIRECTION' ]; orderList.forEach((e) => { - content += _contents.get(e); + const c = _contents.get(e); + if (c != undefined) { + content += c; + } }); // content += @@ -152,20 +147,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 +182,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,15 +240,45 @@ return info; }, - openNewWindow(factorDatas, i, map, position, onClose) { - if (!this.show) return; - const window = this.createInfoWindow(factorDatas, i, onClose); - window.open(map, position); + /** + * 寮�鍚竴涓柊鐨勬暟鎹脊妗� + * @param {String} deviceType 璁惧绫诲瀷 + * @param {String} deviceCode 璁惧缂栧彿 + * @param {Array} factorDatas 鐩戞祴鏁版嵁 + * @param {Number} i 鏁版嵁绱㈠紩 + * @param {Function} onClose 寮规鍏抽棴鍥炶皟 + * @returns + */ + openNewWindow(deviceType, deviceCode, factorDatas, i, onClose) { + if (!toolboxStore.dataDialogStatus) return; + this.marker = this.createInfoWindow( + deviceType, + deviceCode, + factorDatas, + i, + onClose + ); + this.marker.window.open(map, factorDatas.lnglats_GD[i]); + this.lnglat = factorDatas.lnglats_GD[i]; }, - openNewWindow2(factorData, map, position, onClose) { - if (!this.show) return; - const window = this.createInfoWindow2(factorData, onClose); - window.open(map, position); + /** + * 鎵撳紑缂撳瓨涓殑寮规 + */ + openWindow() { + if (this.marker && this.lnglat) { + // this.marker.close(); + this.marker.window.open(map, this.lnglat); + } + }, + + /** + * 鍏抽棴宸插脊鍑虹殑寮规 + */ + closeWindow() { + if (this.marker) { + // this.marker.close(); + this.marker.window.close(); + } } }; -- Gitblit v1.9.3