From 33308e16bbb153d9aac76fd703ec0f38ea7e344a Mon Sep 17 00:00:00 2001 From: wangfei <3597712270@qq.com> Date: 星期三, 09 十月 2024 15:47:59 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- UI-Project/src/views/GlassStorage/MaterialRackManagement.vue | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue index 6ca0948..7a0d18c 100644 --- a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue +++ b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue @@ -4,7 +4,7 @@ <div slot="header" class="clearfix" - style="display: flex; align-items: center" + style="display: flex; align-items: center;margin-top: -20px;" > <!-- 宸︿晶鎸夐挳缁� --> <div> @@ -16,9 +16,8 @@ > <el-button type="success" size="mini">鍚婅浣嶅叆搴�</el-button> </div> - <!-- 鍙充晶閫夋嫨妗� --> - <el-form-item style="margin-top: 15px; width: 150px"> + <el-form-item style="margin-top: 15px; width: 150px;margin-left: 10px;"> <el-select v-model="formData2.dzw" placeholder="璇烽�夋嫨鍚婅浣�"> <el-option label="鍚婅浣�1" value="鍚婅浣�1"></el-option> <el-option label="鍚婅浣�2" value="鍚婅浣�2"></el-option> @@ -330,7 +329,7 @@ <script setup> -import { ref, onMounted, onBeforeUnmount } from "vue"; // 瀵煎叆 Vue 3 鐨勬ā鍧� +import { ref, onMounted, onBeforeUnmount,onUnmounted } from "vue"; // 瀵煎叆 Vue 3 鐨勬ā鍧� //import * as echarts from 'echarts'; import { ElMessage, ElMessageBox } from "element-plus"; // import {tableData} from '@/stores/tableData.js'; @@ -393,6 +392,7 @@ row.enableState = 1 - row.enableState; // Toggle between 0 and 1 // 姝ゅ鍙互娣诲姞淇濆瓨鐘舵�佺殑閫昏緫锛屾瘮濡傝皟鐢� API 鏇存柊鏁版嵁 }; +let socket = null; const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/storageTask`; // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺 const handleMessage = (data) => { @@ -429,16 +429,15 @@ // 鏇挎崲鍘熸潵鐨� createTime 瀛楁涓烘牸寮忓寲鍚庣殑鏃ユ湡鏃堕棿瀛楃涓� item.startTime = formattedDateTime; }); - - - - - }; - onMounted(() => { - initializeWebSocket(socketUrl, handleMessage); + socket = initializeWebSocket(socketUrl, handleMessage); }); + onUnmounted(() => { + if (socket) { + closeWebSocket(socket); + } + }); onBeforeUnmount(() => { console.log("鍏抽棴浜�"); closeWebSocket(); -- Gitblit v1.8.0