From 2f367eea0033c59e3739c6821e86b3a34af49ebb Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 03 六月 2024 08:27:42 +0800
Subject: [PATCH] fixbug:玻璃种类过多导致机系统异常
---
UI-Project/src/views/Identify/identify.vue | 41 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index 84ef2b6..350535f 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -21,7 +21,7 @@
<!-- <div class="centered-text" >NG24030401B01</div> -->
<div class="centered-text">
<div>{{ rect.process_id }}</div>
- <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
+ <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div>
</div>
</div>
<!-- 鐐瑰嚮寮瑰嚭 -->
@@ -42,8 +42,9 @@
<script setup lang="ts">
import { Delete, Upload } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { ref, onMounted } from 'vue';
+import { ref, onMounted, onBeforeUnmount } from 'vue';
import request from "@/utils/request"
+import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
const blind = ref(false)
const olWidth = ref();
const olHeight = ref();
@@ -78,11 +79,13 @@
x_axis: (rect.x_axis*100) * 0.005, // 灏唜鍊奸櫎浠�3
y_axis: (rect.y_axis*100) * 0.005,
width: (rect.width*100) * 0.004 ,
+ widtha: rect.width ,
+ heighta: rect.height ,
height:( rect.height*100) * 0.004 ,
glass_state: rect.glass_state
}));
+ console.log(adjustedRects.value);
- console.log(rect);
// console.log( (rect.width*100) / 300 );
} else {
@@ -172,6 +175,38 @@
}
});
}
+const socketUrl = `ws://10.153.19.150:88/api/cacheGlass/api/talk/cacheGlass`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+ // 鏇存柊 tableData 鐨勬暟鎹�
+
+ // adjustedRects.value = data.currentCutTerritory[0]
+ adjustedRects.value = data.currentCutTerritory[0].map(rect => ({
+ ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬�
+ x_axis: (rect.x_axis*100) * 0.005, // 灏唜鍊奸櫎浠�3
+ y_axis: (rect.y_axis*100) * 0.005,
+ width: (rect.width*100) * 0.004 ,
+ widtha: rect.width ,
+ heighta: rect.height ,
+ height:( rect.height*100) * 0.004 ,
+ glass_state: rect.glass_state
+ }));
+ // console.log("鏇存柊鍚庢暟鎹�", tableData);
+
+};
+
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ // fetchFlowCardId();
+ // fetchTableData(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
+
+onBeforeUnmount(() => {
+ console.log("鍏抽棴浜�")
+ closeWebSocket();
+});
</script>
<style scoped>
--
Gitblit v1.8.0