| | |
| | | }); |
| | | }, |
| | | /** |
| | | * 获取绝缘装置的实时信息 |
| | | * @param data |
| | | * @returns {AxiosPromise} |
| | | */ |
| | | getIsolatingDeviceData(data) { |
| | | return axios({ |
| | | method: 'post', |
| | | url: 'FBS9100InsulateStateAction_action_getDataByDevId', |
| | | data: 'json=' + JSON.stringify(data), |
| | | }); |
| | | }, |
| | | /** |
| | | * 获取充电机的实时信息 |
| | | * @param data |
| | | * @returns {AxiosPromise} |
| | | */ |
| | | getChargeDeviceData(data) { |
| | | return axios({ |
| | | method: 'post', |
| | | url: 'FBS9100ChargerStateAction_action_getDataByDevId', |
| | | data: 'json=' + JSON.stringify(data), |
| | | }); |
| | | }, |
| | | /** |
| | | * 查询已经存在的机房站点 |
| | | * @param {[Object]} data 电源设备ID |
| | | */ |
| | |
| | | uKey: { |
| | | label: 'uKey', |
| | | des: "用户需要通过插入uKey才可以登录", |
| | | value: false, |
| | | value: true, |
| | | }, |
| | | face: { |
| | | label: "人脸识别", |
| | | des: "用户可以直接通过人脸识别登录", |
| | | value: false |
| | | value: true |
| | | }, |
| | | autograph: { |
| | | label: '签名', |
| | | des: '电池信息配置中添加设备的签名,用于充放电测试时验证', |
| | | value: false, |
| | | value: true, |
| | | }, |
| | | } |
| | |
| | | <div class="page-header-container"> |
| | | <flex-layout direction="row"> |
| | | <div class="page-header-left" slot="header"> |
| | | <img class="header-first-logo" src="../assets/images/gjdw-log.png"> |
| | | <!-- <img class="header-first-logo" src="../assets/images/nfdw-log.png">--> |
| | | <!-- <img class="header-first-logo" src="../assets/images/gjdw-log.png">--> |
| | | <img class="header-first-logo" src="../assets/images/nfdw-log.png"> |
| | | <span class="header-carve-up"></span> |
| | | <span>蓄电池监控平台</span> |
| | | <!-- <span>综合电力监控平台</span>--> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="data-totals"> |
| | | <hdw-badge-btn text="电源告警数" :value="numbers.powerWarn" @click="goPages('powerWarn')"></hdw-badge-btn> |
| | | <hdw-badge-btn text="电源告警数" :value="numbers.powerWarn" |
| | | @click="goPages('powerWarn')"></hdw-badge-btn> |
| | | <hdw-badge-btn text="机房停电数" :value="numbers.powerOff" @click="goPages('powerOff')"> |
| | | </hdw-badge-btn> |
| | | <hdw-badge-btn text="电池告警数" :value="numbers.battWarn" @click="goPages('battWarn')"> |
| | |
| | | let rs = JSON.parse(res.data.result); |
| | | if (rs.code == 1) { |
| | | let data = rs.data[0]; |
| | | console.log(data); |
| | | let totalDiscSpace = data.total_disc_space; |
| | | // 设置服务器磁盘信息 |
| | | let disc_spance_percent = totalDiscSpace?((data.total_disc_space - data.free_disc_space) * 100 /totalDiscSpace ).toFixed(0):0; |
| | |
| | | import ContentBox from "@/components/ContentBox"; |
| | | import ChargerStatusTabPane from "@/pages/dataMager/components/ChargerStatusTabPane"; |
| | | import getChargerInfo from "@/pages/dataMager/js/getChargerInfo"; |
| | | import {getWsUrl} from "@/assets/js/tools"; |
| | | import {getWsUrl, Timeout} from "@/assets/js/tools"; |
| | | import getIsolatingInfo from "@/pages/dataMager/js/getIsolatingInfo"; |
| | | export default { |
| | | name: "chargerStatus", |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | timer: new Timeout(), |
| | | isOpen: false, |
| | | powerInfo: { |
| | | powerDeviceId: 0, |
| | |
| | | stationName5: "", |
| | | }; |
| | | } |
| | | // 初始化WebSocket |
| | | this.close(); |
| | | this.initSocket(); |
| | | // 开启查询 |
| | | this.startSearch(); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | initSocket() { |
| | | // 未被初始化初始化 |
| | | if (!this.isOpen) { |
| | | const wsUri = getWsUrl("", 55003); |
| | | this.socket = new WebSocket(wsUri); |
| | | this.socket.onmessage = this.onMessage; |
| | | this.socket.onopen = this.onOpen; |
| | | this.socket.onerror = this.onError; |
| | | this.socket.onclose = this.close; |
| | | } |
| | | startSearch() { |
| | | this.timer.start(()=>{ |
| | | this.$axios.all([this.searchData()]).then(()=>{ |
| | | this.timer.open(); |
| | | }).catch(error=>{ |
| | | this.timer.open(); |
| | | }); |
| | | },4000); |
| | | }, |
| | | onMessage(res) { |
| | | let rs = JSON.parse(res.data); |
| | | searchData() { |
| | | this.$apis.dataMager.powerMager.getChargeDeviceData({ |
| | | powerDeviceId: this.powerInfo.powerDeviceId |
| | | }).then(res=>{ |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1 && rs.data) { |
| | | this.info = rs.data; |
| | | }else { |
| | | this.info = getChargerInfo() |
| | | } |
| | | }, |
| | | onOpen() { |
| | | // 打印关闭信息 |
| | | console.log("启动充电机WebSocket"); |
| | | // 标识正在运行 |
| | | this.isOpen = true; |
| | | console.log() |
| | | // 向后台发送请求数据 |
| | | this.socket.send(this.powerInfo.powerDeviceId); |
| | | }, |
| | | onError() { |
| | | |
| | | }, |
| | | close() { |
| | | // 关闭websocket |
| | | if (this.isOpen) { |
| | | // 打印关闭信息 |
| | | console.log("关闭充电机WebSocket"); |
| | | this.isOpen = false; |
| | | this.socket.close(); |
| | | } |
| | | }).catch(error=>{ |
| | | this.info = getChargerInfo(); |
| | | console.log(error); |
| | | }) |
| | | }, |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | destroyed() { |
| | | this.close(); |
| | | this.timer.stop(); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <script> |
| | | import ContentBox from "@/components/ContentBox"; |
| | | import IsolatingDeviceTabPane from "@/pages/dataMager/components/IsolatingDeviceTabPane"; |
| | | import {getWsUrl} from "@/assets/js/tools"; |
| | | import {getWsUrl, Timeout} from "@/assets/js/tools"; |
| | | import getIsolatingInfo from "@/pages/dataMager/js/getIsolatingInfo"; |
| | | |
| | | export default { |
| | |
| | | data() { |
| | | return { |
| | | isOpen: false, |
| | | timer: new Timeout(), |
| | | powerInfo: { |
| | | powerDeviceId: 0, |
| | | stationId: 0, |
| | |
| | | stationName5: "", |
| | | }; |
| | | } |
| | | // 初始化WebSocket |
| | | this.close(); |
| | | this.initSocket(); |
| | | // 启动查询 |
| | | this.startSearch(); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | initSocket() { |
| | | // 未被初始化初始化 |
| | | if (!this.isOpen) { |
| | | const wsUri = getWsUrl("", 55002); |
| | | this.socket = new WebSocket(wsUri); |
| | | this.socket.onmessage = this.onMessage; |
| | | this.socket.onopen = this.onOpen; |
| | | this.socket.onerror = this.onError; |
| | | this.socket.onclose = this.close; |
| | | } |
| | | startSearch() { |
| | | this.timer.start(()=>{ |
| | | this.$axios.all([this.searchData()]).then(()=>{ |
| | | this.timer.open(); |
| | | }).catch(error=>{ |
| | | this.timer.open(); |
| | | }); |
| | | },4000); |
| | | }, |
| | | onMessage(res) { |
| | | let rs = JSON.parse(res.data); |
| | | searchData() { |
| | | this.$apis.dataMager.powerMager.getIsolatingDeviceData({ |
| | | powerDeviceId: this.powerInfo.powerDeviceId |
| | | }).then(res=>{ |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1 && rs.data) { |
| | | this.info = rs.data; |
| | | }else { |
| | | this.info = getIsolatingInfo() |
| | | this.info = getIsolatingInfo(); |
| | | } |
| | | }, |
| | | onOpen() { |
| | | // 打印关闭信息 |
| | | console.log("启动绝缘监控WebSocket"); |
| | | // 标识正在运行 |
| | | this.isOpen = true; |
| | | console.log() |
| | | // 向后台发送请求数据 |
| | | this.socket.send(this.powerInfo.powerDeviceId); |
| | | }, |
| | | onError() { |
| | | |
| | | }, |
| | | close() { |
| | | // 关闭websocket |
| | | if (this.isOpen) { |
| | | // 打印关闭信息 |
| | | console.log("关闭绝缘监控WebSocket"); |
| | | this.isOpen = false; |
| | | this.socket.close(); |
| | | } |
| | | }).catch(error=>{ |
| | | this.info = getIsolatingInfo(); |
| | | console.log(error); |
| | | }) |
| | | }, |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | destroyed() { |
| | | this.close(); |
| | | this.timer.stop(); |
| | | } |
| | | } |
| | | </script> |