From 0aa509e4306b8984b551cfa19aff9e407a9a9d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98937886381=E2=80=99?= <‘937886381@qq.com’> Date: Wed, 27 Mar 2024 09:30:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/OperationalOverview/websocket.js | 51 ++++++++++++++----- src/views/report/glass/day.vue | 6 +-- src/views/report/glass/inputTable.vue | 6 +-- src/views/report/glass/month.vue | 2 +- src/views/report/glass/weekly.vue | 2 +- src/views/report/glass/year.vue | 2 +- .../report/productionDayReport/index.vue | 4 +- 7 files changed, 48 insertions(+), 25 deletions(-) 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/report/glass/day.vue b/src/views/report/glass/day.vue index b6c68cc1..6d408a77 100644 --- a/src/views/report/glass/day.vue +++ b/src/views/report/glass/day.vue @@ -1,7 +1,7 @@ @@ -16,9 +16,9 @@ - 查询 - 导出 diff --git a/src/views/report/glass/inputTable.vue b/src/views/report/glass/inputTable.vue index e112eb3f..4b33c779 100644 --- a/src/views/report/glass/inputTable.vue +++ b/src/views/report/glass/inputTable.vue @@ -1,7 +1,7 @@ @@ -206,12 +206,10 @@ const cols = [ }, methods: { handleReturn() { - // this.disabled = true this.edit = false + console.log(this.$parent.getDataList()); }, handleChange(e) { - // console.log(q) - console.log(e); }, updateData() { let obj = {} diff --git a/src/views/report/glass/month.vue b/src/views/report/glass/month.vue index ddbb382d..e958185d 100644 --- a/src/views/report/glass/month.vue +++ b/src/views/report/glass/month.vue @@ -7,7 +7,7 @@ - 查询 导出 diff --git a/src/views/report/glass/weekly.vue b/src/views/report/glass/weekly.vue index 2b167a9a..5c1cdd66 100644 --- a/src/views/report/glass/weekly.vue +++ b/src/views/report/glass/weekly.vue @@ -14,7 +14,7 @@ - 查询 导出 diff --git a/src/views/report/glass/year.vue b/src/views/report/glass/year.vue index 1d76ed21..31547716 100644 --- a/src/views/report/glass/year.vue +++ b/src/views/report/glass/year.vue @@ -9,7 +9,7 @@ - 查询 导出 diff --git a/src/views/report/productionDayReport/index.vue b/src/views/report/productionDayReport/index.vue index 23563c5c..f16e7da3 100644 --- a/src/views/report/productionDayReport/index.vue +++ b/src/views/report/productionDayReport/index.vue @@ -1,7 +1,7 @@ @@ -456,6 +456,8 @@ export default { handleReturn() { this.disabled = true this.isSave = false + this.getDataList() + }, format(shijianchuo) { //shijianchuo是整数,否则要parseInt转换 From 6ce3faf98d2cb093c09d2a0d8865947576041a13 Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Wed, 27 Mar 2024 09:43:26 +0800 Subject: [PATCH 2/2] 1 --- .../energy/base/energyPlcConnect/index.vue | 3 +- .../base/energyQuantityManual/index.vue | 3 +- .../base/energyQuantityRealtime/index.vue | 9 ++- .../monitoring/energyStatistics/index.vue | 79 +++++++------------ 4 files changed, 38 insertions(+), 56 deletions(-) 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 @@
- + - - + + - + - + - +
@@ -63,7 +40,7 @@ const tableProps = [ showOverflowtooltip: true }, { - prop: 'type', + prop: 'type', label: '统计类型', filter: publicFormatter('statistic_type') }, @@ -81,7 +58,7 @@ const tableProps = [ } ] export default { - name: "energyStatistics", + name: "EnergyStatistics", components: { EnergyStatisticsAdd, EnergyStatisticsDet }, data() { return { @@ -112,26 +89,26 @@ export default { tableProps, tableBtn: [ this.$auth.hasPermi('monitoring:energy-statistics:bind') - ? { + ? { type: 'connect', btnName: '绑定' } - : undefined, + : undefined, { type: 'detail', btnName: '详情' }, this.$auth.hasPermi('monitoring:energy-statistics:update') ? { - type: 'edit', - btnName: '编辑' - } + type: 'edit', + btnName: '编辑' + } : undefined, this.$auth.hasPermi('monitoring:energy-statistics:delete') ? { - type: 'delete', - btnName: '删除' - } + type: 'delete', + btnName: '删除' + } : undefined ].filter((v) => v), tableH: this.tableHeight(260), @@ -224,13 +201,13 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function() { - return deleteEnergyStatistics(row.id); - }).then(() => { - this.queryParams.pageNo = 1; - this.getList(); - this.$modal.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function () { + return deleteEnergyStatistics(row.id); + }).then(() => { + this.queryParams.pageNo = 1; + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => { }); }, closeDrawer() { this.getList()