From 7a23bac143166768c577411d68b256fdf85c8bb5 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 27 五月 2024 14:43:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
UI-Project/src/views/UnLoadGlass/Landingindication.vue | 76 +++++++++++++++++++++++++++----------
1 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/UI-Project/src/views/UnLoadGlass/Landingindication.vue b/UI-Project/src/views/UnLoadGlass/Landingindication.vue
index e9bd3c7..a55acb0 100644
--- a/UI-Project/src/views/UnLoadGlass/Landingindication.vue
+++ b/UI-Project/src/views/UnLoadGlass/Landingindication.vue
@@ -32,9 +32,12 @@
</template>
<script setup>
-import { ref, watchEffect } from 'vue';
+import { ref, watchEffect ,onMounted} from 'vue';
+
import Swal from 'sweetalert2'
import request from "@/utils/request";
+import { initializeWebSocket } from '@/utils/WebSocketService';
+ import { WebSocketHost } from '@/utils/constants';
const racks = ref([
{ x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } },
@@ -83,8 +86,8 @@
const newItem = {
content: itemData.item.content,
fillColor: itemData.item.fillColor,
- width: itemData.item.width === "" ? "" : 10,
- height: itemData.item.height === "" ? "" : 90
+ width: itemData.item.width === 0 ? "" : 10,
+ height: itemData.item.height === 0 ? "" : 90
};
if (index === 2 && itemData.item.width > 0) {
@@ -110,27 +113,58 @@
}
};
-fetchFlowCardId()
-// setTimeout(fetchFlowCardId(),1000);
-//setInterval(fetchFlowCardId, 2000)
+const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass2`;
+// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+const handleMessage = (data) => {
+
+ // 鏇存柊 tableData 鐨勬暟鎹�
+
+ data.glassinfo[0].forEach((itemData, index) => {
+ if (index < racks.value.length) {
+ const rack = racks.value[index];
+ const newItem = {
+ content: itemData.item.content,
+ fillColor: itemData.item.fillColor,
+ width: itemData.item.width === 0 ? "" : 10,
+ height: itemData.item.height === 0 ? "" : 90
+ };
+
+ if (index === 2 && itemData.item.width > 0) {
+ newItem.width = 100;
+ newItem.height = 20;
+ }
+
+ rack.item = newItem;
+
+ // console.log("鏄剧ず鍥�1",racks.value); // 鎵撳嵃鏇存柊鍚庣殑 racks 鍊�
+ }
+});
+};
+
+// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
+
+onMounted(() => {
+ fetchFlowCardId(); // 鑾峰彇鏁版嵁
+ initializeWebSocket(socketUrl, handleMessage);
+});
-// const showCustomAlert = (content) => {
-// var str="鏋跺彿 : 111\n" +
-// "闀� : 111\n" +
-// "瀹� : 111\n" +
-// "鍘� : 111\n"+
-// "鐜荤拑ID : 111\n"+
-// "鑶滅郴 : 111\n";
+const showCustomAlert = (content) => {
+ var str="鏋跺彿 : 111\n" +
+ "闀� : 111\n" +
+ "瀹� : 111\n" +
+ "鍘� : 111\n"+
+ "鐜荤拑ID : 111\n"+
+ "鑶滅郴 : 111\n";
-// Swal.fire({
-// title: '鐜荤拑淇℃伅',
-// html: '<pre>' + str + '</pre>',
-// customClass: {
-// popup: 'format-pre'
-// }
-// });
-// };
+ Swal.fire({
+ title: '鐜荤拑淇℃伅',
+ html: '<pre>' + str + '</pre>',
+ customClass: {
+ popup: 'format-pre'
+ }
+ });
+};
const showRectInfo = (rectInfo) => {
const content = rectInfo.item.content;
--
Gitblit v1.8.0