From eff7a7ff6ee1851094dfe1f94dd40a98535865d8 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期二, 10 九月 2024 17:00:08 +0800
Subject: [PATCH] 设备通讯

---
 Web/src/views/device/deviceMonitor/index.vue |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Web/src/views/device/deviceMonitor/index.vue b/Web/src/views/device/deviceMonitor/index.vue
index b404ddf..f66cf15 100644
--- a/Web/src/views/device/deviceMonitor/index.vue
+++ b/Web/src/views/device/deviceMonitor/index.vue
@@ -114,13 +114,13 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted } from 'vue';
+import { ref, onMounted  } from 'vue';
 import { listWcsDevice, writeValue } from '/@/api/wcs/wcsDevice';
 import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
 import { listWcsPlc } from '/@/api/wcs/wcsPlc';
 import { ElMessageBox, ElMessage } from 'element-plus';
 import setting from '/@/views/device/deviceMonitor/component/setting.vue'
-import { signalR } from './signalR';
+import { signalR,stopConnection } from './signalR';
 //杩炴帴signalR 鐩戝惉鍙樻洿
 onMounted(async () => {
     signalR.off('PublicPlcDevice');
@@ -133,12 +133,15 @@
             }
         }
         else if (data.type == 1) {
-            stations.value.forEach(list => {
-                var index = list.findIndex(s => s.id == data.id);
+            lineOptions.value.forEach(s => {
+                var index = stations.value[s.id].findIndex(s => s.id == data.id);
                 if (index !== -1) {
-                    list.splice(index, 1, data);
+                    stations.value[s.id].splice(index, 1, data);
                 }
             });
+            if (stationValue.value.id == data.id) {
+                stationValue.value = data;
+            }
         }
     });
 });
@@ -169,10 +172,10 @@
 }
 // 鏌ヨ鎿嶄綔
 const handleQuery = async () => {
-    var listplc = await listWcsPlc({ type: 1 });
+    const listplc = await listWcsPlc({ type: 1 });
     lineOptions.value = listplc.data.result;
     lineValue.value = listplc.data.result[0].id;
-    var res = await listWcsDevice();
+    const res = await listWcsDevice();
     listStackingMachineData.value = res.data.result.filter(s => s.type == 0);
     const listConveyorLineData = res.data.result.filter(s => s.type == 1);
     listplc.data.result.forEach(s => {

--
Gitblit v1.8.0