From cb7253131da4ca58252893c26fa93cd305eaaad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com>
Date: Mon, 9 Dec 2024 17:16:04 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9C=8B=E6=9D=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/src/views/board/index.vue | 54 ++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 10 deletions(-)
diff --git a/ruoyi-ui/src/views/board/index.vue b/ruoyi-ui/src/views/board/index.vue
index 0036170..cdc3dc0 100644
--- a/ruoyi-ui/src/views/board/index.vue
+++ b/ruoyi-ui/src/views/board/index.vue
@@ -10,20 +10,20 @@
运行速度:
升降状态:
实时位置:
- 停止
- 0m/s
- 停止
- 位置1#
+ {{ AlarmInfo.deviceStatus }}
+ {{ AlarmInfo.runSpeed }}m/s
+ {{ AlarmInfo.liftStatus }}
+ 位置{{ AlarmInfo.realAddr }}#
平均温度
最高温度
最低温度
温差
- 19 ℃
- 39 ℃
- 19 ℃
- 0 ℃
+ {{ TemParam.tempAvg }} ℃
+ {{ TemParam.tempMax }} ℃
+ {{ TemParam.tempMin }} ℃
+ {{ TemParam.tempDiff }} ℃
当前状态:巡检中
@@ -303,7 +303,10 @@ export default {
top: 58.4,
left: 89.7
},
- ]
+ ],
+ AlarmInfo:{},
+ DeviceInfo:{},
+ TemParam:{}
}
},
components: {
@@ -311,6 +314,7 @@ export default {
Chart
},
mounted() {
+ this.getData()
this.$refs.chart1.setData({
"color": [
"#00ffff",
@@ -567,7 +571,37 @@ export default {
]
})
},
- methods: {}
+ methods: {
+ getData(){
+ // 创建一个新的WebSocket实例
+ const socket = new WebSocket('ws://192.168.2.165:7181/ws');
+
+// 当WebSocket打开时触发
+ socket.onopen = function(event) {
+ console.log('WebSocket 连接已打开');
+ };
+
+// 当服务器发送消息时触发
+ socket.onmessage = function(event) {
+ console.log('收到消息:', event.data);
+ if(event.data.AlarmInfo){
+ this.AlarmInfo = event.data.AlarmInfo
+ }
+ if(event.data.DeviceInfo){
+ this.DeviceInfo = event.data.DeviceInfo
+ }
+ if(event.data.TemParam){
+ this.TemParam = event.data.TemParam
+ }
+ };
+
+// 当WebSocket关闭时触发
+ socket.onclose = function(event) {
+ console.log('WebSocket 连接已关闭');
+ };
+
+ }
+ }
}