From 5a087f3a8f6db1f6344dc4a79af2e4c85d27cf1b Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期四, 05 五月 2022 17:14:22 +0800 Subject: [PATCH] 2.0 接口对接 --- src/assets/units/function/getConduct.js | 11 src/pages/monitoring/js/api.js | 228 ++-- src/store/modules/user.js | 8 src/assets/js/websocket/plus.js | 82 + src/pages/login/js/api.js | 40 src/pages/alarmMager/js/api.js | 71 src/assets/js/axios.js | 30 src/assets/units/function/getQgth.js | 16 src/pages/alarmMager/batteryrTimequery.vue | 92 - src/pages/login/login.vue | 20 src/pages/alarmMager/batteryrHistoryquery.vue | 8 src/pages/monitoring/history-monitoring.vue | 417 ++++---- src/pages/alarmMager/deviceHistoryquery.vue | 4 src/assets/js/websocket/index.js | 77 + src/assets/units/function/getSpecialPointIndex.js | 76 + src/assets/units/index.js | 9 src/pages/alarmMager/deviceTimequery.vue | 4 src/pages/monitoring/real-monitoring.vue | 1394 +++++++++++++++++++------------ src/global/common.js | 18 src/assets/js/websocket/getWsUrl.js | 15 20 files changed, 1,598 insertions(+), 1,022 deletions(-) diff --git a/src/assets/js/axios.js b/src/assets/js/axios.js index 3e5a73c..bc00c62 100644 --- a/src/assets/js/axios.js +++ b/src/assets/js/axios.js @@ -1,36 +1,18 @@ import Vue from 'vue'; import axios from 'axios'; -import rejectReplay from "@/assets/js/tools/rejectReplay"; if (process.env.NODE_ENV == 'dev') { // 璺ㄥ煙璇锋眰 - axios.defaults.baseURL = 'http://localhost:8919/fg/'; + // axios.defaults.baseURL = 'http://localhost:8919/fg/'; + axios.defaults.baseURL = 'http://localhost:8091/fg/'; axios.defaults.withCredentials = true; // 淇濇寔璇锋眰澶� +} else { + axios.defaults.baseURL = location.protocol + '//' + location.host + '/fg/'; } -let skipUrls = ["Server_stateAction_action_getTimestamp"]; + // 娣诲姞璇锋眰鎷︽埅鍣� axios.interceptors.request.use(function (config) { - // 闃查噸鏀炬搷浣� - let rejectReplayStr = rejectReplay(); - let url = config.url; - let isIn = false; - for(let i=0; i<skipUrls.length; i++) { - let skipUrl = skipUrls[i]; - if(skipUrl == url) { - isIn = true; - break; - } - } - if(!isIn) { - if (url.indexOf("?") == -1) { - url = url.trim() + "?" + rejectReplayStr; - } else { - url = url.trim() + "&" + rejectReplayStr; - } - } - - config.url = url; // 鍦ㄥ彂閫佽姹備箣鍓嶅仛浜涗粈涔� return config; }, function (error) { @@ -48,4 +30,4 @@ Vue.prototype.$axios = axios; -export default axios; \ No newline at end of file +export default axios; diff --git a/src/assets/js/websocket/getWsUrl.js b/src/assets/js/websocket/getWsUrl.js new file mode 100644 index 0000000..0c82299 --- /dev/null +++ b/src/assets/js/websocket/getWsUrl.js @@ -0,0 +1,15 @@ +/** + * 鑾峰彇Websocket鐨勮繛鎺� + * @param action + * @returns {string} + */ +function getWsUrl(action, port) { + let _port = port ? port : 8091; + let hostname = window.location.hostname; + if (process.env.NODE_ENV == 'dev') { + hostname = "localhost"; + } + return 'ws://' + hostname + ':' + _port + '/fg/' + action; +} + +export default getWsUrl; \ No newline at end of file diff --git a/src/assets/js/websocket/index.js b/src/assets/js/websocket/index.js new file mode 100644 index 0000000..0e88106 --- /dev/null +++ b/src/assets/js/websocket/index.js @@ -0,0 +1,77 @@ +import getWsUrl from './getWsUrl'; + +export default function (url) { + const wsUri = getWsUrl(url); + // 閲嶈繛鏃堕棿闂撮殧 榛樿10绉� + const reConnectDelay = 10 * 1000; + return { + data() { + return { + SOCKET: null, + reConnectDelay, + timer: null + } + }, + computed: { + isWSOpen () { + return !!(this.SOCKET && 1 == this.SOCKET.readyState); + } + }, + methods: { + // 鎵撳紑閾炬帴 + openSocket() { + // 鍒濆鍖朩ebSocket + this.WSClose(); + this.WSInit(); + }, + // 鍒濆鍖� + WSInit() { + // 鏈鍒濆鍖栧垵濮嬪寲 + if (!this.isWSOpen) { + console.log('=====WSinit, url:', wsUri); + this.SOCKET = new WebSocket(wsUri); + this.SOCKET.onmessage = this.onWSMessage; + this.SOCKET.onopen = this.onWSOpen; + this.SOCKET.onerror = this.onWSError; + this.SOCKET.onclose = this.WSClose; + } + }, + onWSOpen() { + }, + onWSMessage() { + }, + onWSError(Event) { + console.log('閾炬帴澶辫触', wsUri); + this.WSClose(Event); + }, + WSClose(Event) { + if (this.isWSOpen) { + console.log('閾炬帴鍏抽棴', wsUri, Event); + this.SOCKET.close(); + this.SOCKET = null; + // 娌℃湁event瀵硅薄 鍒欎负鎵嬪姩鍏抽棴 + if (Event) { + this.reConnect(); + } + } + }, + // 閲嶈繛 + reConnect () { + // 閲嶈繛璁℃椂寮�濮� 灏变笉鍙﹂噸杩� + if (this.timer) { + return; + } + this.timer = setTimeout(() => { + this.timer = null; + this.WSInit(); + }, this.reConnectDelay); + } + }, + mounted () { + this.openSocket(); + }, + beforeDestroy() { + this.WSClose(); + } + } +} \ No newline at end of file diff --git a/src/assets/js/websocket/plus.js b/src/assets/js/websocket/plus.js new file mode 100644 index 0000000..e3591f1 --- /dev/null +++ b/src/assets/js/websocket/plus.js @@ -0,0 +1,82 @@ +import getWsUrl from './getWsUrl'; + +/** + * @param {...any} urls 鍦板潃鍙互浼犲涓� 鐢ㄦ潵鍒濆鍖栧涓笉鍚岀殑websocket瀹炰緥 + * 瀵瑰簲鐨剋ebsocket瀵硅薄鍙婁簨浠堕兘甯︿笂瀵瑰簲鐨勭郴鍙� this.SOCKET1 onWSMessage1 绛� + * @returns minxins瀵硅薄 + */ +export default function (...urls) { + let data = {}, + computed = {}, + ourl = {}, + methods = {}, + len = urls.length; + const fn = () => { }; + for (let i = 0; i < len; i++) { + let idx = i + 1; + data['SOCKET' + idx] = null; + ourl[idx] = getWsUrl(urls[i]); + computed['isWSOpen' + idx] = function () { + // console.log(this, 'computed=====this'); + return !!(this['SOCKET' + idx] && 1 == this['SOCKET' + idx].readyState); + } + methods['onWSMessage' + idx] = fn; + methods['onWSOpen' + idx] = fn; + methods['onWSError' + idx] = (() => { + return () => { + console.log('閾炬帴澶辫触', ourl[idx]) + } + })(idx); + methods['WSClose' + idx] = function () { + if (this['isWSOpen' + idx]) { + this['SOCKET' + idx].close(); + } + } + } + return { + data() { + return { + ...data + } + }, + computed: { + ...computed + }, + methods: { + ...methods, + // 鎵撳紑閾炬帴 + openSocket() { + // 鍒濆鍖朩ebSocket + this.WSClose(); + this.WSInit(); + }, + // 鍒濆鍖� + WSInit() { + // 鏈鍒濆鍖栧垵濮嬪寲 + for (let i = 0; i < len; i++) { + let idx = i + 1; + if (!this['isWSOpen' + idx]) { + console.log('=====WSinit, url:', ourl[idx]); + this['SOCKET' + idx] = new WebSocket(ourl[idx]); + this['SOCKET' + idx].onmessage = this['onWSMessage' + idx]; + this['SOCKET' + idx].onopen = this['onWSOpen' + idx]; + this['SOCKET' + idx].onerror = this['onWSError' + idx]; + this['SOCKET' + idx].onclose = this['WSClose' + idx]; + } + } + }, + WSClose() { + for (let i = 0; i < len; i++) { + let idx = i + 1; + this['WSClose' + idx](); + } + } + }, + mounted() { + this.openSocket(); + }, + beforeDestroy() { + this.WSClose(); + } + } +} \ No newline at end of file diff --git a/src/assets/units/function/getConduct.js b/src/assets/units/function/getConduct.js new file mode 100644 index 0000000..362f0ae --- /dev/null +++ b/src/assets/units/function/getConduct.js @@ -0,0 +1,11 @@ +/** + * 鑾峰彇鐢靛鐨勭畻娉� + * @param res 鍐呴樆 + * @param vol 瀹為檯鐢靛帇 + * @returns {number} 鐢靛鍊� + */ +function getConduct(res, vol) { + return res?((1000/res)*(vol/2)).toHold(0):0; +} + +export default getConduct; \ No newline at end of file diff --git a/src/assets/units/function/getQgth.js b/src/assets/units/function/getQgth.js index 9639c5c..bfb6258 100644 --- a/src/assets/units/function/getQgth.js +++ b/src/assets/units/function/getQgth.js @@ -11,22 +11,22 @@ label: '', title: '---' }; - if(data.code) { - rs.qg = groupVol?(data.minVal/groupVol*100).toFixed(1):0; - rs.qt = groupVol?(data.maxVal/groupVol*100).toFixed(1):0; - rs.qh = groupVol?((data.maxVal-data.minVal)/groupVol*100).toFixed(1):0; + if (data.code) { + rs.qg = groupVol ? (data.minVal / groupVol * 100).toFixed(1) : 0; + rs.qt = groupVol ? (data.maxVal / groupVol * 100).toFixed(1) : 0; + rs.qh = groupVol ? ((data.maxVal - data.minVal) / groupVol * 100).toFixed(1) : 0; rs.label = getBattIsGood(rs); - rs.title = "Qg="+rs.qg+"%;Qt="+rs.qt+"%;Qh="+rs.qh+"%;鐢垫睜鎬ц兘璇勪及锛�"+rs.label; + rs.title = "Qg=" + rs.qg + "%;Qt=" + rs.qt + "%;Qh=" + rs.qh + "%;鐢垫睜鎬ц兘璇勪及锛�" + rs.label; } return rs; } function getBattIsGood(data) { - if((data.qg<98)||(data.qt<99)) { + if ((data.qg < 98) || (data.qt < 99)) { return "涓嶆甯�"; - }else if((data.qg>102)&&(data.qt>103)){ + } else if ((data.qg > 102) && (data.qt > 103)) { return "姝e父"; - }else{ + } else { return "鍙兘涓嶆甯�"; } } diff --git a/src/assets/units/function/getSpecialPointIndex.js b/src/assets/units/function/getSpecialPointIndex.js new file mode 100644 index 0000000..ce8e312 --- /dev/null +++ b/src/assets/units/function/getSpecialPointIndex.js @@ -0,0 +1,76 @@ +// 鑾峰彇鏁版嵁闆嗙殑鐗规畩鐐� +function getSpecialPointIndex(data) { + let rs = { + code: 0, // 鏍囪瘑鏄惁鎵惧埌椹煎嘲閿呭簳 + min: -Infinity, // 閿呭簳鎵�鍦ㄧ殑鐐� + minVal: 0, + max: Infinity, // 椹煎嘲鎵�鍦ㄧ殑鐐� + maxVal: 0, + }; + if(data.length < 20) { + rs.code = 0; + return rs; + } + for(let i=0; i<data.length; i++) { + let item = data[i]; + // 妫�鏌ュ綋鍓嶇偣鏄惁涓洪攨搴� + if(rs.min == -Infinity) { + let isLow = true; + for(let k=i-3; k<=i+3; k++) { + if(k==i) { + continue; + } + if(data[k] == undefined || data[k]<item) { + rs.min = -Infinity; + isLow = false; + break; + } + } + + if(isLow) { + rs.min = i; + rs.minVal = item; + } + } + + // 妫�鏌ユ槸鍚︿负椹煎嘲 + if(rs.min != -Infinity && rs.max == Infinity) { + let isHigh = true; + for(let k=i-2; k<=i+2; k++) { + if(k==i) { + continue; + } + if(data[k] == undefined || data[k]>=item) { + rs.max = Infinity; + isHigh = false; + break; + } + } + + if(isHigh) { + rs.max = i; + rs.maxVal = item; + } + } + } + if(rs.min != -Infinity && rs.max == Infinity) { + let index = data.length - 10; + rs.max = index; + rs.maxVal = data[index]; + } + + // 鏈壘鍒伴攨搴� + if(rs.min == -Infinity) { + rs.code = 0; + }else { + rs.code = 1; + } + + // 椹煎嘲鍑虹幇鍦ㄩ攨搴曠殑鍓嶉潰 + if(rs.max < rs.min) { + rs.code = 0; + } + return rs; +} + +export default getSpecialPointIndex; \ No newline at end of file diff --git a/src/assets/units/index.js b/src/assets/units/index.js index c0f1f67..eafe4fe 100644 --- a/src/assets/units/index.js +++ b/src/assets/units/index.js @@ -61,6 +61,13 @@ // 鑾峰彇Qt,Qg,Qh鍜岀數姹犳�ц兘鐨勫�� import getQgth from './function/getQgth' +// 鑾峰彇鐢靛鐨勭畻娉� +import getConduct from './function/getConduct' + +// 鑾峰彇鏁版嵁闆嗙殑鐗规畩鐐� +import getSpecialPointIndex from './function/getSpecialPointIndex' + + export default { deepClone, deepMerge, @@ -83,4 +90,6 @@ GetMonomerCap, GetHourRate, getQgth, + getConduct, + getSpecialPointIndex, } \ No newline at end of file diff --git a/src/global/common.js b/src/global/common.js index 895cb25..aba364c 100644 --- a/src/global/common.js +++ b/src/global/common.js @@ -1,4 +1,3 @@ -import store from "@/store"; //鏍煎紡鍖栨椂闂� Date.prototype.format = function (format) { var o = { @@ -25,19 +24,4 @@ var hold = this.toFixed(value); hold = Number(hold); return hold; -}; - -/* eslint-disable */ -; (function (doc, win) { - let docEl = doc.documentElement, - resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', - recalc = function () { - let clientWidth = docEl.clientWidth; - if (!clientWidth) return; - let fontSize = 20 * (clientWidth / 1920); - docEl.style.fontSize = fontSize + 'px'; - }; - if (!doc.addEventListener) return; - win.addEventListener(resizeEvt, recalc, false); - doc.addEventListener('DOMContentLoaded', recalc, false); -})(document, window); \ No newline at end of file +}; \ No newline at end of file diff --git a/src/pages/alarmMager/batteryrHistoryquery.vue b/src/pages/alarmMager/batteryrHistoryquery.vue index 734a491..c218fe9 100644 --- a/src/pages/alarmMager/batteryrHistoryquery.vue +++ b/src/pages/alarmMager/batteryrHistoryquery.vue @@ -126,9 +126,9 @@ <script> import { - dataType /* 缁存姢鍖� */, + searchProvince /* 缁存姢鍖� */, roomsStation /* 鏈烘埧绔欑偣 */, - batterySeach /* 钃勭數姹犵粍 */, + batterySearch /* 钃勭數姹犵粍 */, historySeroom /*鍛婅淇℃伅 */, hisDelet /*鍒犻櫎 */ } from "@/pages/alarmMager/js/api" @@ -264,7 +264,7 @@ methods: { /* 缁存姢鍖� */ async vindicateData() { - const resType = await dataType(); + const resType = await searchProvince(); let typeList = JSON.parse(resType.data.result).data.map((item) => { return { label: item, @@ -301,7 +301,7 @@ this.selectLable3 = ""; this.showPicker2 = false // 鏋勯�犳煡璇㈡潯浠� - const batteryss = await batterySeach({ + const batteryss = await batterySearch({ UNote: this.selectValue1, UName: this.selectValue2, }); diff --git a/src/pages/alarmMager/batteryrTimequery.vue b/src/pages/alarmMager/batteryrTimequery.vue index 5ed6883..5ce3e3c 100644 --- a/src/pages/alarmMager/batteryrTimequery.vue +++ b/src/pages/alarmMager/batteryrTimequery.vue @@ -114,7 +114,7 @@ <van-picker show-toolbar :columns="newRoms" value-key="label" @confirm="storageBatterys" @cancel="showPicker2 = false" title="鏈烘埧绔欑偣" /> </van-popup> <van-popup v-model="showPicker3" round position="bottom"> - <van-picker show-toolbar :columns="options" value-key="BattGroupName" @confirm="selectBatter" @cancel="showPicker3 = false" title="钃勭數姹犵粍" /> + <van-picker show-toolbar :columns="options" value-key="battGroupName" @confirm="selectBatter" @cancel="showPicker3 = false" title="钃勭數姹犵粍" /> </van-popup> <div class="refBtn" @click="onRefresh"> <van-icon name="replay" /> @@ -124,9 +124,9 @@ <script> import { - dataType /* 缁存姢鍖� */, + searchProvince /* 缁存姢鍖� */, roomsStation /* 鏈烘埧绔欑偣 */, - batterySeach /* 钃勭數姹犵粍 */, + batterySearch /* 钃勭數姹犵粍 */, newsAlarm /*鍛婅淇℃伅 */, deletionRecord /* 鍒犻櫎 */, reporTemergency /* 纭鍛婅 */, @@ -261,8 +261,8 @@ methods: { /* 缁存姢鍖� */ async vindicateData() { - const resType = await dataType(); - let typeList = JSON.parse(resType.data.result).data.map((item) => { + const resType = await searchProvince(); + let typeList = resType.data.data.map((item) => { return { label: item, value: item, @@ -276,10 +276,11 @@ /* 鏈烘埧绔欑偣 */ async computerSite() { const roomsSeation = await roomsStation({ - UNote: this.selectValue1, + stationName1: this.selectValue1, }); - if (roomsSeation.data.result) { - let newRoms = JSON.parse(roomsSeation.data.result).data.map((item) => { + let res = roomsSeation.data; + if (res.code) { + let newRoms = res.data.map((item) => { return { label: item, value: item, @@ -298,13 +299,14 @@ this.selectLable3 = ""; this.showPicker2 = false // 鏋勯�犳煡璇㈡潯浠� - const batteryss = await batterySeach({ - UNote: this.selectValue1, - UName: this.selectValue2, + const batteryss = await batterySearch({ + stationName1: this.selectValue1, + stationName: this.selectValue2, }); - if (batteryss.data.result) { - let options = JSON.parse(batteryss.data.result).data.map((item) => { - item.BattGroupName = `${item.BattGroupName}-${item.MonCount}鑺俙; + let res = batteryss.data; + if (res.code) { + let options = res.data.map((item) => { + item.battGroupName = `${item.battGroupName}-${item.monCount}鑺俙; return item; }); this.options = options; @@ -324,8 +326,8 @@ //閫夋嫨鐢垫睜缁� selectBatter(value) { if (value) { - this.selectValue3 = value.BattGroupId - this.selectLable3 = value.BattGroupName + this.selectValue3 = value.battGroupId + this.selectLable3 = value.battGroupName } this.showPicker3 = false @@ -359,45 +361,33 @@ }); // 涓�绾у拰浜岀骇鍛婅 params.num = this.checkbox.Level_one_warn.bol ? 1 : 0; - params.BattGroupId = this.checkbox.Level_two_warn.bol ? 2 : 0; + params.battGroupId = this.checkbox.Level_two_warn.bol ? 2 : 0; // 涓婇檺鍜屼笅闄愬憡璀� params.alm_id = this.checkbox.alm_id.bol ? 1 : 100; params.alm_signal_id = this.checkbox.alm_signal_id.bol ? 0 : 100; let postData = { - bmd: { - page: { - pageSize: tab.page.pageSize, - pageCurr: tab.page.pageCurr, - }, - binf: { - StationName1: this.selectValue1, - stationName: this.selectValue2, - BattGroupId: this.selectValue3 ? this.selectValue3 : 0, - }, - mainf: { - usr_id: params.usr_id, - fault_type_id: params.fault_type_id, - uname: params.uname, - fault_level: params.fault_level, - record_uid: params.record_uid, - maint_type_id: params.maint_type_id, - maint_close: params.maint_close, - master_id: "0", - maint_done: params.maint_done, - num: params.num, - BattGroupId: params.BattGroupId, - master_audit: params.master_audit, - appoint_uid: params.appoint_uid, - fault_type: params.fault_type, - }, - adata: { - MonNum: "0", - Record_Id: "0", - alm_id: params.alm_id, - alm_signal_id: params.alm_signal_id, - alm_is_confirmed: this.active, - }, + almIdOne: params.usr_id, + almIdTwo: params.fault_type_id, + almIdThree: params.uname, + almIdFour: params.fault_level, + almIdFive: params.record_uid, + almIdSix: params.maint_type_id, + almIdSeven: params.maint_close, + almIdEight: params.maint_done, + almIsConfirmed: 0, + almLevelFour: params.appoint_uid, + almLevelOne: params.Level_one_warn, + almLevelThree: params.master_audit, + almLevelTwo: params.Level_two_warn, + almSignalIdOne: params.alm_id, + almSignalIdTwo: params.alm_signal_id, + battGroupId: this.selectValue3 ? this.selectValue3 : 0, + page: { + pageSize: tab.page.pageSize, + pageCurr: tab.page.pageCurr, }, + stationname: this.selectValue2, + stationname1: this.selectValue1, } newsAlarm(postData).then((res) => { const resData = JSON.parse(res.data.result); @@ -409,7 +399,7 @@ item.battery1 = item.binf && item.binf.StationName ? item.binf.StationName : ""; item.tes1 = - item.binf && item.binf.BattGroupName ? item.binf.BattGroupName : ""; + item.binf && item.binf.battGroupName ? item.binf.battGroupName : ""; item.tester1 = item.binf && item.binf.StationName8 ? item.binf.StationName8 : ""; item.current1 = diff --git a/src/pages/alarmMager/deviceHistoryquery.vue b/src/pages/alarmMager/deviceHistoryquery.vue index 0258f1d..3eb3e3a 100644 --- a/src/pages/alarmMager/deviceHistoryquery.vue +++ b/src/pages/alarmMager/deviceHistoryquery.vue @@ -101,7 +101,7 @@ <script> import { - dataType /* 缁存姢鍖� */, + searchProvince /* 缁存姢鍖� */, roomsStation /* 鏈烘埧绔欑偣 */, deviceRecord /*鍛婅淇℃伅 */, deviceArarmdel @@ -161,7 +161,7 @@ methods: { /* 缁存姢鍖� */ async vindicateData() { - const resType = await dataType(); + const resType = await searchProvince(); let typeList = JSON.parse(resType.data.result).data.map((item) => { return { label: item, diff --git a/src/pages/alarmMager/deviceTimequery.vue b/src/pages/alarmMager/deviceTimequery.vue index b699383..f2d5ea3 100644 --- a/src/pages/alarmMager/deviceTimequery.vue +++ b/src/pages/alarmMager/deviceTimequery.vue @@ -97,7 +97,7 @@ <script> import { - dataType /* 缁存姢鍖� */, + searchProvince /* 缁存姢鍖� */, roomsStation /* 鏈烘埧绔欑偣 */, deviceAlarm /*鍛婅淇℃伅 */, deviceOk, @@ -158,7 +158,7 @@ methods: { /* 缁存姢鍖� */ async vindicateData() { - const resType = await dataType(); + const resType = await searchProvince(); let typeList = JSON.parse(resType.data.result).data.map((item) => { return { label: item, diff --git a/src/pages/alarmMager/js/api.js b/src/pages/alarmMager/js/api.js index a224ecc..2161abb 100644 --- a/src/pages/alarmMager/js/api.js +++ b/src/pages/alarmMager/js/api.js @@ -2,51 +2,56 @@ import qs from 'qs' -/* 椤甸潰鍔犺浇鏃舵煡璇㈢淮鎶ゅ尯涓殑鏋㈢航绫诲瀷 -鏃犲弬 +/** + * 椤甸潰鍔犺浇鏃舵煡璇㈢淮鎶ゅ尯 鐪� + * BattInfAction!serchAllStationName1 // 鏃� + * 鏃犲弬 */ -export const dataType = () => { +export const searchProvince = () => { return axios({ - method: "post", - url: "User_battgroup_baojigroup_battgroupAction!serchStationName1InGroup", + method: "GET", + url: "battInf/searchAllStationName1", + data: null + }); +} + + +/** + * 鏍规嵁缁存姢鍖烘煡璇㈡満鎴跨珯鐐� (鍚寘鏈虹粍) + * battInf/searchStationNameInGroup + * { + * stationName1 鐪� + * } +*/ +export const roomsStation = (data) => { + return axios({ + method: "GET", + url: "battInf/searchStationNameInGroup", + params: data, data: null }) } -/* 鏍规嵁缁存姢鍖烘煡璇㈡満鎴跨珯鐐� -json={"UNote":""} -*/ -export const roomsStation = (data) => { +/** + * 鏍规嵁缁存姢鍖哄拰鏈烘埧鏌ヨ钃勭數姹犵粍 + * {"stationName1":"鐪�","stationName":"鏈烘埧鍚嶇О"} + */ +export const batterySearch = (data) => { return axios({ - method: "post", - url: "User_battgroup_baojigroup_battgroupAction!serchStationNameInGroup", - data: "json=" + JSON.stringify(data) - }) -} - -/* 鏍规嵁缁存姢鍖哄拰鏈烘埧鏌ヨ钃勭數姹犵粍 -json={"UNote":"","UName":""} */ -export const batterySeach = (data) => { - return axios({ - method: "post", - url: "User_battgroup_baojigroup_battgroupAction!serchBattgroupidInGroup", - data: "json=" + JSON.stringify(data) - }) + method: "GET", + url: "battInf/searchBattgroupidInGroup", + params: data, + data: null + }); } //鏌ヨ褰撳墠鐨勫憡璀︿俊鎭� -/* -bmd.page.pageCurr=1&bmd.page.pageSize=10&bmd.binf.StationName1=&bmd.binf. -stationName=&bmd.binf.BattGroupId=0&bmd.mainf.usr_id=0&bmd.mainf.fault_type_id=119002&bmd.mainf. -fault_level=119003&bmd.mainf.record_uid=119004&bmd.adata.MonNum=0&bmd.adata.Record_Id=0&bmd.mainf. -maint_type_id=119005&bmd.mainf.maint_close=119007&bmd.mainf.master_id=0&bmd.mainf.maint_done=119006&bmd.adata. -alm_id=1&bmd.adata.alm_signal_id=0&bmd.mainf.num=1&bmd.mainf.BattGroupId=2&bmd.mainf.master_audit=3&bmd.mainf.appoint_uid=4 -*/ +//鏌ヨ褰撳墠鐨勫憡璀︿俊鎭� export const newsAlarm = (data) => { return axios({ - method: "post", - url: "Battalarm_dataAction!serchByCondition", - data: qs.stringify(data, { allowDots: true }) + method: "POST", + url: "Battalarm_dataAction/serchByCondition", + data }) } diff --git a/src/pages/login/js/api.js b/src/pages/login/js/api.js index a08c948..88f4818 100644 --- a/src/pages/login/js/api.js +++ b/src/pages/login/js/api.js @@ -6,39 +6,43 @@ * 鍙傛暟 "uinf.UName="+鐢ㄦ埛鍚�+"&uinf.Upassword="+瀵嗙爜+"&uinf.UId="+鏄惁璁颁綇瀵嗙爜(0,1) * 瀵嗙爜闇�瑕佷娇鐢╤ex_md5鍔犲瘑 */ -export const login = (username, password, verity) => { +export const login = (userName, password, deliveredCode) => { return axios({ method: "post", - url: `LoginAction_login?uinf.UName=${username}&uinf.Upassword=${encodeURIComponent(encodeURIComponent(formatPassword(password)))}&uinf.UNote=${verity}&uinf.UId=0`, - data: null + url: 'login/loginByRSA', + params: { + userName, + password: encodeURIComponent(formatPassword(password)), + deliveredCode + } }); }; +/** + * 鑾峰彇鐧诲綍鐢ㄧ殑楠岃瘉鐮� + * MessageAction!getFontDynamicCode // 鏃� + */ export const getLoginVerity = () => { return axios({ - method: "post", - url: `MessageAction!getFontDynamicCode`, - data: null + method: "GET", + url: 'message/getFontDynamicCode' }); -}; +} -//鏌ヨ绯荤粺鍚嶇О export const searchPlatformName = () => { return axios({ - method: 'post', - url: 'PageParamAction!findByCategoryId', - data: 'json=' + JSON.stringify({ categoryId: 5 }) - }) -} + method: 'GET', + url: '/pageParam/allList', + params: { categoryId: 5 } + }); +}; //鏌ヨ绯荤粺鍚嶇О export const getRealTabsConfig = (type) => { type = type ? type : 1; return axios({ - method: 'post', - url: 'PageParamUserAction!getAll', - data: "json=" + JSON.stringify({ - type, - }) + method: 'GET', + url: '/pageParamUser/allList', + params: { type: type } }) } \ No newline at end of file diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 32615b8..757c5c1 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -42,9 +42,9 @@ searchPlatformName() { searchPlatformName() .then((res) => { - let rs = JSON.parse(res.data.result); + let rs = res.data; if (rs.code == 1) { - let data = rs.data[0]; + let data = rs.data["1"][0]; this.platformName = data.param; } else { this.platformName = "钃勭數姹犲悗鍙扮洃鎺х鐞嗗钩鍙�"; @@ -84,7 +84,7 @@ }, changeVerifyCode() { getLoginVerity().then(res => { - let rs = JSON.parse(res.data.result); + let rs = res.data; if (rs.code == 1) { this.verifyCode = rs.data + ""; } else { @@ -97,12 +97,12 @@ // 鐧诲綍楠岃瘉 handleLogin(res) { // 鍏抽棴绛夊緟 - // this.loading = false; - let rs = JSON.parse(res.data.result); + let rs = res.data; if (rs.code == 1) { sessionStorage.setItem('username', this.username); - this.$store.dispatch("user/login", rs); + this.$store.dispatch("user/login", rs.data2[0]); this.initPageConfig() + } else { this.changeVerifyCode(); this.$toast(rs.msg); @@ -110,9 +110,13 @@ }, initPageConfig() { getRealTabsConfig().then(res => { - let rs = JSON.parse(res.data.result); + let rs = res?.data?.data || []; + let arr = [] + for (let key in rs) { + arr.push(...rs[key]) + } // 璁剧疆pageConfig - this.$store.dispatch('user/changeRealTabsConfig', rs.data); + this.$store.dispatch('user/changeRealTabsConfig', arr); this.$toast("鐧诲綍鎴愬姛!"); this.$router.push({ path: '/menu' diff --git a/src/pages/monitoring/history-monitoring.vue b/src/pages/monitoring/history-monitoring.vue index 4896d5f..3cd33da 100644 --- a/src/pages/monitoring/history-monitoring.vue +++ b/src/pages/monitoring/history-monitoring.vue @@ -46,7 +46,7 @@ <div class="commonTitle"> <div class="label">娴嬭瘯瀹归噺锛�</div> <div class="text"> - {{top.test_cap}} + {{top.testCap}} </div> </div> <div class="commonTitle" v-if="!isLD9"> @@ -122,8 +122,8 @@ import getSpecialPointIndex from "@/assets/js/tools/getSpecialPointIndex"; import const_ld_nine from "@/assets/js/const/const_ld_nine"; import { - searchStation, - searchBattInfo, + getAllStations, + getBattList, getBattGroupInfo, searchAll_lowAction, searchBattresdata, @@ -233,7 +233,7 @@ group: "", // 绔數鍘� curr: "", // 鐢垫睜鐢垫祦 test_long: "", // 娴嬭瘯鏃堕暱 - test_cap: "", // 娴嬭瘯瀹归噺 + testCap: "", // 娴嬭瘯瀹归噺 re_cap: "", // 鍓╀綑瀹归噺 xuhang: "" // 缁埅鏃堕暱 }, @@ -326,19 +326,19 @@ { value: "herongDischarge", text: "鏍稿娴嬭瘯", - test_type: 1, + testType: 1, children: [] }, { value: "jianceDischarge", text: "鐩戞祴鏀剧數", - test_type: 3, + testType: 3, children: [] }, { value: "jianceCharge", text: "鐩戞祴鍏呯數", - test_type: 4, + testType: 4, children: [] }, ], @@ -346,8 +346,8 @@ slider: 100, testTimeLong: [], battState: { - test_type: -100, - stop_reason: '' + testType: -100, + stopReason: '' }, monBarTitle: "鏈�澶у��=0V;鏈�灏忓��=0V;骞冲潎鍊�=0V", monCurrTitle: "鐢垫睜鐢垫祦鎶樼嚎鍥�(A)", @@ -423,8 +423,8 @@ computed: { battFullName() { let batt = this.batt; - if (batt.StationName && batt.BattGroupName) { - return batt.StationName + "-" + batt.BattGroupName; + if (batt.stationName && batt.battGroupName) { + return batt.stationName + "-" + batt.battGroupName; } return "鐢垫睜缁勫叏绉�"; }, @@ -432,10 +432,10 @@ let battState = this.battState; if (this.isLD9) { let res = ""; - switch (battState.test_type) { + switch (battState.testType) { case 1: case 3: - res = "鏀剧數 (缁堟鍘熷洜锛�" + battState.stop_reason + ")"; + res = "鏀剧數 (缁堟鍘熷洜锛�" + battState.stopReason + ")"; break; case 4: res = "鍏呯數"; @@ -446,10 +446,10 @@ } return res; } else { - if (battState.test_type == 3) { - return "鏀剧數(缁堟鍘熷洜锛�" + battState.stop_reason + ")"; - } else if (battState.test_type == 2) { - return "鍏呯數" + if (battState.testType == 3) { + return "鏀剧數(缁堟鍘熷洜锛�" + battState.stopReason + ")"; + } else if (battState.testType == 2) { + return "鍏呯數"; } else { return ""; } @@ -516,13 +516,13 @@ group: "", // 绔數鍘� curr: "", // 鐢垫睜鐢垫祦 test_long: "", // 娴嬭瘯鏃堕暱 - test_cap: "", // 娴嬭瘯瀹归噺 + testCap: "", // 娴嬭瘯瀹归噺 re_cap: "", // 鍓╀綑瀹归噺 xuhang: "---" // 缁埅鏃堕暱 }; // 鍒濆鍖栫數姹犵姸鎬� - this.battState.test_type = -100; + this.battState.testType = -100; // 鍒濆鍖栧浘琛� this.initChart(); @@ -531,32 +531,33 @@ searchBattTestData() { let batt = this.batt; searchBattTestData({ - num: batt.FBSDeviceId, - BattGroupId: batt.BattGroupId + // num: batt.fbsdeviceId, + battGroupId: batt.battGroupId, }) .then(res => { // 瑙f瀽鏁版嵁 - let rs = JSON.parse(res.data.result); + let rs = res.data; let herongDischarge = []; // 鏍稿鏀剧數 let herongCharge = []; // 鏍稿鍏呯數 let jianceDischarge = []; // 鐩戞祴鏀剧數 let jianceCharge = []; // 鐩戞祴鍏呯數 if (rs.code == 1) { - rs.data.forEach(item => { - item.text = item.test_starttime - item.value = item.test_starttime - if (item.test_type == 3) { + rs.data.list.forEach(item => { + item.value = item.testStarttime; + item.text = item.testStarttime; + item.label = item.testStarttime; + if (item.testType == 3) { // 娴嬭瘯绫诲瀷涓烘斁鐢� - if (item.test_starttype == 3) { + if (item.testStarttype == 3) { // 鏍稿鏀剧數 herongDischarge.push(item); } else { // 鐩戞祴鏀剧數 jianceDischarge.push(item); } - } else if (item.test_type == 2) { + } else if (item.testType == 2) { // 娴嬭瘯绫诲瀷涓哄厖鐢� - if (item.test_starttype == 3) { + if (item.testStarttype == 3) { // 鏍稿鍏呯數 herongCharge.push(item); } else { @@ -587,29 +588,30 @@ searchLD9TestData() { let batt = this.batt; getLD9TestList({ - BattGroupId: batt.BattGroupId, + battGroupId: batt.battGroupId, }) .then(res => { // 瑙f瀽鏁版嵁 - let rs = JSON.parse(res.data.result); + let rs = res.data; let herongDischarge = []; // 鏍稿娴嬭瘯 let jianceDischarge = []; // 鐩戞祴鏀剧數 let jianceCharge = []; // 鐩戞祴鍏呯數 if (rs.code == 1) { - rs.data.forEach((item) => { - item.value = item.test_starttime; - item.text = item.test_starttime; + rs.data.list.forEach((item) => { + item.value = item.testStarttime; + item.text = item.testStarttime; let list = item.ld9testdata.map((v) => { - v.test_type = item.test_type; + v.testType = item.testType; + v.recordNum = v.recordNums; return { - text: "鐢垫睜鍗曚綋#" + v.test_monnum, - value: v.test_monnum, + text: "鐢垫睜鍗曚綋#" + v.testMonnum, + value: v.testMonnum, value1: v }; }); item.children = list; - switch (item.test_type) { + switch (item.testType) { case 1: herongDischarge.push(item); break; @@ -624,6 +626,7 @@ } else { this.$toast("鏈幏鍙栧埌鍏呮斁鐢佃褰�"); } + debugger // 鍏呮斁鐢佃褰� this.test_record2.list[0].children = herongDischarge; this.test_record2.list[1].children = jianceDischarge; @@ -698,13 +701,13 @@ if (testRecord != -1) { let num = testRecord.record_num / this.show_num; // 鏍规嵁绮掑害鏌ヨ鏁版嵁 if (this.isLD9) { - this.battState.test_type = testRecord.test_type; - this.currMonNum = testRecord.test_monnum; + this.battState.testType = testRecord.testType; + this.currMonNum = testRecord.testMonnum; //鏌ヨLD9鍘嗗彶鏁版嵁 this.getLD9TestRecord(testRecord) } else { // 鏌ヨ鍘嗗彶鏁版嵁 - this.searchHistory(testRecord.BattGroupId, testRecord.test_record_count, num); + this.searchHistory(testRecord.battGroupId, testRecord.testRecordCount, num); } } @@ -718,43 +721,43 @@ ]) .then( this.$axios.spread((...res) => { - let res0 = JSON.parse(res[0].data.result); - let res1 = JSON.parse(res[1].data.result); - let res2 = JSON.parse(res[2].data.result); + let res0 = res[0].data; + let res1 = res[1].data; + let res2 = res[2].data; this.loading = false; // 鏀剧數鏁版嵁 if (res0.code) { - this.HistoryData = res0.data; + this.HistoryData = res0.data.list; // 鏍煎紡鍖栨暟鎹� - this.formateHisData(res0.data); + this.formateHisData(res0.data.list); // this.searchBattresdata(); } // 缁勭鏁版嵁 if (res1.code) { - let data = res1.data[0]; + let data = res1.data.list[0]; this.grpData = data; - allData.groupVol = data.group_vol; - allData.testCurr = data.test_curr; - allData.testCap = data.test_cap; - allData.test_timelong = data.test_timelong; + allData.groupVol = data.groupVol; + allData.testCurr = data.testCurr; + allData.testCap = data.testCap; + allData.testTimelong = data.testTimelong; this.setLD9TopData(); - const obj = const_ld_nine.test_stopreason; - this.battState.test_type = data.test_type; - this.battState.stop_reason = obj[data.test_stopreason] || "鏈煡"; + const obj = const_ld_nine.stopReason; + this.battState.testType = data.testType; + this.battState.stopReason = obj[data.stopReason] || "鏈煡"; } // 鎵�鏈夊崟浣撶殑瀹為檯瀹归噺鏁版嵁 let monBarVol = []; if (res2.code) { - let data = res2.data; + let data = res2.data.list; monBarChart.series[0].data = monBarVol; let batt = this.batt; for (let i = 1, j = batt.MonCount; i <= j; i++) { monBarVol.push(["#" + i, 0]); } data.forEach((v) => { - let idx = v.test_monnum - 1; - monBarVol[idx][1] = v.test_cap; + let idx = v.testMonnum - 1; + monBarVol[idx][1] = v.testCap.toHold(1); }); } this.setLD9BarChart(); @@ -808,28 +811,27 @@ result = this.test_record2.value1; } // 璁剧疆鐢垫睜鐘舵�� - this.battState.test_type = result.test_type; + this.battState.testType = result.testType; if (!this.isLD9) { - this.battState.stop_reason = result.test_stoptype_reason; + this.battState.stopReason = result.test_stoptype_reason || '鏈煡'; } // 杩斿洖缁撴灉闆� return result; }, // 鏌ヨ鍘嗗彶淇℃伅 - searchHistory(BattGroupId, count, num) { + searchHistory(battGroupId, count, num) { this.loading = true; this.$nextTick(() => { searchHistory({ - BattGroupId: BattGroupId, - test_record_count: count, - data_new: Math.floor(num) + battGroupId: battGroupId, + testRecordCount: count, }).then(res => { this.loading = false; - let rs = JSON.parse(res.data.result); + let rs = res.data; let data = []; // 鏁版嵁 if (rs.code == 1) { - data = rs.data; + data = rs.data.list; } this.HistoryData = data // 鏍煎紡鍖栨暟鎹� @@ -844,24 +846,29 @@ }, // 鏍煎紡鍖栧巻鍙蹭俊鎭暟鎹� formateHisData(data) { - let record_time = -1; // 璁板綍鏃堕棿 - let record_num = -100; // 璁板綍绗旀暟 - allData.endData = data[data.length - 1]; - data.forEach(item => { - let mon_num = item.mon_num; - let testTimeLong = this.$units.formatSeconds(item.test_timelong); + let filterData = data.filter((item, i) => { + if (item.recordNum % this.show_num == 0) { + return item; + } + }); + let recordTime = -1; // 璁板綍鏃堕棿 + let recordNum = -100; // 璁板綍绗旀暟 + allData.endData = filterData[filterData.length - 1]; + filterData.forEach((item) => { + let monNum = item.monNum; + let testTimeLong = this.$units.formatSeconds(item.testTimelong); // 鑾峰彇缁勭鐢靛帇锛屽湪绾跨數鍘�,缁勭鐢垫祦鐨勪俊鎭拰寮�杈熶竴涓崟浣撴煴鐘跺浘 - if (record_num != item.record_num) { - record_time = item.record_time; - record_num = item.record_num; - allData.groupVol.push([testTimeLong, item.group_vol]); - allData.onlineVol.push([testTimeLong, item.online_vol]); - allData.testCurr.push([testTimeLong, item.test_curr]); + if (recordNum != item.recordNum) { + recordTime = item.recordTime; + recordNum = item.recordNum; + allData.groupVol.push([testTimeLong, item.groupVol]); + allData.onlineVol.push([testTimeLong, item.onlineVol]); + allData.testCurr.push([testTimeLong, item.testCurr]); allData.recordTime.push(testTimeLong); - allData.testTimeLong.push(item.test_timelong); - allData.testCap.push(item.test_cap); + allData.testTimeLong.push(item.testTimelong); + allData.testCap.push(item.testCap); allData.dataList.push(item); - this.testTimeLong.push(item.test_timelong); + this.testTimeLong.push(item.testTimelong); // 寮�杈熺┖闂� monBarData.vol.push([]); monBarData.temp.push([]); @@ -870,45 +877,39 @@ monBarData.preCap.push([]); } // 鍗曚綋鐢靛帇鏌辩姸鍥捐缃� - let mon_num_text = "#" + mon_num; + let monNum_text = "#" + monNum; let monBarVol = monBarData.vol[monBarData.vol.length - 1]; - monBarVol.push([mon_num_text, item.mon_vol]); + monBarVol.push([monNum_text, item.monVol]); // 鍗曚綋娓╁害鏌辩姸鍥� let monBarTemp = monBarData.temp[monBarData.temp.length - 1]; - monBarTemp.push([mon_num_text, item.mon_tmp]); + monBarTemp.push([monNum_text, item.monTmp]); // 璁剧疆鍗曚綋鎶樼嚎鍥句俊鎭� - if (typeof monLineData.vol[mon_num - 1] != "object") { - let index = mon_num - 1; + if (typeof monLineData.vol[monNum - 1] != "object") { + let index = monNum - 1; // 寮�杈熺┖闂� monLineData.vol[index] = []; monLineData.temp[index] = []; monLineData.resCap[index] = []; } // 鑾峰彇鍒伴渶瑕佷娇鐢ㄧ殑绌洪棿 - let monLineVol = monLineData.vol[mon_num - 1]; - monLineVol.push([testTimeLong, item.mon_vol]); + let monLineVol = monLineData.vol[monNum - 1]; + monLineVol.push([testTimeLong, item.monVol]); - let monLineTemp = monLineData.temp[mon_num - 1]; - monLineTemp.push([testTimeLong, item.mon_tmp]); + let monLineTemp = monLineData.temp[monNum - 1]; + monLineTemp.push([testTimeLong, item.monTmp]); }); - if (this.isLD9) { - // 鍒濆鍖栧浘琛ㄧ殑閰嶇疆椤� - this.initLD9ChartOptions(); - // 璁剧疆鎶樼嚎鍥捐〃 - this.setLineChart(); - } else { - // 鍒濆鍖栧浘琛ㄧ殑閰嶇疆椤� - this.initChartOptions(); - // 璁剧疆瀹归噺 - this.setCapList(); - // 璁剧疆鎶樼嚎鍥捐〃 - this.setLineChart(); - // 鎵ц婊戝姩浜嬩欢 - this.sliderInput(); - } + // 鍒濆鍖栧浘琛ㄧ殑閰嶇疆椤� + this.initChartOptions(); + + // 璁剧疆瀹归噺 + this.setCapList(); + // 璁剧疆鎶樼嚎鍥捐〃 + this.setLineChart(); + // 鎵ц婊戝姩浜嬩欢 + this.sliderInput(); }, setCapList() { let batt = this.batt; @@ -920,13 +921,13 @@ }); let max_vol = Math.max.apply(null, vol_list); for (let j = 0; j < vol_list.length; j++) { - let avg_curr = batt_test_evary_record[i].test_timelong > 0 ? batt_test_evary_record[i] - .test_cap * 3600 / batt_test_evary_record[i].test_timelong : batt_test_evary_record[i] - .test_curr; + let avg_curr = batt_test_evary_record[i].testTimelong > 0 ? batt_test_evary_record[i] + .testCap * 3600 / batt_test_evary_record[i].testTimelong : batt_test_evary_record[i] + .testCurr; let actionvalue = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr), - batt_test_evary_record[i].test_cap, max_vol, vol_list[j], batt.MonVolStd, 1); + batt_test_evary_record[i].testCap, max_vol, vol_list[j], batt.MonVolStd, 1); let restvalue = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr), - batt_test_evary_record[i].test_cap, max_vol, vol_list[j], batt.MonVolStd, 0); + batt_test_evary_record[i].testCap, max_vol, vol_list[j], batt.MonVolStd, 0); let batt_num_text = "#" + (j + 1); monBarData.realCap[i].push([batt_num_text, actionvalue.toFixed(0)]); monBarData.resCap[i].push([batt_num_text, restvalue.toFixed(0)]); @@ -960,8 +961,8 @@ this.top.group = "缁勭:" + groupVol.toFixed(2) + "V"; this.top.curr = testCurr.toFixed(1) + "A"; - this.top.test_cap = testCap.toFixed(1) + "AH"; - this.top.test_long = this.$units.formatSeconds(allData.test_timelong); + this.top.testCap = testCap.toFixed(1) + "AH"; + this.top.test_long = this.$units.formatSeconds(allData.testTimelong); }, // 璁剧疆椤堕儴鏂囨湰妗嗙殑鏁版嵁 setTopData() { @@ -982,15 +983,22 @@ groupVol[index][1].toFixed(2) + "V"; this.top.curr = testCurr[index][1].toFixed(1) + "A"; - this.top.test_cap = testCap[index].toFixed(1) + "AH"; + this.top.testCap = testCap[index].toFixed(1) + "AH"; // 鍓╀綑瀹归噺 let monVol = monVols[index]; let list = dataList[index]; - let avg_curr = list.test_timelong > 0 ? list.test_cap * 3600 / list.test_timelong : list.test_curr; + let avg_curr = list.testTimelong > 0 ? list.testCap * 3600 / list.testTimelong : list.testCurr; let batNum = this.$units.getBarNum(monVol); - let over_cap = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr), - list.test_cap, batNum.max, batNum.min, batt.MonVolStd, 0); - this.top.re_cap = over_cap.toFixed(1) + 'AH'; + let over_cap = this.$units.GetMonomerCap( + batt.monCapStd, + this.$units.GetHourRate(batt.monCapStd, avg_curr), + list.testCap, + batNum.max, + batNum.min, + batt.monVolStd, + 0 + ); + this.top.re_cap = over_cap.toFixed(1) + "AH"; } // 璁剧疆缁埅鏃堕暱 @@ -999,12 +1007,22 @@ // 瀹為檯瀹归噺 let monVol = monVols[lastIndex]; let list = dataList[lastIndex]; - let avg_curr = list.test_timelong > 0 ? list.test_cap * 3600 / list.test_timelong : list.test_curr; + let avg_curr = + list.testTimelong > 0 + ? (list.testCap * 3600) / list.testTimelong + : list.testCurr; let batNum = this.$units.getBarNum(monVol); - let real_cap = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr), - list.test_cap, batNum.max, batNum.min, batt.MonVolStd, 1); - let xuhang = batt.Load_curr ? real_cap / batt.Load_curr : 0; - this.top.xuhang = xuhang ? this.$units.sethoubeiTime(xuhang) : '---'; + let real_cap = this.$units.GetMonomerCap( + batt.monCapStd, + this.$units.GetHourRate(batt.monCapStd, avg_curr), + list.testCap, + batNum.max, + batNum.min, + batt.monVolStd, + 1 + ); + let xuhang = batt.loadCurr ? real_cap / batt.loadCurr : 0; + this.top.xuhang = xuhang ? this.$units.sethoubeiTime(xuhang) : "---"; } let testTimeLong = this.testTimeLong; @@ -1017,15 +1035,15 @@ // 璁剧疆鍐呴樆淇℃伅 searchBattresdata() { let batt = this.batt; - searchBattresdata(batt.BattGroupId).then(res => { - let rs = JSON.parse(res.data.result); + searchBattresdata(batt.battGroupId).then(res => { + let rs = res.data; if (rs.code == 1) { - let data = rs.data; + let data = rs.data.list; for (let i = 0; i < data.length; i++) { let item = data[i]; - let battNumText = '#' + item.mon_num; - monBarData.jh_curr.push([battNumText, item.mon_JH_curr]); - monBarData.res.push([battNumText, item.mon_res]); + let battNumText = "#" + item.monNum; + monBarData.jh_curr.push([battNumText, item.monJhCurr]); + monBarData.res.push([battNumText, item.monRes]); } } }).catch(error => { @@ -1034,12 +1052,12 @@ }, //鏌ヨ绔欑偣淇℃伅 searchStation() { - searchStation({ - StationName1: "", - StationName2: "", - StationName5: "", + getAllStations({ + stationName1: "", + stationName2: "", + stationName5: "", }).then((res) => { - let rs = JSON.parse(res.data.result); + let rs = res.data; let data = []; if (rs.code == 1) { data = rs.data; @@ -1056,13 +1074,13 @@ // 閬嶅巻鏁版嵁鏋勯�犳爲鐘� data.forEach(item => { // 鐪� - let provice = this.addData(result, item.StationName1); + let provice = this.addData(result, item.stationName1); // 甯� - let city = this.addData(provice.children, item.StationName2, provice); + let city = this.addData(provice.children, item.stationName2, provice); // 鍖哄幙 - let county = this.addData(city.children, item.StationName5, city); + let county = this.addData(city.children, item.stationName5, city); // 鏈烘埧 - let home = this.addData(county.children, item.StationName3, county, item); + let home = this.addData(county.children, item.stationName3, county, item); }); // 璁剧疆鏍戠姸鍒楄〃 this.options = result; @@ -1107,9 +1125,9 @@ this.getBattGroupInfo(this.cascaderValue) }, //鏌ヨ鐢垫睜缁勪俊鎭� - getBattGroupInfo(BattGroupId) { - getBattGroupInfo(BattGroupId).then(res => { - let rs = JSON.parse(res.data.result); + getBattGroupInfo(battGroupId) { + getBattGroupInfo(battGroupId).then(res => { + let rs = res.data; if (rs.code == 1) { this.leafClick(rs.data[0]); } else { @@ -1123,18 +1141,13 @@ onChange(select) { if (select.tabIndex == 3) { let objs = select.selectedOptions[select.selectedOptions.length - 1]; - searchBattInfo({ - StationName1: objs.data.StationName1, - StationName2: objs.data.StationName2, - StationName5: objs.data.StationName5, - StationName3: objs.data.StationName3 - }).then((res) => { - let rs = JSON.parse(res.data.result); + getBattList(objs.data.stationId).then((res) => { + let rs = res.data;; if (rs.code == 1) { let data = rs.data; data.map(item => { - item.text = item.StationName4 + '-' + item.BattGroupName - item.value = item.BattGroupId + item.text = item.stationName4 + '-' + item.battGroupName + item.value = item.battGroupId }) this.options.map(item => { item?.children.map(jtem => { @@ -1434,14 +1447,16 @@ // 鏍规嵁allData.groupVol鏁版嵁璁剧疆groupVolLineChart鐨勫�� groupVolLineChart.series[0].data = allData.onlineVol; groupVolLineChart.series[1].data = allData.groupVol; - let specialPoint = getSpecialPointIndex(allData.groupVol.map(item => { - return item[1]; - })); + let specialPoint = this.$units.getSpecialPointIndex( + allData.groupVol.map((item) => { + return item[1]; + }) + ); let markLine = {}; this.groupVolQth.code = specialPoint.code; if (specialPoint.code && this.test_record.value[0] == "herongDischarge") { let batt = this.batt; - let qgth = this.$units.getQgth(specialPoint, batt.MonVolStd * batt.MonCount); + let qgth = this.$units.getQgth(specialPoint, batt.monVolStd * batt.monCount); this.groupVolTitle = qgth.title; // 璁剧疆groupVolQth @@ -1456,51 +1471,50 @@ this.groupVolQth.title = qgth.label; markLine = { - data: [{ - label: { - show: true, - position: 'end', - formatter: [ - '{a|' + allData.groupVol[specialPoint.min][0] + '}' + '{c|}', - '{b|閿呭簳鐢靛帇:' + allData.groupVol[specialPoint.min][1] + 'V}' + '{c|}' - ].join('\n'), - rich: { - a: { - + data: [ + { + label: { + show: true, + position: "end", + formatter: [ + "{a|" + allData.groupVol[specialPoint.min][0] + "}" + "{c|}", + "{b|閿呭簳鐢靛帇:" + + allData.groupVol[specialPoint.min][1] + + "V}" + + "{c|}", + ].join("\n"), + rich: { + a: {}, + b: {}, + c: { + width: 60, + }, }, - b: { - - }, - c: { - width: 60 - } }, + xAxis: allData.groupVol[specialPoint.min][0], }, - xAxis: allData.groupVol[specialPoint.min][0], - }, - { - label: { - show: true, - position: 'end', - formatter: [ - '{c|}' + '{a|' + allData.groupVol[specialPoint.max][0] + '}', - '{c|}' + '{b|椹煎嘲鐢靛帇:' + allData.groupVol[specialPoint.max][1] + 'V}' - ].join('\n'), - rich: { - a: { - + { + label: { + show: true, + position: "end", + formatter: [ + "{c|}" + "{a|" + allData.groupVol[specialPoint.max][0] + "}", + "{c|}" + + "{b|椹煎嘲鐢靛帇:" + + allData.groupVol[specialPoint.max][1] + + "V}", + ].join("\n"), + rich: { + a: {}, + b: {}, + c: { + width: 80, + }, }, - b: { - - }, - c: { - width: 80, - } }, + xAxis: allData.groupVol[specialPoint.max][0], }, - xAxis: allData.groupVol[specialPoint.max][0], - } - ] + ], }; } else { this.groupVolTitle = "绔數鍘嬫姌绾垮浘(V)"; @@ -1663,14 +1677,16 @@ return Math.floor(num * percent / 100) - 1; }, searchAll_lowAction() { - searchAll_lowAction().then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - this.low_list = rs.data; - } - }).catch(error => { - console.log(error); - }); + searchAll_lowAction() + .then((res) => { + res = res.data; + if (res.code) { + this.low_list = res.data.list; + } + }) + .catch((error) => { + console.log(error); + }); }, getLow(lowtype, lownametype) { let low_list = this.low_list; @@ -1684,9 +1700,10 @@ }, }, mounted() { - this.searchStation(); // 鍒濆鍖栧浘琛� this.initChart(); + this.searchStation(); + this.searchAll_lowAction(); }, } diff --git a/src/pages/monitoring/js/api.js b/src/pages/monitoring/js/api.js index 9269373..bfa41da 100644 --- a/src/pages/monitoring/js/api.js +++ b/src/pages/monitoring/js/api.js @@ -1,117 +1,137 @@ import axios from "@/assets/js/axios"; /** - * 鏌ヨ鏈烘埧淇℃伅 - * 鍙傛暟锛歫son = {"StationName1":"鍖椾含甯�","StationName2":"甯傝緰鍖�","StationName5":"娴锋穩鍖�"} + * 鏌ヨ绔欑偣鍚� 甯tationId fbsdeviceId (鍚寘鏈虹粍杩囨护) + * stationName1 + * stationName2 + * stationName5 + * BattInfAction!serchAllStationName // 鏃� */ -export const searchStation = (params) => { +export const getAllStations = (params) => { return axios({ - method: "post", - url: "BattInfAction!serchAllStationName", - data: "json=" + JSON.stringify(params) + method: 'GET', + url: 'battInf/searchAllStationName', + params }) } /** - * 鏌ヨ鐢垫睜缁勪俊鎭� - * 鍙傛暟锛歫son = {"StationName1":"鍖椾含甯�","StationName2":"甯傝緰鍖�","StationName5":"娴锋穩鍖�","StationName3":"绱櫠绉戞妧鏈烘埧"} + * 鏍规嵁鏈烘埧id鑾峰彇鐢垫睜淇℃伅 鏈烘埧涓嬬殑鐢垫睜缁勫垪琛� + * stationId + * BattInfAction!serchAllBattinf // 鏃� */ -export const searchBattInfo = (params) => { +export const getBattList = (stationId) => { return axios({ - method: "post", - url: "BattInfAction!serchAllBattinf", - data: "json=" + JSON.stringify(params) - }) + method: "GET", + url: "battInf/findBattInfByStationId", + params: { + stationId + } + }); } /** * 鏍规嵁鐢垫睜缁処D鏌ヨ鐢垫睜缁勪俊鎭� - * @param data + * BattInfAction!findByBattGroupId // 鏃� * @returns {AxiosPromise} */ -export const getBattGroupInfo = (params) => { +export const getBattGroupInfo = (battGroupId) => { return axios({ - method: 'post', - url: 'BattInfAction!findByBattGroupId', - data: 'bif.BattGroupId=' + params, - }) + method: 'GET', + url: 'battInf/findByBattGroupId', + params: { + battGroupId + } + }); + } /** * 鏌ヨ鐢垫睜鍛婅鍙傛暟 - * 鍙傛暟锛歫son={"dev_id":910000022} + * Dev_paramAction!serchParamById // 鏃� + * {devId} */ export const realTimeAlarm = (params) => { return axios({ - method: "post", - url: "Dev_paramAction!serchParamById", - data: "json=" + JSON.stringify(params) + method: "GET", + url: "Dev_paramAction/serchParamById", + params }) } /** * 鏍规嵁璁惧id鏌ヨ璁惧褰撳墠鐨勫紑鍏崇姸鎬� - * json={"dev_id":910000022} + * {devId} + * Fbs9100_stateAction_action_serchContactorState // 鏃� */ export const realTimePowerOff = (params) => { return axios({ - method: "post", - url: "Fbs9100_stateAction_action_serchContactorState", - data: "json=" + JSON.stringify(params) + method: "GET", + url: "Fbs9100_stateAction/serchContactorState", + params }) } /** * 鏍规嵁鐢垫睜缁刬d鏌ヨ璇ョ數姹犵粍涓墍鏈夌數姹犱俊鎭� (鍥捐〃鏁版嵁) + * Batt_rtdataAction_serchByCondition // 鏃� * json={"BattGroupId":1005074} */ export const realTimeSearch = (params) => { return axios({ - method: "post", - url: "Batt_rtdataAction_serchByCondition", - data: "json=" + JSON.stringify(params) + method: "GET", + url: "Batt_rtdataAction/serchByCondition", + params }) } /** * 鏍规嵁鐢垫睜缁刬d鏌ヨ鐢垫睜缁勫疄鏃剁粍绔俊鎭� - * 鍙傛暟锛歳tstate.battGroupId=1005074 + * Batt_rtstateAction_serchByCondition // 鏃� */ -export const realTimeGroup = (params) => { +export const realTimeGroup = (battGroupId) => { return axios({ - method: "post", - url: "Batt_rtstateAction_serchByCondition", - data: "rtstate.battGroupId=" + params + method: "GET", + url: "BattRtstate/serchByCondition", + params: { + battGroupId + } }) } /** * 鏌ヨ鍘嗗彶瀹炴椂鏁版嵁 - * @param json:{"dev_id":618500002} - * @returns {AxiosPromise} + * JhStateAction_action_serchByCondition // 鏃� + * {devId} */ export const JhStateActionSerchByCondition = (params) => { // 鏌ヨ鍚庡彴 return axios({ - method: "post", - url: "JhStateAction_action_serchByCondition", - data: "json=" + JSON.stringify(params) - }); -} - -export const searchAll_lowAction = () => { - return axios({ - method: "post", - url: "Batt_param_lowAction_searchAll", - data: null - }); -} - -export const searchBattresdata = (BattGroupId) => { - return axios({ - method: "post", - url: "Batt_rtdataAction!serchResById", - data: "json=" + JSON.stringify({ - BattGroupId: BattGroupId, - }) + method: "GET", + url: "JhStateAction/serchByCondition", + params }); } /** + * Batt_param_lowAction_searchAll // 鏃� + */ +export const searchAll_lowAction = () => { + return axios({ + method: "GET", + url: "Batt_param_lowAction/searchAll" + }); +} + +/** + * 鏌ヨ鍐呴樆淇℃伅 + * Batt_rtdataAction!serchResById // 鏃� + */ +export const searchBattresdata = (battGroupId) => { + return axios({ + method: "GET", + url: "Batt_rtdataAction/serchResById", + params: { + battGroupId + } + }); +} +/** * 鑾峰彇鍏呮斁鐢佃褰� + * Batttestdata_infAction_searchBattTestInfDataById // 鏃� * 鍙傛暟锛歫son={"num":910000119,"BattGroupId":1005129} * 杩斿洖缁撴灉璇存槑锛� * test_type==3&&test_starttype==3?鏍稿鏀剧數:鐩戞祴鏀剧數 @@ -123,22 +143,22 @@ export const searchBattTestData = (params) => { return axios({ - method: "post", - url: "Batttestdata_infAction_searchBattTestInfDataById", - data: "json=" + JSON.stringify(params) + method: "POST", + url: "Batttestdata_infAction/searchBattTestInfDataById", + params }) } /** * 鏌ヨLD9娴嬭瘯鏁版嵁鍒楄〃 - * Ld9testdata_infAction_ld9action_searchInfList - * 鍙傛暟锛歫son={"BattGroupId":1005129} + * {battGroupId} + * Ld9testdata_infAction_ld9action_searchInfList // 鏃� */ -export const getLD9TestList = (data) => { +export const getLD9TestList = (params) => { return axios({ - method: "post", - url: "Ld9testdata_infAction_ld9action_searchInfList", - data: 'json=' + JSON.stringify(data) + method: "GET", + url: "Ld9testdata_infAction/searchInfList", + params }); } @@ -156,60 +176,66 @@ /** * 鏌ヨ鍘嗗彶鏁版嵁 - * 鍙傛暟锛� json={"BattGroupId":1005129,"test_record_count":"7"} + * BatttestdataAction!findhistory // 鏃� + * {"battGroupId":1005129,"testRecordCount":"7"} */ export const searchHistory = (params) => { - params.data_new = params.data_new ? params.data_new : 1000; return axios({ - method: "post", - url: "BatttestdataAction!findhistory", - data: "json=" + JSON.stringify(params) + method: "GET", + url: "BatttestdataAction/findhistory", + params }) } + /** * 鏌ヨLD9 鍗曚綋娴嬭瘯鏁版嵁 - * Ld9testdataAction_ld9action_serchByCondition - * 鍙傛暟锛歫son={"BattGroupId":1000061,"test_record_count":39,"record_num":3,"test_monnum":1} + * Ld9testdataAction_ld9action_serchByCondition // 鏃� + * {"battGroupId":1000061,"testRecordCount":39,"recordNum":3,"testMonNum":1} */ -export const getLD9Testdata = (data) => { +export const getLD9Testdata = (params) => { return axios({ - method: "post", - url: "Ld9testdataAction_ld9action_serchByCondition", - data: 'json=' + JSON.stringify(data) + method: "GET", + url: "Ld9testdataAction/serchByCondition", + params }); } /** -* 鏌ヨLD9娴嬭瘯缁勭鏁版嵁 -* Ld9testdatastopAction_ld9action_serchByInfo -* 鍙傛暟锛歫son={"BattGroupId":1000061,"test_record_count":39,"record_num":3,"test_monnum":1} -*/ -export const getLD9GrpTestdata = (data) => { + * 鏌ヨLD9娴嬭瘯缁勭鏁版嵁 + * Ld9testdatastopAction_ld9action_serchByInfo // 鏃� + * {"battGroupId":1000061,"testRecordCount":39,"record_num":3,"testMonNum":1} + */ +export const getLD9GrpTestdata = (params) => { return axios({ - method: "post", - url: "Ld9testdatastopAction_ld9action_serchByInfo", - data: 'json=' + JSON.stringify(data) + method: "GET", + url: "Ld9testdatastopAction/serchByInfo", + params + }); +} +/** + * 鏌ヨLD9 涓�娆℃祴璇曚腑鎵�鏈夊崟浣撶殑瀹為檯瀹归噺 + * Ld9testdatastopAction_ld9action_serchByCondition // 鏃� + * {"battGroupId":1000061,"testRecordCount":39} + */ +export const getLD9MonCaps = (params) => { + return axios({ + method: "GET", + url: "Ld9testdatastopAction/serchByCondition", + params }); } /** -* 鏌ヨLD9 涓�娆℃祴璇曚腑鎵�鏈夊崟浣撶殑瀹為檯瀹归噺 -* Ld9testdatastopAction_ld9action_serchByCondition -* 鍙傛暟锛歫son={"BattGroupId":1000061,"test_record_count":39} -*/ -export const getLD9MonCaps = (data) => { - return axios({ - method: "post", - url: "Ld9testdatastopAction_ld9action_serchByCondition", - data: 'json=' + JSON.stringify(data) - }); -} - + * 閫氳繃璁惧id鏌ヨLD9鏁版嵁 + * {devId} + * LD9_stateAction_ld9action_searchByDevId // 鏃� + * @returns + */ export const realTimeLd9Data = (params) => { return axios({ - method: "post", - url: "LD9_stateAction_ld9action_searchByDevId", - data: "json=" + JSON.stringify(params) + method: "GET", + url: "LD9_stateAction/searchByDevId", + params }) } \ No newline at end of file diff --git a/src/pages/monitoring/real-monitoring.vue b/src/pages/monitoring/real-monitoring.vue index 2c26adf..0b67e64 100644 --- a/src/pages/monitoring/real-monitoring.vue +++ b/src/pages/monitoring/real-monitoring.vue @@ -10,7 +10,7 @@ <div class="commonTitle"> <div class="label">鐢垫睜鐘舵�侊細</div> <div class="text"> - {{backInputs.batt_state}} + {{backInputs.battState}} </div> </div> <div class="commonTitle"> @@ -22,25 +22,25 @@ <div class="commonTitle"> <div class="label">鐢垫睜鐢垫祦锛�</div> <div class="text"> - {{backInputs.group_curr}} + {{backInputs.groupCurr}} </div> </div> <div class="commonTitle"> <div class="label">鏇存柊鏃ユ湡锛�</div> <div class="text"> - {{backInputs.rec_datetime}} + {{backInputs.recDatetime}} </div> </div> <div class="commonTitle"> <div class="label">娴嬭瘯鏃堕暱锛�</div> <div class="text"> - {{backInputs.batt_test_tlong}} + {{backInputs.battTestTlong}} </div> </div> <div class="commonTitle"> <div class="label">娴嬭瘯瀹归噺锛�</div> <div class="text"> - {{backInputs.batt_test_cap}} + {{backInputs.battTestCap}} </div> </div> <div class="commonTitle"> @@ -118,16 +118,14 @@ <script> import { - searchStation, - searchBattInfo, + getAllStations, + getBattList, getBattGroupInfo, realTimeAlarm, - realTimePowerOff, - realTimeSearch, - realTimeGroup, JhStateActionSerchByCondition, - realTimeLd9Data, } from "@/pages/monitoring/js/api" +import createWs from "@/assets/js/websocket"; +const WSMixin = createWs("RealTime"); import BarChart from "@/components/chart/BarChart"; import progressBlockVerticalBar from "@/components/chart/progress-block-vertical-bar"; import getMarkLineData from "@/components/chart/js/getMarkLineData"; @@ -135,8 +133,10 @@ import const_61850 from "@/assets/js/const/const_61850"; import const_9100 from "@/assets/js/const/const_9100"; import const_ld_nine from "@/assets/js/const/const_ld_nine"; -let vol, resChart, temp, conduct, currChart, leakVol; +import { number } from 'echarts/lib/export'; +let vol, resChart, temp, conduct, currChart, leakVol, monConnRes; export default { + mixins: [WSMixin], data() { let pageConfig = this.$store.getters["user/realTabsConfig"]; let stateList = const_61850.stateList; @@ -153,17 +153,16 @@ options: [], /* 鐢垫睜鐘舵�� 妯″潡 缁勭灞曠ず */ inputs: { - group_vol: 0 /* 绔數鍘�-缁勭鐢靛帇 */, - online_vol: 0 /* 绔數鍘�-鍦ㄧ嚎鐢靛帇 */, - group_curr: 0 /* 鐢垫睜鐢垫祦 */, - batt_test_tlong: "0:00:00" /* 娴嬭瘯鏃堕暱 */, - rec_datetime: "1982-01-01 00:00:00" /* 鏇存柊鏃ユ湡 */, - batt_test_cap: 0 /* 娴嬭瘯瀹归噺 */, - batt_rest_cap: 0, // 鍓╀綑瀹归噺 - batt_state: 0 /* 鐢垫睜鐘舵�� */ + groupVol: 0 /* 绔數鍘�-缁勭鐢靛帇 */, + onlineVol: 0 /* 绔數鍘�-鍦ㄧ嚎鐢靛帇 */, + groupCurr: 0 /* 鐢垫睜鐢垫祦 */, + battTestTlong: "0:00:00" /* 娴嬭瘯鏃堕暱 */, + recDatetime: "1982-01-01 00:00:00" /* 鏇存柊鏃ユ湡 */, + battTestCap: 0 /* 娴嬭瘯瀹归噺 */, + battRestCap: 0, // 鍓╀綑瀹归噺 + battState: 0 /* 鐢垫睜鐘舵�� */ }, batt: {}, - timer: new this.$units.Timeout(), totolTable: [ { key: "input_vol_total", @@ -328,6 +327,8 @@ dropVol: 0, // 瀵奸�氬帇闄� devType: 0, // 璁惧绫诲瀷 }, + fodHeaders: [], + fodData: [], } }, components: { @@ -336,45 +337,75 @@ }, computed: { backInputs() { - let obj = { + let batt = this.batt; + let isLd9 = this.isLd9; + const obj = { 0: "鏈煡", 1: "娴厖", 2: "鍏呯數", 3: "鏀剧數", 4: "鍧囧厖", - }; - let list = { - batt_state: "鏈煡", - group_online_vol: "鍦ㄧ嚎:0.00V锛涚粍绔�:0.00V", - group_curr: "0.00A", - rec_datetime: "1982-01-01 00:00:00", - batt_test_tlong: this.$units.formatSeconds(0), - batt_test_cap: "0Ah", - batt_syrl_cap: "---", - sysc: "------" - }; - list.batt_state = obj[this.inputs.batt_state]; - list.group_online_vol = - `鍦ㄧ嚎:${this.inputs.online_vol.toFixed( + 5: "鍐呴樆娴嬭瘯", + }, + list = { + battState: "鏈煡", + group_online_vol: "鍦ㄧ嚎:0.00V锛涚粍绔�:0.00V", + groupCurr: "0.00A", + recDatetime: "1982-01-01 00:00:00", + battTestTlong: this.$units.formatSeconds(0), + battTestCap: "0Ah", + batt_syrl_cap: "---", + sysc: "------", + }; + if (this.diagram.type == -1) { + return list; + } + let batt_state_text = + this.diagram.powerCut && !isLd9 + ? "鍋滅數鏀剧數" + : obj[this.inputs.battState]; + list.battState = batt_state_text + this.diagram.desc; + if (this.$units.regEquipType(batt.fbsdeviceId, "BTS9605")) { + list.group_online_vol = `缁勭:${this.inputs.groupVol.toFixed(2)}V`; + } else { + list.group_online_vol = `鍦ㄧ嚎:${this.inputs.onlineVol.toFixed( 2 - )}V锛涚粍绔�:${this.inputs.group_vol.toFixed(2)}V`; - list.group_curr = this.inputs.group_curr.toFixed(2) + "A"; - list.rec_datetime = this.inputs.rec_datetime; - list.batt_test_tlong = this.$units.formatSeconds(this.inputs.batt_test_tlong); + )}V锛涚粍绔�:${this.inputs.groupVol.toFixed(2)}V`; + } - list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH"; - if (this.inputs.batt_state === 2) { + list.groupCurr = this.inputs.groupCurr.toFixed(2) + "A"; + list.recDatetime = this.inputs.recDatetime; + list.battTestTlong = this.$units.formatSeconds(this.inputs.battTestTlong); + + list.battTestCap = this.inputs.battTestCap.toFixed(1) + "AH"; + if (this.inputs.battState === 2) { list.batt_syrl_cap = "---"; } else { - list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1) + "AH"; + // 涓�0鏄笉鏇存柊鍓╀綑瀹归噺 + if (this.inputs.battRestCap != 0) { + list.batt_syrl_cap = this.inputs.battRestCap.toFixed(1); + } } - if (this.inputs.batt_state === 3) { - list.sysc = this.$units.sethoubeiTime( - parseFloat(this.inputs.batt_rest_cap) / - parseFloat(this.inputs.group_curr) - ); + if (this.inputs.battState === 3) { + // 涓�0鏄笉鏇存柊缁埅鏃堕暱 + if (this.inputs.battRestCap != 0) { + list.sysc = this.$units.sethoubeiTime( + parseFloat(this.inputs.battRestCap) / + parseFloat(this.inputs.groupCurr) + ); + } } else { list.sysc = "------"; + } + + // 濡傛灉褰撳墠涓洪攤鐢垫睜 + let isLithium = this.$units.regEquipType(batt.fbsdeviceId, [ + "lithium", + "lithiumPack", + ]); + if (isLithium) { + list.batt_syrl_cap = + this.lithiumParams.analog.restCap.toFixed(1) + "AH"; } return list; }, @@ -382,241 +413,82 @@ let headers = this.table.headers; let tabConfig = this.pageConfig; let batt = this.batt; - return headers.filter(item => { + return headers.filter((item) => { let isShow = item.key1 ? tabConfig[item.key1] : true; if (item.type) { - isShow = this.$units.regEquipType(batt.FBSDeviceId, item.type); + isShow = this.$units.regEquipType(batt.fbsdeviceId, item.type); } return isShow; }); - } + }, }, methods: { - //瀹氭椂鍣� - startTimer() { - this.timer.start(() => { - this.$axios - .all([ - this.realTimeSearch(), - this.realTimeGroupss(), - this.realStateTimeData(), - this.search(), - ]) - .then(() => { - this.timer.open(); - }) - .catch(() => { - this.timer.open(); - }); - }, 3000); - }, - search() { - JhStateActionSerchByCondition({ - dev_id: this.batt.FBSDeviceId, - }) - .then((res) => { - let resData = JSON.parse(res.data.result); - if (resData.code == 1) { - let dataObj = resData.data[0]; - for (let key in dataObj) { - this.totolTable.map((item) => { - if (item.key == key) { - item.value = dataObj[key]; - } - }); - this.volTable.map((item) => { - if (item.key == key) { - item.value = dataObj[key]; - } - }); - this.eleTable.map((item) => { - if (item.key == key) { - item.value = dataObj[key]; - } - }); - this.otherTable.map((item) => { - if (item.key == key) { - item.value = dataObj[key]; - } - }); - } - } - // 璁剧疆杈撳嚭鐢靛帇鏌辩姸鍥� - // this.$refs.outputVolList.setData({ - // title: { - // show: true, - // text: "杈撳嚭鐢靛帇", - // x: "center", - // textStyle: { - // fontSize: "14", - // color: '#323233' - // } - // }, - // name: "杈撳嚭鐢靛帇", - // list: this.volTable, - // }); - }) - .catch((err) => { - console.log(err); - }); - }, - //鏌ヨ鐢垫睜缁勪俊鎭� - getBattGroupInfo(BattGroupId) { - getBattGroupInfo(BattGroupId).then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - this.leafClick(rs.data[0]); - } else { - this.$toast('鏈幏鍙栧埌鐢垫睜缁勭殑淇℃伅'); - } - }).catch(error => { - console.log(error); - }); - }, - leafClick(data) { - this.batt = data; - this.realTimeAlarmss(); - this.table.headers = getTblHeader(data.FBSDeviceId); - this.table.show = false; - // 寮�鍚惊鐜姹� - this.startTimer(); - }, - realStateTimeData() { - let batt = this.batt; - if (this.$units.regEquipType(batt.FBSDeviceId, ["LD9"])) { - this.realTimeLd9Data(); - } else { - this.realTimePowerOffs(); - } - }, - /* 鏌ヨ鐢佃矾鍥惧紑鍏崇姸鎬佸拰淇℃伅 */ - realTimePowerOffs() { - let batt = this.batt; - // 璁惧涓�61850鏄剧ず鍙充晶鐨勯潰鏉� - if (this.$units.regEquipType(batt.FBSDeviceId, ["equip61850"])) { - this.stateListShow = true; - } else { - this.stateListShow = false; - } - // 鏌ヨ鍚庡彴鏁版嵁 - realTimePowerOff({ - dev_id: batt.FBSDeviceId, - }).then((res) => { - let rs = JSON.parse(res.data.result); - let outTime = 2 * 60; //璁惧瓒呮椂鏃堕棿(2鍒嗛挓) - let isOutTime = true; //閫氳涓柇 鍒ゆ柇璁惧鏄惁閫氳涓柇 true:涓柇 false:姝e父 - if (rs.code == 1) { - let data = rs.data[0]; - // 璁剧疆鐗堟湰鍙� - this.dev_version = data.dev_version; - // 鍩虹淇℃伅 - this.setEquipBase(data); - + realTimeLd9Data(res) { + if (res) { + // res = res.data; + if (res.code && res.data) { + let data = res.data2; // 鍒ゆ柇鏄惁瓒呮椂 + let outTime = 2 * 60; //璁惧瓒呮椂鏃堕棿(2鍒嗛挓) var nowTime = new Date(data.note).getTime(); //褰撳墠鏃堕棿 - var record = new Date(data.record_datetime).getTime(); + var record = new Date(data.recordDatetime).getTime(); if (Math.abs(nowTime - record) / 1000 > outTime) { this.disconnect(); } else { - // 鏈秴鏃舵墽琛岄�昏緫 - let dev_id = batt.FBSDeviceId; - this.diagram.powerCut = 0; - // 璁惧涓�61850 - if (this.$units.regEquipType(dev_id, "equip61850")) { - this.setEquip61850(data); - } else if ( - this.$units.regEquipType(dev_id, ["BTS", "BTS9110", "BTS9120", "lithium", "LD9"]) - ) { - this.setEquipBTS(data); - } else if (this.$units.regEquipType(dev_id, ["BTS9605", "BTS9611"])) { - this.setEquip9605(data); - } else { - this.disconnect(); + this.diagram.desc = ""; + // 0-鍦ㄧ嚎鐩戞祴锛�1-鏍稿娴嬭瘯锛�2-娴嬭瘯鐘舵�佺姸鎬佸仠姝紝3-鍐呴樆娴嬭瘯 + switch (data.sys_state) { + case 0: + this.diagram.type = 0; + break; + case 1: + let chargeMon = this.chargeMon; + let dischargeMon = this.dischargeMon; + // 瀛樺湪鏀剧數鍜屽厖鐢靛崟浣� + if (dischargeMon != "" && chargeMon != "") { + this.diagram.type = 6; + } else if (chargeMon != "") { + // 瀛樺湪鍏呯數鍗曚綋 + this.diagram.type = 2; + } else { + this.diagram.type = 1; + } + break; + case 2: + this.diagram.type = 0; + break; + case 3: + this.diagram.type = 3; + this.diagram.desc = "(鍐呴樆娴嬭瘯)"; + break; } } } else { - // 璁剧疆鐗堟湰鍙� - this.dev_version = ""; - // 璁惧澶勪簬鏈繛鎺� this.disconnect(); } - }); - }, - // 璁剧疆stateList鐨勫�� - setStateList(name, value, type) { - let stateList = this.stateList; - for (let i = 0; i < stateList.length; i++) { - let state = stateList[i]; - if (state.name == name) { - state.value = value; - state.type = type ? type : ""; - } - } - - let historyStateList = this.historyStateList; - for (let i = 0; i < historyStateList.length; i++) { - let state = historyStateList[i]; - if (state.name == name) { - state.value = value; - state.type = type ? type : ""; - } - } - - for (let i = 0, list = this.lastCapacityTest, j = list.length; i < j; i++) { - let state = list[i]; - if (state.name == name) { - state.value = value; - state.type = type || ""; - } } }, - // 9605璁惧 - setEquip9605(data) { - let batt = this.batt; - // 鍏抽棴閬僵灞� - this.maskShow = false; - // 鐢佃矾鍥剧被鍨� - let workstatus = parseInt(data.dev_workstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; - this.diagram.desc = ""; - let battstate = this.inputs.batt_state; - let alarmstatus = data.dev_alarmstate; + disconnect() { + // 璁惧鏈繛鎺� + this.diagram.type = -1; + this.setStateList("workState", "鏈繛鎺�"); + this.diagram.temp = 0; + // 閫氳鐘舵�� + this.setStateList("connect", "寮傚父", "table-row-error"); + // 娓╁害 + this.setStateList("devTemp", "鏈煡", "table-row-warn"); + // 骞叉帴鐐� + this.setStateList("contact", "鏈煡", "table-row-warn"); + // 鏍稿缁堟鍘熷洜 + // this.setStateList("stopReason", "鏈煡"); + // 鎿嶄綔澶辫触鍘熷洜 + this.setStateList("failReason", "鏈煡"); + // 棰勪及缁埅鏃堕暱 + //this.setStateList("xuHang", "???"); - // 璁剧疆鍋滅數鏀剧數鐘舵�� - if (data.dev_onlinevollow) { - this.inputs.batt_state = 5; - this.diagram.type = 5; - this.diagram.desc = "(寮�鍏抽棴鍚�)"; - this.diagram.powerCut = 1; - // 褰撳墠璁惧鏄疊TS璁惧 - if (workstatus === 0 && data.dev_res_test_state !== 0) { - this.diagram.desc += "(鍐呴樆娴嬭瘯)"; - } - return; - } - // 鍒ゆ柇workstatus - switch (workstatus) { - case 0: - this.diagram.type = 0; - //this.diagram.desc = '(寮�鍏抽棴鍚�)'; - // 褰撳墠璁惧鏄疊TS璁惧 - if (data.dev_res_test_state !== 0) { - this.diagram.type = 6; - this.diagram.desc += "(鍐呴樆娴嬭瘯)"; - } - break; - case 1: - this.diagram.type = 1; - //this.diagram.desc = '(寮�鍏虫柇寮�)'; - break; - case 2: - this.diagram.type = 2; - //this.diagram.desc = '(寮�鍏虫柇寮�)'; - break; - default: - this.diagram.type = -1; - this.maskShow = true; - break; - } + // 鏄剧ず閬僵灞� + this.maskShow = true; + }, // BTS璁惧淇℃伅 setEquipBTS(data) { @@ -624,22 +496,22 @@ // 鍏抽棴閬僵灞� this.maskShow = false; // 鐢佃矾鍥剧被鍨� - let workstatus = parseInt(data.dev_workstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; + let workstatus = parseInt(data.devWorkstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; this.diagram.desc = ""; - let battstate = this.inputs.batt_state; - let alarmstatus = data.dev_alarmstate; + let battstate = this.inputs.battState; + let alarmstatus = data.devAlarmstate; // 鏄惁涓洪攤鐢垫睜 - let isLithium = this.$units.regEquipType(batt.FBSDeviceId, "lithium"); + let isLithium = this.$units.regEquipType(batt.fbsdeviceId, "lithium"); // 璁剧疆鍋滅數鏀剧數鐘舵�� - if (data.dev_onlinevollow) { - this.inputs.batt_state = 5; + if (data.devOnlinevollow) { + this.inputs.battState = 5; this.diagram.type = 5; this.diagram.desc = "(寮�鍏抽棴鍚�)"; this.diagram.powerCut = 1; // 褰撳墠璁惧鏄疊TS璁惧 - if (workstatus === 0 && data.dev_res_test_state !== 0) { + if (workstatus === 0 && data.devResTestState !== 0) { this.diagram.desc += "(鍐呴樆娴嬭瘯)"; } @@ -656,14 +528,14 @@ this.diagram.type = 0; this.diagram.desc = "(寮�鍏抽棴鍚�)"; // 褰撳墠璁惧鏄疊TS璁惧 - if (data.dev_res_test_state !== 0) { + if (data.devResTestState !== 0) { this.diagram.desc += "(鍐呴樆娴嬭瘯)"; } break; case 1: if ( - data.dev_testgroupnum > 0 && - data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1 + data.devTestgroupnum > 0 && + data.devTestgroupnum === batt.groupIndexInFBSDevice + 1 ) { this.diagram.type = 1; this.diagram.desc = "(寮�鍏虫柇寮�)"; @@ -678,7 +550,7 @@ } // 褰撳墠璁惧鏄疊TS璁惧 - if (data.dev_testtype == 209) { + if (data.devTesttype == 209) { this.diagram.desc += "(KD娴嬭瘯)"; this.diagram.type = 3; } @@ -687,8 +559,8 @@ //杈ㄥ埆褰撳墠鐢垫睜缁勬槸鍚﹀湪鍏呯數 if ( this.diagram.type == 2 || - (data.dev_testgroupnum > 0 && - data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1) + (data.devTestgroupnum > 0 && + data.devTestgroupnum === batt.groupIndexInFBSDevice + 1) ) { //鍏呯數 if ( @@ -725,18 +597,18 @@ // 61850璁惧淇℃伅 setEquip61850(data) { // 鐢佃矾鍥剧被鍨� - let workstatus = parseInt(data.dev_workstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; + let workstatus = parseInt(data.devWorkstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; this.diagram.desc = ""; // 鍏抽棴閬僵灞� this.maskShow = false; // 璁剧疆鍋滅數鏀剧數鐘舵�� - if (data.dev_onlinevollow) { - this.inputs.batt_state = 5; + if (data.devOnlinevollow) { + this.inputs.battState = 5; this.diagram.type = 5; this.diagram.desc = "(寮�鍏抽棴鍚�)"; this.diagram.powerCut = 1; // 褰撳墠璁惧鏄疊TS璁惧 - if (workstatus === 0 && data.dev_res_test_state !== 0) { + if (workstatus === 0 && data.devResTestState !== 0) { this.diagram.desc += "(鍐呴樆娴嬭瘯)"; } return; @@ -783,10 +655,10 @@ // 璁惧宸ヤ綔鐘舵�� let workStates = const_61850.workstates; - this.setStateList("workState", workStates[data.dev_workstate]); + this.setStateList("workState", workStates[data.devWorkstate]); // 鏍稿缁堟鍘熷洜 // let stopReasons = const_61850.stopreasons; - // if (data.dev_workstate == 2) { + // if (data.devWorkstate == 2) { // this.setStateList("stopReason", "鏈煡"); // } else { // this.setStateList( @@ -797,10 +669,10 @@ // 鎿嶄綔澶辫触鍘熷洜 let failReasons = const_61850.failreasons; - this.setStateList("failReason", failReasons[data.dev_alarmstate]); + this.setStateList("failReason", failReasons[data.devAlarmstate]); // 鍛婅淇℃伅 - let alarms = data.dev_61850alarms.split(","); + let alarms = data.dev61850alarms.split(","); // alarms = ['false', 'false', 'true', 'false', 'true']; // 閫氳鐘舵�� if (alarms[1] == "true") { @@ -823,20 +695,443 @@ this.setStateList("contact", "姝e父", ""); } }, + // 9605璁惧 + setEquip9605(data) { + let batt = this.batt; + // 鍏抽棴閬僵灞� + this.maskShow = false; + // 鐢佃矾鍥剧被鍨� + let workstatus = parseInt(data.devWorkstate); //[0:'鍦ㄧ嚎鐩戞祴',1:'鏀剧數娴嬭瘯',2:'鍏呯數娴嬭瘯',3:'鍐呴樆娴嬭瘯',4:'鏈煡']; + this.diagram.desc = ""; + let battstate = this.inputs.battState; + let alarmstatus = data.devAlarmstate; + + // 璁剧疆鍋滅數鏀剧數鐘舵�� + if (data.devOnlinevollow) { + this.inputs.battState = 5; + this.diagram.type = 5; + this.diagram.desc = "(寮�鍏抽棴鍚�)"; + this.diagram.powerCut = 1; + // 褰撳墠璁惧鏄疊TS璁惧 + if (workstatus === 0 && data.devResTestState !== 0) { + this.diagram.desc += "(鍐呴樆娴嬭瘯)"; + } + return; + } + // 鍒ゆ柇workstatus + switch (workstatus) { + case 0: + this.diagram.type = 0; + //this.diagram.desc = '(寮�鍏抽棴鍚�)'; + // 褰撳墠璁惧鏄疊TS璁惧 + if (data.devResTestState !== 0) { + this.diagram.type = 6; + this.diagram.desc += "(鍐呴樆娴嬭瘯)"; + } + break; + case 1: + this.diagram.type = 1; + //this.diagram.desc = '(寮�鍏虫柇寮�)'; + break; + case 2: + this.diagram.type = 2; + //this.diagram.desc = '(寮�鍏虫柇寮�)'; + break; + default: + this.diagram.type = -1; + this.maskShow = true; + break; + } + }, + /* echars鍥捐〃 */ + realTimeSearch(res) { + if (res) { + let diagramType = this.diagram.type; + // res = res.data; + let data = []; + let chargeMon = ""; + let dischargeMon = ""; + if (res.code && res.data && diagramType != -1) { + data = res.data2.list.map((item) => { + if (item.monState == 1) { + dischargeMon += (dischargeMon == "" ? "#" : ",#") + item.monNum; + } else if (item.monState == 2) { + chargeMon += (chargeMon == "" ? "#" : ",#") + item.monNum; + } + return { + num1: "#" + item.monNum, + vol1: item.monVol, + res1: item.monRes, + temp1: item.monTmp, + conduct1: item.monRes ? ((1 / item.monRes) * 1000).toFixed(0) : 0, + curr1: item.monJhCurr, + leakVol1: item.monLyVol, + monConnRes: item.monConnRes, + monCap: item.mon_cap, + monTestCap: + diagramType == 1 || diagramType == 2 || diagramType == 6 + ? item.monTestCap + : "---", + monResCap: + diagramType == 1 || diagramType == 2 || diagramType == 6 + ? item.monRestCap + : "---", + monDisTimeLong: + diagramType == 1 || diagramType == 2 || diagramType == 6 + ? Math.floor(item.monDisTimeLong / 60) + + "鏃�" + + (item.monDisTimeLong % 60) + + "鍒�" + : "---", + monState: item.monState, + }; + }); + } + + // 娣诲姞姝e湪娴嬭瘯鐨勫崟浣� + this.chargeMon = chargeMon; + this.dischargeMon = dischargeMon; + // 鏇存柊琛ㄦ牸 + this.table.datas = data; + this.table.show = true; + // 鐢靛帇鍊� + let volTempVol = []; + if (res.code && res.data) { + volTempVol = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monVol.toFixed(3); + return ["#" + item.monNum, value]; + }); + } + + // 璁剧疆鐢靛帇鍊� + this.monVols = volTempVol.map((item) => { + return item[1]; + }); + + let volBarNum = this.$units.getBarNum(volTempVol); + vol.title.text = + "鏈�澶у��=" + + volBarNum.max.toFixed(2) + + "V;鏈�灏忓��=" + + volBarNum.min.toFixed(2) + + "V;骞冲潎鍊�=" + + volBarNum.avg.toFixed(2) + + "V"; + vol.series[0].data = volTempVol; + + // 鍐呴樆 + let volTempres = []; + if (res.code && res.data) { + volTempres = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monRes; + return ["#" + item.monNum, value]; + }); + } + let resBarNum = this.$units.getBarNum(volTempres); + resChart.title.text = + "鏈�澶у��=" + + resBarNum.max.toFixed(2) + + "m惟;鏈�灏忓��=" + + resBarNum.min.toFixed(2) + + "m惟;骞冲潎鍊�=" + + resBarNum.avg.toFixed(2) + + "m惟"; + resChart.series[0].data = volTempres; + + // 娓╁害 + let volTempte = []; + if (res.code && res.data) { + volTempte = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monTmp; + return ["#" + item.monNum, value]; + }); + } + + this.monTemps = volTempte.map((item) => { + return item[1]; + }); + + let tempBarNum = this.$units.getBarNum(volTempte); + temp.title.text = + "鏈�澶у��=" + + tempBarNum.max.toFixed(1) + + "鈩�;鏈�灏忓��=" + + tempBarNum.min.toFixed(1) + + "鈩�;骞冲潎鍊�=" + + tempBarNum.avg.toFixed(1) + + "鈩�"; + temp.series[0].data = volTempte; + + // 鐢靛 + let conductTemp = []; + if (res.code && res.data) { + conductTemp = res.data2.list.map((item) => { + let value = + diagramType == -1 ? 0 : this.$units.getConduct(item.monRes, item.monVol); + return ["#" + item.monNum, value]; + }); + } + let conductBarNum = this.$units.getBarNum(conductTemp); + conduct.title.text = + "鏈�澶у��=" + + conductBarNum.max.toFixed(0) + + ";鏈�灏忓��=" + + conductBarNum.min.toFixed(0) + + ";骞冲潎鍊�=" + + conductBarNum.avg.toFixed(0); + conduct.series[0].data = conductTemp; + // 鍧囪 鐢垫祦 + let currTemp = []; + if (res.code && res.data) { + currTemp = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monJhCurr; + return ["#" + item.monNum, value]; + }); + } + let currBarNum = this.$units.getBarNum(currTemp); + currChart.title.text = + "鏈�澶у��=" + + currBarNum.max.toFixed(1) + + "mA;鏈�灏忓��=" + + currBarNum.min.toFixed(1) + + "mA;骞冲潎鍊�=" + + currBarNum.avg.toFixed(1) + + "mA"; + currChart.series[0].data = currTemp; + // 婕忔恫鐢靛帇 + let leakVolTemp = []; + if (res.code && res.data) { + leakVolTemp = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monLyVol; + return ["#" + item.monNum, value]; + }); + } + let leakVolNum = this.$units.getBarNum(leakVolTemp); + leakVol.title.text = + "鏈�澶у��=" + + leakVolNum.max.toFixed(1) + + "V;鏈�灏忓��=" + + leakVolNum.min.toFixed(1) + + "V;骞冲潎鍊�=" + + leakVolNum.avg.toFixed(1) + + "V"; + leakVol.series[0].data = leakVolTemp; + + // 閾炬帴鏉¢樆鍊� + let monConnResData = []; + if (res.code && res.data) { + monConnResData = res.data2.list.map((item) => { + let value = diagramType == -1 ? 0 : item.monConnRes; + return ["#" + item.monNum, value]; + }); + } + let connResBarNum = this.$units.getBarNum(monConnResData); + monConnRes.title.text = + "鏈�澶у��=" + + connResBarNum.max.toFixed(1) + + "m惟;鏈�灏忓��=" + + connResBarNum.min.toFixed(1) + + "m惟;骞冲潎鍊�=" + + connResBarNum.avg.toFixed(1) + + "m惟"; + monConnRes.series[0].data = monConnResData; + // 鏇存柊鐢靛帇鍥捐〃 + this.setChart(); + } + }, + onWSOpen() { + this.sendMessage(); + }, + sendMessage() { + let batt = this.batt; + if (!batt.battGroupId) { + return false; + } + let params = { + battGroupId: batt.battGroupId, + devId: batt.fbsdeviceId, + powerDeviceId: 0, + groupNum: batt.groupIndexInFBSDevice, + pageType: "standard", + }; + // console.log("====", params, JSON.stringify(params)); + this.SOCKET.send(JSON.stringify(params)); + }, + onWSMessage(res) { + res = JSON.parse(res.data); + let data = res.data.data; + // console.log(data, "=====data"); + this.realTimeLd9Data(data.ld9); + this.realTimePowerOffs(data.f9100state); + this.realTimeSearch(data.rtdata); + this.realTimeGroupss(data.rtstate); + this.realTimeStateList(data.fod); + this.loadDevAla(data.rtalarm, data.rsalarm); + this.getLithiumAnalog(data.li9130); // 閿傜數姹犳ā鎷熼噺 + this.inversionData(data.fbs9100sBuscoupleState); + this.dataChangeFlag = Math.random(); // 鏁版嵁鏇存柊 + }, + search() { + JhStateActionSerchByCondition({ + dev_id: this.batt.fbsdeviceId, + }) + .then((res) => { + let resData = res.data; + if (resData.code == 1) { + let dataObj = resData.data[0]; + for (let key in dataObj) { + this.totolTable.map((item) => { + if (item.key == key) { + item.value = dataObj[key]; + } + }); + this.volTable.map((item) => { + if (item.key == key) { + item.value = dataObj[key]; + } + }); + this.eleTable.map((item) => { + if (item.key == key) { + item.value = dataObj[key]; + } + }); + this.otherTable.map((item) => { + if (item.key == key) { + item.value = dataObj[key]; + } + }); + } + } + }) + .catch((err) => { + console.log(err); + }); + }, + //鏌ヨ鐢垫睜缁勪俊鎭� + getBattGroupInfo(battGroupId) { + getBattGroupInfo(battGroupId).then(res => { + let rs = res.data; + if (rs.code == 1) { + this.leafClick(rs.data[0]); + } else { + this.$toast('鏈幏鍙栧埌鐢垫睜缁勭殑淇℃伅'); + } + }).catch(error => { + console.log(error); + }); + }, + leafClick(data) { + this.batt = data; + this.realTimeAlarmss(); + this.table.headers = getTblHeader(data.fbsdeviceId); + this.table.show = false; + // 寮�鍚惊鐜姹� + // this.startTimer(); + this.$nextTick(() => { + // 寮�鍚惊鐜姹� + this.sendMessage(); + }); + }, + /* 鏌ヨ鐢佃矾鍥惧紑鍏崇姸鎬佸拰淇℃伅 */ + realTimePowerOffs(res) { + let batt = this.batt; + // 璁惧涓�61850鏄剧ず鍙充晶鐨勯潰鏉� + if (this.$units.regEquipType(batt.fbsdeviceId, ["equip61850"])) { + this.stateListShow = true; + } else { + this.stateListShow = false; + } + // 鏌ヨ鍚庡彴鏁版嵁 + if (res) { + // res = res.data; + let outTime = 2 * 60; //璁惧瓒呮椂鏃堕棿(2鍒嗛挓) + if (res.code && res.data) { + let data = res.data2; + // 璁剧疆鐗堟湰鍙� + this.devVersion = data.devVersion; + // 鍩虹淇℃伅 + this.setEquipBase(data); + + // 鍒ゆ柇鏄惁瓒呮椂 + var nowTime = new Date(data.note).getTime(); //褰撳墠鏃堕棿 + var record = new Date(data.recordDatetime).getTime(); + if (Math.abs(nowTime - record) / 1000 > outTime) { + this.disconnect(); + } else { + // 鏈秴鏃舵墽琛岄�昏緫 + let devId = batt.fbsdeviceId; + this.diagram.powerCut = 0; + // 璁惧涓�61850 + if (this.$units.regEquipType(devId, "equip61850")) { + this.setEquip61850(data); + } else if ( + this.$units.regEquipType(devId, [ + "BTS", + "BTS9110", + "BTS9120", + "lithium", + "LD9", + "lithiumPack", + ]) + ) { + this.setEquipBTS(data); + } else if (this.$units.regEquipType(devId, ["BTS9605", "BTS9611"])) { + this.setEquip9605(data); + } else { + this.disconnect(); + } + } + } else { + // 璁剧疆鐗堟湰鍙� + this.devVersion = ""; + // 璁惧澶勪簬鏈繛鎺� + this.disconnect(); + } + } + }, + // 璁剧疆stateList鐨勫�� + setStateList(name, value, type) { + let stateList = this.stateList; + for (let i = 0; i < stateList.length; i++) { + let state = stateList[i]; + if (state.name == name) { + state.value = value; + state.type = type ? type : ""; + } + } + + let historyStateList = this.historyStateList; + for (let i = 0; i < historyStateList.length; i++) { + let state = historyStateList[i]; + if (state.name == name) { + state.value = value; + state.type = type ? type : ""; + } + } + + for (let i = 0, list = this.lastCapacityTest, j = list.length; i < j; i++) { + let state = list[i]; + if (state.name == name) { + state.value = value; + state.type = type || ""; + } + } + }, + + + // 鍩虹淇℃伅 setEquipBase(data) { - let groupIndex = this.batt.GroupIndexInFBSDevice; + let groupIndex = this.batt.groupIndexInFBSDevice; // 璁惧鐨勬俯搴� - this.diagram.temp = data.dev_temp; - let contactRes = (groupIndex != 0 - ? data.dev_conresist1 - : data.dev_conresist + this.diagram.temp = data.devTemp; + let contactRes = ( + groupIndex != 0 ? data.devConresist1 : data.devConresist ).toHold(2); - let dropVol = (groupIndex != 0 - ? data.dev_condvoldp1 - : data.dev_condvoldp + let dropVol = ( + groupIndex != 0 ? data.devCondvoldp1 : data.devCondvoldp ).toHold(2); - let alarms = data.dev_61850alarms.split(","); + let alarms = data.dev61850alarms.split(","); if (alarms.length) { this.diagram.contactRes = alarms[0] == "true" ? "k1寮傚父" : contactRes; this.diagram.dropVol = alarms[3] == "true" ? "D1寮傚父" : dropVol; @@ -845,101 +1140,86 @@ this.diagram.dropVol = dropVol; } }, - realTimeLd9Data() { - let batt = this.batt; - realTimeLd9Data({ - dev_id: batt.FBSDeviceId, - }).then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - let data = rs.data[0]; - // 鍒ゆ柇鏄惁瓒呮椂 - let outTime = 2 * 60; //璁惧瓒呮椂鏃堕棿(2鍒嗛挓) - let nowTime = new Date(data.note).getTime(); //褰撳墠鏃堕棿 - let record = new Date(data.record_datetime).getTime(); - if (Math.abs(nowTime - record) / 1000 > outTime) { - this.disconnect(); - } else { - this.diagram.desc = ""; - // 0-鍦ㄧ嚎鐩戞祴锛�1-鏍稿娴嬭瘯锛�2-娴嬭瘯鐘舵�佺姸鎬佸仠姝紝3-鍐呴樆娴嬭瘯 - switch (data.sys_state) { - case 0: - this.diagram.type = 0; - break; - case 1: - this.diagram.type = 1; - break; - case 2: - this.diagram.type = 2; - break; - case 3: - this.diagram.type = 3; - this.diagram.desc = "(鍐呴樆娴嬭瘯)"; - break; - } - } - } else { - this.disconnect(); - } - }).catch(error => { - console.log(error); - this.disconnect(); - }); - }, - disconnect() { - // 璁惧鏈繛鎺� - this.diagram.type = -1; - }, + + /* 鏌ヨ鐢垫睜鍛婅鍙傛暟 */ realTimeAlarmss() { var batt = this.batt; realTimeAlarm({ - dev_id: batt.FBSDeviceId - }).then(res => { - let rs = JSON.parse(res.data.result); - if (rs.code == 1) { - let list = rs.data; + devId: batt.fbsdeviceId, + }).then((res) => { + res = res.data; + if (res.code) { + let list = res.data.list; // 鍗曚綋鐢靛帇 this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list); // 鍗曚綋娓╁害 - this.setChartMarkLine(temp, "Temperature", "Batt_Alarm_Type_MonTmp", list); + this.setChartMarkLine( + temp, + "Temperature", + "Batt_Alarm_Type_MonTmp", + list + ); // 鍗曚綋鍐呴樆 - this.setChartMarkLine(resChart, "Resistance", "Batt_Alarm_Type_MonRes", list); + this.setChartMarkLine( + resChart, + "Resistance", + "Batt_Alarm_Type_MonRes", + list + ); // 鍗曚綋鐢靛 - this.setChartMarkLine(conduct, "Conductance", "Batt_Alarm_Type_MonRes", list); + this.setChartMarkLine( + conduct, + "Conductance", + "Batt_Alarm_Type_MonRes", + list + ); + + // 婕忔恫鐢靛帇 + this.setChartMarkLine( + leakVol, + "leakVol", + "Batt_Alarm_Type_MonLYVol", + list + ); } }); }, - setChartMarkLine(chartData, name, alm_name, list) { + setChartMarkLine(chartData, name, almName, list) { let batt = this.batt; // 閬嶅巻list for (let i = 0; i < list.length; i++) { let item = list[i]; - if (item.alm_name == alm_name) { + if (item.almName == almName) { let high = 0; let low = 0; switch (name) { - case "Voltage": // 鐢靛帇鍛婅 + case "Voltage": // 鐢靛帇鍛婅 //鍗曚綋鐢靛帇 - let std_mon_vol = batt.MonVolStd; - high = parseFloat(std_mon_vol * item.alm_high_coe).toHold(3); - low = parseFloat(std_mon_vol * item.alm_low_coe).toHold(3); + let std_mon_vol = batt.monVolStd; + high = parseFloat(std_mon_vol * item.almHighCoe).toHold(3); + low = parseFloat(std_mon_vol * item.almLowCoe).toHold(3); break; case "Temperature": //鍗曚綋娓╁害 let std_mon_tmp = 25; - high = parseFloat(std_mon_tmp * item.alm_high_coe).toHold(1); - low = parseFloat(std_mon_tmp * item.alm_low_coe).toHold(1); + high = parseFloat(std_mon_tmp * item.almHighCoe).toHold(1); + low = parseFloat(std_mon_tmp * item.almLowCoe).toHold(1); break; case "Resistance": - let std_mon_res = (1 * (batt.MonVolStd / 2)) / (batt.MonCapStd / 100); - high = parseFloat(std_mon_res * item.alm_high_coe).toHold(3); - low = parseFloat(std_mon_res * item.alm_low_coe).toHold(3); + let std_mon_res = + (1 * (batt.monVolStd / 2)) / (batt.monCapStd / 100); + high = parseFloat(std_mon_res * item.almHighCoe).toHold(3); + low = parseFloat(std_mon_res * item.almLowCoe).toHold(3); break; case "Conductance": - let std_mon_ser = batt.MonSerStd; - high = parseFloat(std_mon_ser * item.alm_high_coe).toHold(0); - low = parseFloat(std_mon_ser * item.alm_low_coe).toHold(0); + let std_mon_ser = batt.monSerStd; + high = parseFloat(std_mon_ser * item.almHighCoe).toHold(0); + low = parseFloat(std_mon_ser * item.almLowCoe).toHold(0); + break; + case "leakVol": + high = parseFloat(item.almHighCoe); + low = parseFloat(item.almLowCoe); break; } // 浣庡憡璀� @@ -950,113 +1230,7 @@ } } }, - /* echars鍥捐〃 */ - realTimeSearch() { - var batt = this.batt; - realTimeSearch({ - BattGroupId: batt.BattGroupId - }).then(res => { - let diagramType = this.diagram.type; - let rs = JSON.parse(res.data.result); - let data = []; - if (rs.code == 1 && diagramType != -1) { - data = rs.data.map(item => { - return { - num1: "#" + item.mon_num, - vol1: item.mon_vol, - res1: item.mon_res, - temp1: item.mon_tmp, - conduct1: item.mon_res - ? ((1 / item.mon_res) * 1000).toFixed(0) - : 0, - curr1: item.mon_JH_curr, - leakVol1: item.mon_LY_vol, - monConnRes: item.mon_conn_res, - monCap: item.mon_cap, - monTestCap: diagramType == 1 ? item.monTestCap : "---", - monResCap: diagramType == 1 ? item.monRestCap : "---", - monDisTimeLong: diagramType == 1 ? Math.floor(item.monDisTimeLong / 60) + "鏃�" + (item.monDisTimeLong % 60) + "鍒�" : "---", - monState: item.monState, - }; - }); - } - // 鏇存柊琛ㄦ牸 - this.table.datas = data; - this.table.show = true; - // 鐢靛帇鍊� - let volTempVol = []; - if (rs.code == 1) { - volTempVol = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_vol]; - }); - } - let volBarNum = this.$units.getBarNum(volTempVol); - vol.title.text = "鏈�澶у��=" + volBarNum.max.toFixed(2) + "V;鏈�灏忓��=" + volBarNum.min.toFixed(2) + "V;骞冲潎鍊�=" + volBarNum.avg - .toFixed(2) + "V"; - vol.series[0].data = volTempVol; - - // 鍐呴樆 - let volTempres = []; - if (rs.code == 1) { - volTempres = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_res]; - }); - } - let resBarNum = this.$units.getBarNum(volTempres); - resChart.title.text = "鏈�澶у��=" + resBarNum.max.toFixed(2) + "m惟;鏈�灏忓��=" + resBarNum.min.toFixed(2) + "m惟;骞冲潎鍊�=" + - resBarNum.avg.toFixed(2) + "m惟"; - resChart.series[0].data = volTempres; - - // 娓╁害 - let volTempte = []; - if (rs.code == 1) { - volTempte = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_tmp]; - }); - } - let tempBarNum = this.$units.getBarNum(volTempte); - temp.title.text = "鏈�澶у��=" + tempBarNum.max.toFixed(1) + "鈩�;鏈�灏忓��=" + tempBarNum.min.toFixed(1) + "鈩�;骞冲潎鍊�=" + - tempBarNum.avg.toFixed(1) + "鈩�"; - temp.series[0].data = volTempte; - - // 鐢靛 - let conductTemp = []; - if (rs.code == 1) { - conductTemp = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_res ? (1 / item.mon_res * 1000).toFixed(0) : 0]; - }); - } - let conductBarNum = this.$units.getBarNum(conductTemp); - conduct.title.text = "鏈�澶у��=" + conductBarNum.max.toFixed(0) + ";鏈�灏忓��=" + conductBarNum.min.toFixed(0) + ";骞冲潎鍊�=" + - conductBarNum.avg.toFixed(0); - conduct.series[0].data = conductTemp; - // 鍧囪 鐢垫祦 - let currTemp = []; - if (rs.code == 1) { - currTemp = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_JH_curr]; - }); - } - let currBarNum = this.$units.getBarNum(currTemp); - currChart.title.text = "鏈�澶у��=" + currBarNum.max.toFixed(1) + "mA;鏈�灏忓��=" + currBarNum.min.toFixed(1) + "mA;骞冲潎鍊�=" + - currBarNum.avg.toFixed(1) + "mA"; - currChart.series[0].data = currTemp; - // 婕忔恫鐢靛帇 - let leakVolTemp = []; - if (rs.code == 1) { - leakVolTemp = rs.data.map(item => { - return ["#" + item.mon_num, item.mon_LY_vol]; - }); - } - let leakVolNum = this.$units.getBarNum(leakVolTemp); - leakVol.title.text = "鏈�澶у��=" + leakVolNum.max.toFixed(1) + "V;鏈�灏忓��=" + leakVolNum.min.toFixed(1) + "V;骞冲潎鍊�=" + - leakVolNum.avg.toFixed(1) + 'V'; - leakVol.series[0].data = leakVolTemp; - // 鏇存柊鐢靛帇鍥捐〃 - this.setChart(); - }); - }, initChart() { // 鐢靛帇 vol = { @@ -1066,17 +1240,18 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } - }, - series: [{ - name: "鐢靛帇", - type: "bar", - data: [], - markLine: { - data: getMarkLineData(), }, - }] + }, + series: [ + { + name: "鐢靛帇", + type: "bar", + data: [], + markLine: { + data: getMarkLineData(), + }, + }, + ], }; // 婕忔恫鐢靛帇 leakVol = { @@ -1086,14 +1261,18 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } + }, }, - series: [{ - name: "婕忔恫鐢靛帇", - type: "bar", - data: [], - }] + series: [ + { + name: "婕忔恫鐢靛帇", + type: "bar", + data: [], + markLine: { + data: getMarkLineData(), + }, + }, + ], }; // 鍐呴樆 @@ -1104,17 +1283,18 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } - }, - series: [{ - name: "鍐呴樆", - type: "bar", - data: [], - markLine: { - data: getMarkLineData(), }, - }] + }, + series: [ + { + name: "鍐呴樆", + type: "bar", + data: [], + markLine: { + data: getMarkLineData(), + }, + }, + ], }; // 娓╁害 @@ -1125,18 +1305,20 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } - }, - series: [{ - name: "娓╁害", - type: "bar", - data: [], - markLine: { - data: getMarkLineData(), }, - }] + }, + series: [ + { + name: "娓╁害", + type: "bar", + data: [], + markLine: { + data: getMarkLineData(), + }, + }, + ], }; + // 鐢靛 conduct = { title: { @@ -1145,17 +1327,18 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } - }, - series: [{ - name: "鐢靛", - type: "bar", - data: [], - markLine: { - data: getMarkLineData(), }, - }] + }, + series: [ + { + name: "鐢靛", + type: "bar", + data: [], + markLine: { + data: getMarkLineData(), + }, + }, + ], }; // 鍧囪 鐢垫祦 currChart = { @@ -1165,14 +1348,34 @@ x: "center", textStyle: { fontSize: "14", - color: '#323233' - } + }, }, - series: [{ - name: "鍧囪 鐢垫祦", - type: "bar", - data: [] - }] + series: [ + { + name: "鍧囪 鐢垫祦", + type: "bar", + data: [], + }, + ], + }; + + // 閾炬帴鏉¢樆鍊� + monConnRes = { + title: { + show: true, + text: "鏈�澶у��=0m惟;鏈�灏忓��=0m惟;骞冲潎鍊�=0m惟", + x: "center", + textStyle: { + fontSize: "14", + }, + }, + series: [ + { + name: "閾炬帴鏉¢樆鍊�", + type: "bar", + data: [], + }, + ], }; // 璁剧疆閰嶇疆椤� this.setChart(); @@ -1186,16 +1389,111 @@ this.$refs.leakVol.setOption(leakVol); }, /* 瀹炴椂缁勭淇℃伅 */ - realTimeGroupss() { - var batt = this.batt; - realTimeGroup(batt.BattGroupId).then(res => { - let rsa = JSON.parse(res.data.result); - if (rsa.code == 1) { - this.inputs = rsa.data[0]; + realTimeGroupss(res) { + if (res) { + // res = res.data; + if (res.code && res.data) { + this.inputs = res.data2; } - }).catch(err => { - console.log(err) - }); + } + }, + realTimeStateList(res) { + // 鑾峰彇鍓╀綑澶╂暟锛屽伐浣滄ā寮忥紝缁勭鐢靛帇锛屽嘲鍊肩數鍘� + // let batt = this.batt; + // 浠呮湁缂栧彿涓嶅仛浠讳綍鎿嶄綔 + if (this.fodHeaders.length == 1) { + return; + } + if (res) { + // res = res.data; + let data = []; + if (res.code && res.data) { + let rsData = res.data2; + let workModels = ["鍋滄", "鍏绘姢", "闄ょ~"]; + let list = ["One", "Two", "Three", "Four", "Five"]; + let fodHeaders = this.fodHeaders; + data = list.map((item, index) => { + let workModel = rsData["workstate" + item]; + return fodHeaders.map((fod) => { + if (fod.prop == "num") { + return index + 1; + } else if (fod.prop == "workstate") { + return workModels[workModel]; + } else { + return rsData[fod.prop + item]; + } + }); + //return [index+1, rsData['RestTime_'+item], workModels[workModel], rsData['vgroupvol'+item], rsData['vpeakvol'+item]] + }); + this.fodData = data; + } + } + }, + loadDevAla(rtalarm, rsalarm) { + if (rtalarm) { + let res = rtalarm; + let list = []; + if (res.code && res.data) { + list = res.data2.list; + } + // this.table2.datas = list; + } + if (rsalarm) { + let res = rsalarm; + let list = []; + if (res.code && res.data) { + list = res.data2.list; + } + // this.table1.datas = list; + } + }, + /** + * 璇诲彇閿傜數姹犱俊鎭� 鏆傚畾璇诲彇缁勪竴鐨� + */ + getLithiumAnalog(res) { + if (res) { + // res = res.data; + if (res.code && res.data) { + // 鍓╀綑瀹归噺杩涜绱姞 + let restCap = 0; + let packVols = []; + let packCurrs = []; + res.data2.map((item) => { + restCap += item.restCap; + packVols.push(item.sumVol); + packCurrs.push(item.current); + }); + this.packVols = packVols; + this.packCurrs = packCurrs; + let data = res.data2[0]; + data.restCap = restCap; + this.lithiumParams.analog = data; + } else { + this.lithiumParams.analog = lithiumInfo.analog().params; + } + } + }, + inversionData(res) { + // 鏄�嗗彉鐨勮澶� + if (res && this.$units.regEquipType(this.batt.fbsdeviceId, "BTS9120")) { + // res = res.data; + let data = { + commustate: -1, // 閫氳鐘舵�� + fanglei_state: -1, // 闃查浄鐘舵�� + rlayworkmode: -1, // 绌哄紑鐘舵�� + }; + if (res.code) { + data = res.data; + } + + if (data.rlayworkmode == 1 || data.rlayworkmode == 3) { + this.buscoupleSwitch = 1; + } else { + this.buscoupleSwitch = 0; + } + } else { + this.buscoupleSwitch = 0; + } }, // 鍏ㄩ儴閫夐」閫夋嫨瀹屾瘯鍚庯紝浼氳Е鍙� finish 浜嬩欢 onFinish({ selectedOptions }) { @@ -1207,18 +1505,13 @@ onChange(select) { if (select.tabIndex == 3) { let objs = select.selectedOptions[select.selectedOptions.length - 1]; - searchBattInfo({ - StationName1: objs.data.StationName1, - StationName2: objs.data.StationName2, - StationName5: objs.data.StationName5, - StationName3: objs.data.StationName3 - }).then((res) => { - let rs = JSON.parse(res.data.result); + getBattList(objs.data.stationId).then((res) => { + let rs = res.data; if (rs.code == 1) { let data = rs.data; data.map(item => { - item.text = item.StationName4 + '-' + item.BattGroupName - item.value = item.BattGroupId + item.text = item.stationName4 + '-' + item.battGroupName + item.value = item.battGroupId }) this.options.map(item => { item?.children.map(jtem => { @@ -1238,13 +1531,13 @@ } }, //鏌ヨ绔欑偣淇℃伅 - searchStation() { - searchStation({ - StationName1: "", - StationName2: "", - StationName5: "", + getAllStations() { + getAllStations({ + stationName1: "", + stationName2: "", + stationName5: "", }).then((res) => { - let rs = JSON.parse(res.data.result); + let rs = res.data; let data = []; if (rs.code == 1) { data = rs.data; @@ -1261,13 +1554,13 @@ // 閬嶅巻鏁版嵁鏋勯�犳爲鐘� data.forEach(item => { // 鐪� - let provice = this.addData(result, item.StationName1); + let provice = this.addData(result, item.stationName1); // 甯� - let city = this.addData(provice.children, item.StationName2, provice); + let city = this.addData(provice.children, item.stationName2, provice); // 鍖哄幙 - let county = this.addData(city.children, item.StationName5, city); + let county = this.addData(city.children, item.stationName5, city); // 鏈烘埧 - let home = this.addData(county.children, item.StationName3, county, item); + let home = this.addData(county.children, item.stationName3, county, item); }); // 璁剧疆鏍戠姸鍒楄〃 this.options = result; @@ -1315,12 +1608,13 @@ }, }, mounted() { - this.searchStation(); // 鍒濆鍖栧浘琛� this.initChart(); + this.getAllStations(); + }, destroyed() { - this.timer.stop(); + } } </script> diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a538a97..418dec0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -26,10 +26,10 @@ }, mutations: { login(state, provider) { - state.userId = provider.data; - state.userPower = provider.data2; - sessionStorage.setItem('userId', provider.data); - sessionStorage.setItem('userPower', provider.data2); + state.userId = provider.uid; + state.userPower = provider.urole; + sessionStorage.setItem('userId', provider.uid); + sessionStorage.setItem('userPower', provider.urole); }, changeRealTabsConfig(state, data) { state.realTabsConfig = Array.isArray(data) ? data : []; -- Gitblit v1.9.1