diff --git a/src/views/OperationalOverview/websocket.js b/src/views/OperationalOverview/websocket.js index 82a96847..f3b5eedd 100644 --- a/src/views/OperationalOverview/websocket.js +++ b/src/views/OperationalOverview/websocket.js @@ -1,10 +1,3 @@ -/* - * @Author: zhp - * @Date: 2024-01-29 17:05:25 - * @LastEditTime: 2024-01-29 17:05:25 - * @LastEditors: zhp - * @Description: - */ /** * 发起websocket请求函数 * @param {string} url ws连接地址 @@ -49,7 +42,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) { this.lockReconnect = true; this.wsCreateHandler && clearTimeout(this.wsCreateHandler); // 关闭心跳检查 - // heartCheck.stop(); + heartCheck.stop(); } }; const initWsEventHandle = () => { @@ -57,13 +50,13 @@ export function WsConnect(url, agentData, successCallback, errCallback) { // 连接成功 this.wsObj.onopen = (event) => { onWsOpen(event); - // heartCheck.start(); + heartCheck.start(); }; // 监听服务器端返回的信息 this.wsObj.onmessage = (event) => { onWsMessage(event); - // heartCheck.start(); + heartCheck.start(); }; this.wsObj.onclose = (event) => { @@ -130,7 +123,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) { if (this.lockReconnect) { return; } - writeToScreen("3秒后重连"); + writeToScreen("5秒后重连"); this.lockReconnect = true; // 没连接上会一直重连,设置延迟避免请求过多 this.wsCreateHandler && clearTimeout(this.wsCreateHandler); @@ -139,10 +132,40 @@ export function WsConnect(url, agentData, successCallback, errCallback) { this.createWebSoket(); this.lockReconnect = false; writeToScreen("重连完成"); - }, 3000); + }, 5000); }; - // 心跳检查(看看websocket是否还在正常连接中) + // 心跳检查(看看websocket是否还在正常连接中,不需要服务端返回,单向的) + let _this = this + let heartCheck = { + timeout: 55000, + timeoutObj: null, + // 重启 + reset() { + clearTimeout(this.timeoutObj); + this.start(); + }, + // 停止 + stop() { + clearTimeout(this.timeoutObj); + }, + // 开启定时器 + start() { + this.timeoutObj && clearTimeout(this.timeoutObj); + this.timeoutObj = setTimeout(() => { + writeToScreen("心跳检查,发送ping到后台"); + try { + const datas = { ping: true }; + _this.wsObj.send(JSON.stringify(datas)); + } catch (err) { + writeToScreen("发送ping异常"); + } + }, this.timeout); + }, + }; + + + // 心跳检查(看看websocket是否还在正常连接中,和服务端通信,双向的) // let heartCheck = { // timeout: 15000, // timeoutObj: null, @@ -167,7 +190,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) { // writeToScreen("心跳检查,发送ping到后台"); // try { // const datas = { ping: true }; - // this.wsObj.send(JSON.stringify(datas)); + // _this.wsObj.send(JSON.stringify(datas)); // } catch (err) { // writeToScreen("发送ping异常"); // } diff --git a/src/views/energy/base/energyPlcConnect/index.vue b/src/views/energy/base/energyPlcConnect/index.vue index a7303062..c189d06c 100644 --- a/src/views/energy/base/energyPlcConnect/index.vue +++ b/src/views/energy/base/energyPlcConnect/index.vue @@ -36,7 +36,8 @@ const tableProps = [ }, { prop: 'objCode', - label: '对象编码' + label: '对象编码', + showOverflowtooltip: true }, { prop: 'plcTableName', diff --git a/src/views/energy/base/energyQuantityManual/index.vue b/src/views/energy/base/energyQuantityManual/index.vue index 26a19624..036c8b83 100644 --- a/src/views/energy/base/energyQuantityManual/index.vue +++ b/src/views/energy/base/energyQuantityManual/index.vue @@ -46,7 +46,8 @@ const tableProps = [ prop: 'tableName', label: '能源表名', filter: publicFormatter('table_name'), - minWidth: 110 + minWidth: 110, + showOverflowtooltip: true }, { prop: 'recordTime', diff --git a/src/views/energy/base/energyQuantityRealtime/index.vue b/src/views/energy/base/energyQuantityRealtime/index.vue index a8b9e6ed..b0226246 100644 --- a/src/views/energy/base/energyQuantityRealtime/index.vue +++ b/src/views/energy/base/energyQuantityRealtime/index.vue @@ -20,15 +20,18 @@ import * as XLSX from 'xlsx/xlsx.mjs' const tableProps = [ { prop: 'objName', - label: '统计对象' + label: '统计对象', + showOverflowtooltip: true }, { prop: 'objCode', - label: '对象编码' + label: '对象编码', + showOverflowtooltip: true }, { prop: 'energyTypeName', - label: '能源类型' + label: '能源类型', + showOverflowtooltip: true }, { prop: 'startValue', diff --git a/src/views/energy/monitoring/energyStatistics/index.vue b/src/views/energy/monitoring/energyStatistics/index.vue index 87f6aa54..1bdcb6c0 100644 --- a/src/views/energy/monitoring/energyStatistics/index.vue +++ b/src/views/energy/monitoring/energyStatistics/index.vue @@ -2,46 +2,23 @@