From 50d50abccf262c62903c3b2eba14096b8f9c26b8 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期二, 22 十月 2024 19:59:06 +0800
Subject: [PATCH] 1
---
src/views/mdc/realtime-status/index.vue | 40 ++++++++++++++++++++--------------------
src/utils/tool.js | 2 +-
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/utils/tool.js b/src/utils/tool.js
index 6ffb140..9661386 100644
--- a/src/utils/tool.js
+++ b/src/utils/tool.js
@@ -2,7 +2,7 @@
* @Descripttion: 宸ュ叿闆�
* @version: 1.2
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-10 10:17:47
+ * @LastEditTime: 2024-10-22 19:58:38
*/
import CryptoJS from 'crypto-js';
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index e356414..ece0fac 100644
--- a/src/views/mdc/realtime-status/index.vue
+++ b/src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
<!--
* @Date: 2024-04-09 22:11:21
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-21 15:01:18
+ * @LastEditTime: 2024-10-22 19:46:11
* @FilePath: /cps-web/src/views/mdc/realtime-status/index.vue
瀹炴椂鐪嬫澘
-->
@@ -221,18 +221,14 @@
this.gettimestatus(); //鏌ヨ鍒楄〃
},
showvisible(item, index) {
- //clickIndex
+ if(item.properties.length == 0) {
+ this.$message({
+ message: '璇ュ伐浣嶆病鏈夐厤缃暟鎹偣',
+ type: 'warning'
+ });
+ return;
+ }
this.clickIndex = index;
- // if (item.properties == null || item.properties.length == 0) {
- // this.$message({
- // message: '璇烽厤缃噰闆嗛」',
- // type: 'warning'
- // });
- // return;
- // }
- // var visibleList = JSON.parse(JSON.stringify(item.properties));
- // this.titleMap = "瀹炴椂鏁版嵁(" + item.code + ")";
- // this.visibleList = visibleList;
this.visible = true;
},
searchstatus(item, index) {
@@ -270,12 +266,12 @@
}
})
},
- changeTime(time) {
+ changeTime(time,diffTime) {
// 浣跨敤Moment.js瑙f瀽杩欎袱涓棩鏈熷瓧绗︿覆
var date1 = moment(time);
- var date2 = moment(moment().format('YYYY-MM-DD HH:mm:ss'));
+ var date2 = moment(diffTime);
// 璁$畻涓や釜鏃ユ湡涔嬮棿鐨勫樊寮傦紙姣锛�
- var differenceInMilliseconds = date2.diff(date1); // 娉ㄦ剰锛歞ate2 - date1 缁欏嚭姝f暟宸紓
+ var differenceInMilliseconds = date1.diff(date2); // 娉ㄦ剰锛歞ate1 - date2 缁欏嚭姝f暟宸紓
// 浣跨敤duration瀵硅薄灏嗗樊寮傝浆鎹负鏇存槗浜庡鐞嗙殑鍗曚綅
var duration = moment.duration(differenceInMilliseconds);
// 鎻愬彇澶╂暟銆佸皬鏃舵暟銆佸垎閽熸暟鍜岀鏁�
@@ -334,7 +330,6 @@
this.$TOOL.socket.websocket.onmessage = function (event) {
//num++;
var eventData = JSON.parse(event.data);
- if (Object.keys(eventData.data).length == 0) return;
if (that.timestatus.length == 0) return; //娌″�间笉鐢ㄥ惊鐜�
that.timestatus.forEach((item, index) => { //绗竴姝ユ妸v鏀惧埌code閲�
if (eventData.id == item.id) {
@@ -344,8 +339,10 @@
}
if (eventData.data.DeviceStatus) {
var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss');
- var diffTime = that.changeTime(time); //杞崲鎴愬樊鍊硷紙鏃跺垎绉掞級
+ var preT = moment(eventData.data.DeviceStatus.preT).format('YYYY-MM-DD HH:mm:ss');
+ var diffTime = that.changeTime(time,preT); //杞崲鎴愬樊鍊硷紙鏃跺垎绉掞級
//that.setIntervalTime(); //鍗佺澧炲姞鏃堕棿
+ var diffTime = diffTime;
item.time = diffTime;
that.allwcs.forEach(item1 => {
if (item1.code == eventData.data.DeviceStatus.v) {
@@ -368,6 +365,10 @@
item1.code = item2.name;
}
})
+ if (Object.keys(eventData.data).length == 0) { //ws娌℃湁data鏁版嵁锛岀粰榛樿鍊�
+ item1.code = "";
+ item1.color = "#E4A512";
+ };
} else {
if (item1.key == 'Alarm') { //鎶ヨ
if (eventData.data[item1.key]) {
@@ -377,7 +378,6 @@
if (v.length == 0) {
res.data.records[index].properties.splice(index1, 1);
} else {
- item1.name = v[0].alarmNo;
item1.code = v[0].alarmNo;
}
} else {
@@ -558,12 +558,12 @@
width: 12px;
height: 12px;
border-radius: 6px;
- margin-right: 8px;
+ margin-right: 2px;
}
.status-card-detail-time {
line-height: 12px;
- margin-left: 8px;
+ margin-left: 2px;
}
.status-card-machine {
--
Gitblit v1.9.3