From f868ff46ef4fb25a01364f3c5d0fe220d32b7ad0 Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期二, 01 三月 2022 14:25:16 +0800 Subject: [PATCH] 大屏对接新平台 --- src/components/charts/RoseChart.vue | 36 + src/components/charts/imgPieChart.vue | 36 + src/components/charts/PictorialBar.vue | 36 + src/assets/js/axios.js | 17 src/assets/js/newApi.js | 61 ++ src/components/charts/dischargeCircuit.vue | 36 + src/pages/exhibition.vue | 11 src/components/charts/monomerVoltage.vue | 36 + src/components/charts/triangleBarChart.vue | 37 + src/components/charts/CustomPie.vue | 36 + src/components/charts/AcInputWarp.vue | 36 + src/components/charts/RoseChartHea.vue | 36 + src/components/charts/abeamProChart.vue | 37 + src/components/charts/chinaMap.vue | 12 src/components/indexPanel/newInfoPanel.vue | 148 ++++++ src/components/charts/prossPieChart.vue | 36 + src/components/charts/MonCap.vue | 36 + src/components/charts/latticeBar.vue | 36 + src/components/charts/histogramAlternating.vue | 37 + src/components/charts/newChinaMap.vue | 634 ++++++++++++++++++++++++++ src/components/charts/RoseChartED.vue | 36 + 21 files changed, 1,252 insertions(+), 174 deletions(-) diff --git a/src/assets/js/axios.js b/src/assets/js/axios.js index fdc1d90..97c8b82 100644 --- a/src/assets/js/axios.js +++ b/src/assets/js/axios.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import axios from 'axios'; // import qs from 'qs'; +let newPlatform = sessionStorage.getItem('newPlatform') if (process.env.NODE_ENV == 'dev') { // 璺ㄥ煙璇锋眰 axios.defaults.baseURL = 'http://localhost:8090/screen'; @@ -13,13 +14,19 @@ axios.interceptors.request.use(function (config) { if (config.asy) { if (process.env.NODE_ENV == 'dev') { - // 璺ㄥ煙璇锋眰 - config.baseURL = 'http://localhost:8919/fg'; - config.withCredentials = true; // 淇濇寔璇锋眰澶� + if (newPlatform == 1) { + config.baseURL = 'http://localhost:8091/fg'; + } else { + config.baseURL = 'http://localhost:8919/fg'; + } } else { - config.baseURL = `http://${location.hostname}:8919/fg`; - config.withCredentials = true; // 淇濇寔璇锋眰澶� + if (newPlatform == 1) { + config.baseURL = `http://${location.hostname}:8091/fg`; + } else { + config.baseURL = `http://${location.hostname}:8919/fg`; + } } + config.withCredentials = true; // 淇濇寔璇锋眰澶� } // 鍦ㄥ彂閫佽姹備箣鍓嶅仛浜涗粈涔� return config; diff --git a/src/assets/js/newApi.js b/src/assets/js/newApi.js new file mode 100644 index 0000000..926fe6c --- /dev/null +++ b/src/assets/js/newApi.js @@ -0,0 +1,61 @@ +import axios from "./axios"; + +/** + * 鏌ヨ宸叉坊鍔犲埌鍦板浘鐨勬満鎴� + * 鍙傛暟:json={"adata":{"alm_cleared_type":0,"alm_id":1},"bplan":{"discharge_reason":3}} + */ +export const searchMap = () => { + return axios({ + method: "GET", + url: "/battMapInformation/searchUserManageStation", + asy: 1 + }); +}; + +// 缁熻鏍稿/鍋滅數鏀剧數 +export const searchMapHomeState = () => { + return axios({ + method: "GET", + url: '/battMapInformation/findStationState', + asy: 1 + }); +}; + +/** + * 棣栭〉鍦板浘json鏁版嵁閰嶇疆 鏌ヨ鍏宠仈鍦板浘 + * 鍙傛暟锛� json={"id":id} + */ +export const getAllMapOutlineAction = () => { + return axios({ + method: "GET", + url: "/mapOutline/all", + asy: 1 + }); +}; + +/** + * 鏍规嵁璁惧id鏌ヨ閰嶇疆 + * @param data + * @returns {AxiosPromise} + */ +export const searchByDevId = (params) => { + return axios({ + method: 'GET', + url: '/station3D/byDeviceId', + params: params, + asy: 1 + }); +}; + +/** + * 鏍规嵁鍩虹珯淇℃伅鏌ヨ鍩虹珯鐨勫憡璀﹀拰钀藉悗淇℃伅 + * 鍙傛暟锛� json={"stationId":"@鏈烘埧缂栧彿"} + */ +export const searchHomeNum = (params) => { + return axios({ + method: "GET", + url: "/battMapInformation/multAmout", + params: params, + asy: 1 + }); +}; \ No newline at end of file diff --git a/src/components/charts/AcInputWarp.vue b/src/components/charts/AcInputWarp.vue index a72157a..b19e893 100644 --- a/src/components/charts/AcInputWarp.vue +++ b/src/components/charts/AcInputWarp.vue @@ -72,17 +72,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } } }, clickItem(name) { diff --git a/src/components/charts/CustomPie.vue b/src/components/charts/CustomPie.vue index d46d828..6003191 100644 --- a/src/components/charts/CustomPie.vue +++ b/src/components/charts/CustomPie.vue @@ -59,17 +59,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/MonCap.vue b/src/components/charts/MonCap.vue index b6e7f80..3f16bcb 100644 --- a/src/components/charts/MonCap.vue +++ b/src/components/charts/MonCap.vue @@ -93,17 +93,31 @@ this.$refs.circleChart.resize(); }, toParentPage() { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜瀹炴椂鍛婅", - name: "batteryrTimequery", - src: "#/batteryrTimequery", - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery", + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "#/batteryrTimequery", + closable: true + }, + } + }, "*"); + } }, setData(data) { this.$nextTick(() => { diff --git a/src/components/charts/PictorialBar.vue b/src/components/charts/PictorialBar.vue index e05e15d..e151d71 100644 --- a/src/components/charts/PictorialBar.vue +++ b/src/components/charts/PictorialBar.vue @@ -61,17 +61,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜瀹炴椂鍛婅", - name: "batteryrTimequery", - src: "#/batteryrTimequery/?alarmType=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "#/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/RoseChart.vue b/src/components/charts/RoseChart.vue index ade1477..2a6144b 100644 --- a/src/components/charts/RoseChart.vue +++ b/src/components/charts/RoseChart.vue @@ -61,17 +61,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "璁惧鐘舵�佹煡璇�", - name: "btsStatusTest", - src: "#/dataMager/btsStatus?workStauts=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "璁惧鐘舵�佹煡璇�", + name: "btsStatus", + src: "/dataTest/btsStatus?workStauts=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "璁惧鐘舵�佹煡璇�", + name: "btsStatusTest", + src: "#/dataMager/btsStatus?workStauts=" + value, + closable: true + }, + } + }, "*"); + } } }, toParentPage2(value) { diff --git a/src/components/charts/RoseChartED.vue b/src/components/charts/RoseChartED.vue index f8d2575..f1ae403 100644 --- a/src/components/charts/RoseChartED.vue +++ b/src/components/charts/RoseChartED.vue @@ -61,17 +61,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜淇℃伅缁熻鍒嗘瀽", - name: "produceTotal", - src: "#/dataMager/produceTotal/?xuHang=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜淇℃伅缁熻鍒嗘瀽", + name: "produceTotal", + src: "/dataMager/produceTotal/?xuHang=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜淇℃伅缁熻鍒嗘瀽", + name: "produceTotal", + src: "#/dataMager/produceTotal/?xuHang=" + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/RoseChartHea.vue b/src/components/charts/RoseChartHea.vue index eede143..48542c9 100644 --- a/src/components/charts/RoseChartHea.vue +++ b/src/components/charts/RoseChartHea.vue @@ -59,17 +59,31 @@ this.$options.chart.resize(); }, toParentPage() { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "钀藉悗鍗曚綋鏌ヨ", - name: "taskplan", - src: "#/reportStatistics/taskplan", - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "钀藉悗鍗曚綋鏌ヨ", + name: "taskplan", + src: "/reportStatistics/taskplan", + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "钀藉悗鍗曚綋鏌ヨ", + name: "taskplan", + src: "#/reportStatistics/taskplan", + closable: true + }, + } + }, "*"); + } }, setOption(opt) { this.$options.chart.setOption(opt); diff --git a/src/components/charts/abeamProChart.vue b/src/components/charts/abeamProChart.vue index c49f9aa..9d22102 100644 --- a/src/components/charts/abeamProChart.vue +++ b/src/components/charts/abeamProChart.vue @@ -72,17 +72,32 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "璁惧鐘舵�佹煡璇�", - name: "btsStatusTest", - src: "#/dataMager/btsStatus?workStauts=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "璁惧鐘舵�佹煡璇�", + name: "btsStatus", + src: "/dataTest/btsStatus?workStauts=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "璁惧鐘舵�佹煡璇�", + name: "btsStatusTest", + src: "#/dataMager/btsStatus?workStauts=" + value, + closable: true + }, + } + }, "*"); + } + } }, setOption(opt) { diff --git a/src/components/charts/chinaMap.vue b/src/components/charts/chinaMap.vue index 83e625d..e18a559 100644 --- a/src/components/charts/chinaMap.vue +++ b/src/components/charts/chinaMap.vue @@ -1,5 +1,6 @@ <template> - <div class="echarts-wrapper" @dblclick="dblclick"> + <new-china-map v-if="newPlatform==1"></new-china-map> + <div class="echarts-wrapper" @dblclick="dblclick" v-else> <div class="echarts-content" ref="chart" id="cityChart"> </div> @@ -43,6 +44,7 @@ // 鏀剧數鍥炬爣 import HomeDischargeImage from '@/assets/images/home-discharge.png'; import InfoPanel from '../indexPanel/InfoPanel.vue'; +import newChinaMap from './newChinaMap.vue'; let homeDischargeImage = new Image(); homeDischargeImage.src = HomeDischargeImage; let chartData = []; //chart鏁版嵁 @@ -51,12 +53,13 @@ let chart, chartLng, chartLat; export default { - components: { InfoPanel }, + components: { InfoPanel, newChinaMap }, name: "chinaMap", chart: "", chartData: "", data() { return { + newPlatform: 0, parentsStyle: {}, isAllScreen: false, timers: null, @@ -128,7 +131,9 @@ this.organizeData(sendData) } else { // 鍒濆鍖栭〉闈� - this.getAllMapOutlineAction(); + this.$nextTick(() => { + this.getAllMapOutlineAction(); + }) } }, organizeData(data) { @@ -570,6 +575,7 @@ this.mapInfoY = poit[1] - 190; }, 300); }); + this.newPlatform = sessionStorage.getItem('newPlatform') }, destroyed() { window.removeEventListener('resize', this.resize); diff --git a/src/components/charts/dischargeCircuit.vue b/src/components/charts/dischargeCircuit.vue index 776643f..11427e8 100644 --- a/src/components/charts/dischargeCircuit.vue +++ b/src/components/charts/dischargeCircuit.vue @@ -82,17 +82,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜瀹炴椂鍛婅", - name: "batteryrTimequery", - src: "#/batteryrTimequery/?alarmType=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "#/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/histogramAlternating.vue b/src/components/charts/histogramAlternating.vue index 412d29e..132c163 100644 --- a/src/components/charts/histogramAlternating.vue +++ b/src/components/charts/histogramAlternating.vue @@ -82,17 +82,32 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } + } }, setOption(opt) { diff --git a/src/components/charts/imgPieChart.vue b/src/components/charts/imgPieChart.vue index c611d86..9e599b4 100644 --- a/src/components/charts/imgPieChart.vue +++ b/src/components/charts/imgPieChart.vue @@ -70,17 +70,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/latticeBar.vue b/src/components/charts/latticeBar.vue index f38d5eb..9130fbb 100644 --- a/src/components/charts/latticeBar.vue +++ b/src/components/charts/latticeBar.vue @@ -67,17 +67,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜瀹炴椂鍛婅", - name: "batteryrTimequery", - src: "#/batteryrTimequery/?alarmType=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "#/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/monomerVoltage.vue b/src/components/charts/monomerVoltage.vue index 854e5bf..b8a62d8 100644 --- a/src/components/charts/monomerVoltage.vue +++ b/src/components/charts/monomerVoltage.vue @@ -82,17 +82,31 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫睜瀹炴椂鍛婅", - name: "batteryrTimequery", - src: "#/batteryrTimequery/?alarmType=" + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜瀹炴椂鍛婅", + name: "batteryrTimequery", + src: "#/batteryrTimequery/?alarmType=" + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/newChinaMap.vue b/src/components/charts/newChinaMap.vue new file mode 100644 index 0000000..1d204b8 --- /dev/null +++ b/src/components/charts/newChinaMap.vue @@ -0,0 +1,634 @@ +<template> + <div class="echarts-wrapper" @dblclick="dblclick"> + <div class="echarts-content" ref="chart" id="cityChart"> + + </div> + <div class="infoPanel" v-show="isShowInfoPanel" :style="{ left: mapInfoX + 'px', top: mapInfoY + 'px' }"> + <h4 class="infoPanel-Title"> + {{ mapInfoTitle }} + <div class="closeBtn" @click.self="isShowInfoPanel=false"></div> + </h4> + <div class="infoPanel-center"> + <info-panel ref="infoPanel"></info-panel> + </div> + </div> + </div> +</template> + +<script> +import * as echarts from 'echarts'; +import { + searchMap, + searchMapHomeState, + getAllMapOutlineAction, + searchByDevId, + searchHomeNum, +} from "../../assets/js/newApi"; + +import HomeNormal from '@/assets/images/home.png' +let mapHomeImage = new Image(); +mapHomeImage.src = HomeNormal; +// 姝e父鐨勫浘鏍� +import HomeNormalImage from '@/assets/images/home-normal.png'; +let homeNormalImage = new Image(); +homeNormalImage.src = HomeNormalImage; +// 鍏呯數鐨勫浘鏍� +import HomeChargeImage from '@/assets/images/home-charge.png'; +let homeChargeImage = new Image(); +homeChargeImage.src = HomeChargeImage; +// 鍛婅鍥炬爣 +import HomeWarnImage from '@/assets/images/home-warn.png'; +let homeWarnImage = new Image(); +homeWarnImage.src = HomeWarnImage; +// 鏀剧數鍥炬爣 +import HomeDischargeImage from '@/assets/images/home-discharge.png'; +import InfoPanel from '../indexPanel/newInfoPanel.vue'; +let homeDischargeImage = new Image(); +homeDischargeImage.src = HomeDischargeImage; +let chartData = []; //chart鏁版嵁 +let abnormalArr = []; //寮傚父鏁扮粍 +let tempData = []; //绔欑偣鏁扮粍 +let chart, chartLng, chartLat; + +export default { + components: { InfoPanel }, + name: "chinaMap", + chart: "", + chartData: "", + data() { + return { + parentsStyle: {}, + isAllScreen: false, + timers: null, + mapName: 'zhongguo', + mapInfoX: null, + mapInfoY: null, + mapInfoTitle: "", + isShowInfoPanel: false, + panelInfo: { + num: 369, + stationId: "42070471", + stationName: "璐靛窞鐪�-璐甸槼甯�-瑙傚北婀栧尯-瑙傚北婀栧尯鎶ょ悊瀛﹂櫌-璁惧1", + stationName3: "瑙傚北婀栧尯鎶ょ悊瀛﹂櫌", + address: "婀栧寳鐪佹姹夊競姝︽槍鍖�", + longitude: 114.37285909, + latitude: 30.56442241, + information: "", + fbsdeviceId: 910000111, + nums: { + code: 0, + sum: 0, + newsum: 0 + } + }, + } + }, + methods: { + findParents(node, select) { + var parent = node.parentNode; + if (parent === null || parent.className.indexOf(select) != -1) { + return parent; + } else { + return this.findParents(parent, select); + } + }, + dblclick(e) { + this.isAllScreen = !this.isAllScreen + let parents = this.findParents(e.currentTarget, 'vdr') + if (this.isAllScreen) { + this.parentsStyle = JSON.parse(JSON.stringify(parents.style)); + parents.style.transform = 'none'; + parents.style.width = '100%'; + parents.style.height = '100%'; + parents.style.position = 'fixed'; + parents.style.left = 0; + parents.style.right = 0; + parents.style.bottom = 0; + parents.style.top = 0; + parents.style.zIndex = 99999; + } else { + parents.style.transform = this.parentsStyle.transform; + parents.style.width = this.parentsStyle.width; + parents.style.height = this.parentsStyle.height; + parents.style.position = this.parentsStyle.position; + parents.style.left = 'initial'; + parents.style.right = 'initial'; + parents.style.bottom = 'initial'; + parents.style.top = 'initial'; + parents.style.zIndex = 'auto'; + } + this.$options.chart.resize(); + }, + setOption(opt) { + this.$options.chart.setOption(opt); + }, + setData(sendData) { + if (sendData) { + this.$options.chartData = sendData; + this.organizeData(sendData) + } else { + // 鍒濆鍖栭〉闈� + this.$nextTick(() => { + this.getAllMapOutlineAction(); + }) + } + }, + organizeData(data) { + let geoJson = require(`../../../public/mapJson/${this.mapName}.json`); + echarts.registerMap('map', geoJson); + // 鏁翠綋閰嶇疆椤� + let option = { + tooltip: { + trigger: 'item', + formatter: function (params) { + if (params.componentSubType == "map") { + return '' + } else if (params.componentSubType == "scatter") { + return params.name; + } + } + }, + visualMap: { + show: false, + min: 0, + max: 500, + left: 'left', + top: 'bottom', + text: ['楂�', '浣�'], // 鏂囨湰锛岄粯璁や负鏁板�兼枃鏈� + calculable: true, + seriesIndex: [1], + inRange: {} + }, + geo: { + map: "map", + layoutCenter: ["55%", "50%"], + layoutSize: "100%", + label: { + normal: { + show: true, + textStyle: { + color: '#fff' + } + }, + emphasis: { + textStyle: { + color: '#fff' + } + } + }, + roam: true, //鏄惁鍏佽缂╂斁 + mapLocation: { + width: "110%", + height: "97%" + }, + itemStyle: { + normal: { + borderColor: 'rgba(147, 235, 248, 1)', + borderWidth: 1, + areaColor: { + type: 'radial', + x: 0.5, + y: 0.5, + r: 0.8, + colorStops: [{ + offset: 0, + color: 'rgba(147, 235, 248, 0)' // 0% 澶勭殑棰滆壊 + }, { + offset: 1, + color: 'rgba(147, 235, 248, .2)' // 100% 澶勭殑棰滆壊 + }], + globalCoord: false // 缂虹渷涓� false + }, + shadowColor: 'rgba(128, 217, 248, 1)', + shadowOffsetX: -2, + shadowOffsetY: 2, + shadowBlur: 10 + }, + emphasis: { + areaColor: '#1ecee5', + borderWidth: 0, + label: { + show: false + } + } + } + }, + series: this.getSeries(data) + }; + // 璁剧疆閰嶇疆椤� + this.setOption(option); + }, + resize() { + setTimeout(() => { + this.$options.chart.resize(); + if (JSON.stringify(this.$options.chartData) != '{}') { + this.setData(this.$options.chartData); + } + }, 300) + }, + getSeries(opt) { + // 鏈厤缃畇eries + if (!opt || !opt.series) { + return []; + } + // 璁剧疆閰嶇疆椤� + let series = opt.series + // 杩斿洖 + return series; + }, + getAllMapOutlineAction() { + //鏌ヨ婵�娲昏疆寤撳浘 + getAllMapOutlineAction().then((res) => { + let rs = res.data; + if (rs.code == 1) { + let data = rs.data; + data.map((item) => { + if (item.status == 1) { + this.mapName = item.name; + } + }); + } + this.$nextTick(() => { + this.initPage(); + }); + }) + .catch((err) => { + console.log(err); + }); + }, + changeChartPanelStatus(homeData) { + //panel闈㈡澘鐘舵�佹敼鍙� + this.isShowInfoPanel = true; + let poit = this.convertMain(homeData.longitude, homeData.latitude); + this.mapInfoX = poit[0] - 120; + this.mapInfoY = poit[1] - 190; + this.mapInfoTitle = homeData.stationName; + this.$nextTick(() => { + this.$refs.infoPanel.setInfo(homeData); //浼犲�煎瓙缁勪欢 + }); + }, + convertMain(Lng, lat) { + //鏍规嵁缁忕含搴﹁绠楀畾浣� + // let getModel = chart.getModel().getSeries()[1]; + let seriesModel = chart.getModel().getSeriesByIndex(0); + let coordSys = seriesModel.coordinateSystem; + let point = coordSys.dataToPoint([Lng, lat]); + return point; + }, + startSearchMapHomeState() { + this.timers = setInterval(() => { + this.searchChartHomeState() + }, 60 * 1000) + }, + initPage() { + // 鍒濆鍖栧湴鍥� + this.initCityChart(); + chart = echarts.init(document.getElementById('cityChart')); + + chart.on("georoam", (params) => { + clearInterval(this.timers) + if (!this.isShowInfoPanel) { + return; + } + this.isShowInfoPanel = false; + this.timers = setTimeout(() => { + this.isShowInfoPanel = true; + let poit = this.convertMain(chartLng, chartLat); + this.mapInfoX = poit[0] - 120; + this.mapInfoY = poit[1] - 190; + + var option = chart.getOption(); //鑾峰緱option瀵硅薄 + if (params.zoom != null && params.zoom != undefined) { + //鎹曟崏鍒扮缉鏀炬椂 + option.series[0].zoom = option.geo[0].zoom; //涓嬪眰geo鐨勭缉鏀剧瓑绾ц窡鐫�涓婂眰鐨刧eo涓�璧锋敼鍙� + option.series[0].center = option.geo[0].center; //涓嬪眰鐨刧eo鐨勪腑蹇冧綅缃殢鐫�涓婂眰geo涓�璧锋敼鍙� + } else { + //鎹曟崏鍒版嫋鏇虫椂 + option.series[0].center = option.geo[0].center; //涓嬪眰鐨刧eo鐨勪腑蹇冧綅缃潃涓婂眰geo涓�璧锋敼鍙� + } + chart.setOption(option); //璁剧疆option + + // this.startSearchMapHomeState(); + }, 300); + }); + chart.off("click"); //闃叉chart鐐瑰嚮瑙﹀彂澶氭 + chart.on("click", (params) => { + //鐐瑰嚮璺宠浆瀹炴椂鏁版嵁 + if (params.seriesType == "scatter") { + chartLng = params.data.longitude; + chartLat = params.data.latitude; + this.showChartPanel( + params.data.stationId, + params.data.fbsdeviceId, + params.data + ); + } + }); + }, + // 鏌ヨ鍛婅钀藉悗鐨勪俊鎭� + showChartPanel(sId, dev_id, homeData) { + // 妫�娴嬫槸鍚﹀瓨鍦�3D鏈烘埧 + searchByDevId({ + deviceId: dev_id, + }) + .then((res) => { + let rs = res.data; + if (rs.data.length != 0) { + this.areas = rs.data; + //this.hdwDialog = true; + this.showThreeHomeDialog(this.areas); + } else { + searchHomeNum({ + stationId: sId, + }) + .then((res) => { + let rs = res.data; + homeData.nums = rs.data; + this.changeChartPanelStatus(homeData); + }) + .catch((error) => { + console.log(error); + }); + } + }) + .catch((error) => { + console.log(error); + }); + }, + initCityChart() { + searchMap().then((res) => { + let rs = res.data.data; + let list = this.mergeMapInfos(rs); + if (list != undefined && list.length > 0) { + list.map((item) => { + item.name = item.stationName; + item.value = []; + item.value.push(item.longitude); + item.value.push(item.latitude); + tempData.push(item) + }) + this.searchChartHomeState() + this.startSearchMapHomeState(); + } else { + this.initChart([], []); + } + }).catch((err) => { + console.log(err) + }) + }, + searchChartHomeState() { + searchMapHomeState().then((res) => { + let rsState = res.data; + let arr = []; + abnormalArr = []; + if (rsState.code === 1) { + let data = rsState.data; + data.map((item) => { + let infos = tempData.filter((jtem) => { + return jtem.stationId == item.stationId + }) + + if (infos.length > 0) { + let info = JSON.parse(JSON.stringify(infos[0])); + switch (item.num) { + case 1: // 钀藉悗 + info.img = HomeDischargeImage; + info.color = '#ff6a6a'; + abnormalArr.push(info); + break; + case 2: // 鍛婅 + info.img = HomeWarnImage; + info.color = '#d4ac6e'; + abnormalArr.push(info); + break; + case 3: + info.img = HomeChargeImage; + info.color = '#4ba1fa'; + abnormalArr.push(info); + break; + default: + info.img = HomeNormalImage; + break; + } + arr.push(info) + } + }) + let arrId = []; + for (let item of arr) { + if (arrId.indexOf(item['stationId']) == -1) { + arrId.push(item['stationId']); + chartData.push(item); + } + } + this.initChart(chartData, abnormalArr); + + } + }).catch((err) => { + console.log(err) + }) + }, + initChart(chartData, abnormalArr) { //鍒濆鍖朿hart鍥� + let option = {}; + if (abnormalArr.length > 0) { + option = { + series: [{ //鍥剧墖 + name: '鍥剧墖', + type: 'scatter', + coordinateSystem: 'geo', + symbol: function (value, params) { + return 'image://' + params.data.img + }, + symbolSize: [26, 26], + label: { + normal: { + show: false, + } + }, + data: chartData, + showEffectOn: 'render', + rippleEffect: { + brushType: 'stroke' + }, + hoverAnimation: true, + zlevel: 2 + }, { //娉㈢汗鐐� + type: 'effectScatter', + coordinateSystem: 'geo', + showEffectOn: 'render', + zlevel: 1, + rippleEffect: { + period: 4, + scale: 4, + brushType: 'fill' + }, + hoverAnimation: false, + label: { + normal: { + show: false + }, + }, + itemStyle: { + normal: { + color: function (value) { + return value.data.color + }, + shadowBlur: 8, + shadowColor: function (value) { + return value.data.color + }, + } + }, + symbolSize: [15, 15], + data: abnormalArr + }] + }; + } else { + option = { + series: [{ //鍥剧墖 + name: '鍥剧墖', + type: 'scatter', + coordinateSystem: 'geo', + symbol: function (value, params) { + return 'image://' + params.data.img + }, + symbolSize: [26, 26], + label: { + normal: { + show: false, + } + }, + data: chartData, + showEffectOn: 'render', + rippleEffect: { + brushType: 'stroke' + }, + hoverAnimation: true, + zlevel: 2 + }] + }; + } + this.setData(option); + window.addEventListener('resize', this.resize); + }, + mergeMapInfos(list) { + var mergeData = []; + // 閬嶅巻list + for (var i = 0; i < list.length; i++) { + var _list = list[i]; + var isIn = this.checkMapInfoIsIn(_list, mergeData); + if (isIn == -1) { + mergeData.push(_list); + } + } + // 杩斿洖鍚堝苟鍊� + return mergeData; + }, + checkMapInfoIsIn(mapInfo, mergeData) { + var rs = -1; + // 閬嶅巻mergeData + for (var i = 0; i < mergeData.length; i++) { + var _mergeData = mergeData[i]; + // 缁忕含搴︾浉鍚� + if (mapInfo.latitude == _mergeData.latitude && mapInfo.longitude == _mergeData.longitude) { + rs = i; + } + } + return rs; + }, + showThreeHomeDialog(areas) { + window.parent.parent.postMessage( + { + cmd: "showDialog", + params: { + dialog: "hdwDialog", + pageInfo: areas, + }, + }, + "*" + ); + }, + outClear() { + window.removeEventListener('resize', this.resize); + clearInterval(this.timers) + this.timers = null + } + }, + mounted() { + // 鍩轰簬鍑嗗濂界殑dom锛屽垵濮嬪寲echarts瀹炰緥 + this.$options.chart = echarts.init(this.$refs.chart); + // 鐩戝惉chartMap鐨勯潰鏉� + window.addEventListener("resize", () => { + if (!this.isShowInfoPanel || !this.mapName) { + return; + } + this.isShowInfoPanel = false; + setTimeout(() => { + this.isShowInfoPanel = true; + let poit = this.convertMain(chartLng, chartLat); + this.mapInfoX = poit[0] - 120; + this.mapInfoY = poit[1] - 190; + }, 300); + }); + }, + destroyed() { + window.removeEventListener('resize', this.resize); + clearInterval(this.timers) + }, +} +</script> + +<style scoped> +.infoPanel { + position: absolute; + background-color: #ffffff; + color: rgb(0, 0, 0); + border: 1px solid #999; + z-index: 99; +} + +.infoPanel .infoPanel-Title { + border-bottom: 1px solid #ccc; + height: 31px; + line-height: 30px; + background-color: #f9f9f9; + overflow: hidden; + height: 30px; + padding: 0 5px; + font-size: 12px; + position: relative; +} + +.infoPanel .infoPanel-Title .closeBtn { + background: url("../../assets/images/iw_close1d3.gif") 0 0 no-repeat; + background-size: 100% 100%; + position: absolute; + top: 9px; + right: 12px; + width: 10px; + height: 10px; + user-select: none; + overflow: hidden; + cursor: pointer; + line-height: 9999px; + z-index: 10000; +} + +.infoPanel .infoPanel-center { + padding: 3px 5px; + overflow-x: auto; + overflow-y: hidden; +} + +.infoPanel::after { + content: ""; + display: block; + z-index: 5; + position: absolute; + bottom: -31px; + width: 58px; + height: 31px; + left: 125px; + background: url("../../assets/images/iw_tail.png") 0 0 no-repeat; + background-size: 100% 100%; +} +</style> \ No newline at end of file diff --git a/src/components/charts/prossPieChart.vue b/src/components/charts/prossPieChart.vue index 968f5e4..ac843ba 100644 --- a/src/components/charts/prossPieChart.vue +++ b/src/components/charts/prossPieChart.vue @@ -32,17 +32,31 @@ methods: { toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } } }, setOption(opt) { diff --git a/src/components/charts/triangleBarChart.vue b/src/components/charts/triangleBarChart.vue index 6161ca5..28cdfa1 100644 --- a/src/components/charts/triangleBarChart.vue +++ b/src/components/charts/triangleBarChart.vue @@ -68,17 +68,32 @@ }, toParentPage(value) { if (typeof (value) == 'string') { - window.parent.parent.postMessage({ - cmd: "syncPage", - params: { - pageInfo: { - label: "鐢垫簮瀹炴椂鍛婅", - name: "powerRealtimeInfo", - src: '#/powerRealtimeInfo/?alarmType=' + value, - closable: true - }, - } - }, "*"); + if (sessionStorage.getItem('newPlatform') == 1) { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '/alarmMager/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } else { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫簮瀹炴椂鍛婅", + name: "powerRealtimeInfo", + src: '#/powerRealtimeInfo/?alarmType=' + value, + closable: true + }, + } + }, "*"); + } + } }, setOption(opt) { diff --git a/src/components/indexPanel/newInfoPanel.vue b/src/components/indexPanel/newInfoPanel.vue new file mode 100644 index 0000000..71701e2 --- /dev/null +++ b/src/components/indexPanel/newInfoPanel.vue @@ -0,0 +1,148 @@ +<template> + <div class="map-panel-content"> + <div class="content-item content-item-nowrap"> + 钃勭數姹犵粍鍛婅鏁扮洰锛歿{warnText}} + <a class="content-detail" href="javascript:;" @click="goBattWarn">璇︽儏>></a> + </div> + <div class="content-item content-item-nowrap"> + 钃勭數姹犵粍钀藉悗鏁扮洰锛歿{info.nums.numBadBatt}} + <a class="content-detail" href="javascript:;" @click="goBehind">璇︽儏>></a> + </div> + <div class="content-item"> + <el-button type="primary" size="mini" @click="goRealTime">瀹炴椂鏁版嵁</el-button> + <el-button type="primary" size="mini" @click="goHistory">鍘嗗彶鏁版嵁</el-button> + </div> + <div class="content-item">鍦板潃锛歿{info.address}}</div> + </div> +</template> + +<script> + +export default { + data() { + return { + isCanDel: false, + username: sessionStorage.getItem('username'), + info: { + num: 369, + stationId: "42070471", + stationName: "璐靛窞鐪�-璐甸槼甯�-瑙傚北婀栧尯-瑙傚北婀栧尯鎶ょ悊瀛﹂櫌-璁惧1", + stationName3: "瑙傚北婀栧尯鎶ょ悊瀛﹂櫌", + address: "婀栧寳鐪佹姹夊競姝︽槍鍖�", + longitude: 114.37285909, + latitude: 30.56442241, + information: "", + fbsdeviceId: 910000111, + nums: { + code: 0, + numBadBatt: 0, + numPlan: 0, + battAlarmStr: "0,0" + } + } + } + }, + methods: { + // 璺宠浆鍒板巻鍙叉暟鎹� + goHistory() { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鍘嗗彶鏁版嵁", + name: "history", + src: "/dataTest/history" + this.search, + closable: true + } + } + }, "*"); + }, + // 璺宠浆鍒板疄鏃舵暟鎹� + goRealTime() { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "瀹炴椂鐩戞帶", + name: "movingRingSystem", + src: "/dataTest/movingRingSystem" + this.search + '&listReload=1', + closable: true + } + } + }, "*"); + }, + // 璺宠浆鍛婅鐣岄潰 + goBattWarn() { + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "鐢垫睜鍛婅瀹炴椂鏌ヨ", + name: "batteryrTimequery", + src: "/alarmMager/batteryrTimequery" + this.search + '&fromType=fromIndex', + closable: true + } + } + }, "*"); + }, + // 璺宠浆鍒拌惤鍚庢満鎴� + goBehind() { + // this.$layer.msg('璇ュ姛鑳芥殏鏈紑鍚�'); + window.parent.parent.postMessage({ + cmd: "syncPage", + params: { + pageInfo: { + label: "钀藉悗鍗曚綋鏌ヨ", + name: "taskplan", + src: "/reportStatistics/taskplan?province=" + this.info.StationName.split('-')[0] + '&home=' + this.info.StationName + '&fromType=fromIndex', + closable: true + } + } + }, "*"); + }, + // 璺宠浆鍒板欢鏃� + goTimeout() { + this.$layer.msg('璇ュ姛鑳芥殏鏈紑鍚�'); + }, + setInfo(info) { + this.info = info; + }, + setType(type) { + this.type = type; + } + }, + computed: { + search() { + let list = this.info.stationName.split('-'); + return '?province=' + list[0] + '&city=' + list[1] + '&county=' + list[2] + '&home=' + list[3] + }, + warnText() { + let warns = this.info.nums.battAlarmStr.split(","); + return "鏈‘璁わ細" + (warns[1] || 0) + "; 宸茬‘璁わ細" + (warns[0] || 0); + } + }, +} +</script> + +<style scoped> +.map-panel-content { + width: 300Px; +} + +.content-item { + padding: 4px; + font-size: 12px; +} + +.content-item-nowrap { + white-space: nowrap; +} + +.content-detail { + margin-left: 8px; +} + +.box-height { + height: 32px; +} +</style> \ No newline at end of file diff --git a/src/pages/exhibition.vue b/src/pages/exhibition.vue index 4a7f94a..773ebf9 100644 --- a/src/pages/exhibition.vue +++ b/src/pages/exhibition.vue @@ -49,6 +49,9 @@ if (this.$route.query.userId) { localStorage.setItem('userId', this.$route.query.userId); } + if (this.$route.query.newPlatform) { + sessionStorage.setItem('newPlatform', this.$route.query.newPlatform); + } this.nowlayOut.appName = this.$route.query.name; if (this.$route.query.head && this.$route.query.head == 1) { this.isHeader = false @@ -106,7 +109,13 @@ nowBox[0].appendChild(chartModular.$el) this.modularArr.push(chartModular); } - chartModular.setData(); + if (chartModular.id == "chart14") { + this.$nextTick(() => { + chartModular.$children[0].setData() + }) + } else { + chartModular.setData(); + } chartModular.resize(); }, 0) -- Gitblit v1.9.1