From 03f241781205b4aaafa6cee66e7402a41ef97fc1 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期五, 24 五月 2024 15:27:40 +0800
Subject: [PATCH] 增加websocket 推送下片数据给前端

---
 UI-Project/src/views/Identify/identify.vue |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index c8c0ce0..84ef2b6 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -26,16 +26,12 @@
   </div> 
   <!-- 鐐瑰嚮寮瑰嚭 -->
   <el-dialog v-model="blind" top="30vh" width="15%" style="text-align: center;">
-    <!-- <template #footer> -->
-      <!-- <div id="dialog-footer"> --> 
         <el-button type="warning" plain :icon="Delete" @click="handleDamage(currentGlassId)"  style="width: 120px;margin-left: 10px;">
           鐮存崯
         </el-button>
         <el-button  type="danger" plain @click="handleManualTake(currentGlassId)" style="width: 120px;margin-top: 10px;">
           <el-icon class="el-icon--right"><Upload /></el-icon>
           浜哄伐鎷胯蛋</el-button>
-      <!-- </div> -->
-    <!-- </template> -->
   </el-dialog> 
    </div>
   </div>  
@@ -113,6 +109,7 @@
       ElMessage.success(response.message);
       // window.location.reload() 
       blind.value = false;
+      updateRectStatus(currentGlassId.value, 201); 
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
       ElMessage.error(response.msg);
@@ -138,6 +135,7 @@
       ElMessage.success(response.message);
       // window.location.reload() 
       blind.value = false;
+      updateRectStatus(currentGlassId.value, 200); 
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
       ElMessage.error(response.msg);
@@ -165,7 +163,15 @@
     default:  
       return '#911005'; // 榛樿棰滆壊  
   }  
-}  
+} 
+// 鏇存柊鐭╁舰鐘舵��  
+function updateRectStatus(glassId: string, status: number) {  
+  adjustedRects.value.forEach(rect => {  
+    if (rect.glass_id === glassId) {  
+      rect.glass_state = status; // 鏇存柊鐭╁舰鐨勭姸鎬�  
+    }  
+  });  
+}
 </script>  
   
 <style scoped>  

--
Gitblit v1.8.0