From df751d889379e025237eb51e7764fa69e886f4a9 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期二, 20 八月 2024 10:18:10 +0800
Subject: [PATCH] 掰片/识别、钢化模块点击弹出时玻璃变色提示

---
 UI-Project/src/views/Identify/identify.vue              |   83 +++++++--
 UI-Project/src/views/PurchaseReturn/purchaseStorage.vue |  101 ++---------
 UI-Project/src/views/PurchaseReturn/purchaseReturn.vue  |  290 ++++++++++++++++++++++++-----------
 3 files changed, 281 insertions(+), 193 deletions(-)

diff --git a/UI-Project/src/views/Identify/identify.vue b/UI-Project/src/views/Identify/identify.vue
index d71f75c..cfac9d0 100644
--- a/UI-Project/src/views/Identify/identify.vue
+++ b/UI-Project/src/views/Identify/identify.vue
@@ -215,33 +215,74 @@
     }  
   });  
 }
+// const connectWebSocket = () => {  
+//   if (!webSocket) {  
+// const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
+//     webSocket = new WebSocket(socketUrl);  
+//     webSocket.onmessage = (event) => {  
+//       const data = JSON.parse(event.data);   
+//       const scaleFactor =  1621.78/6000; 
+//         adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
+//         ...rect,
+//         x_axis: (6000 -(rect.x_axis + rect.width)) * scaleFactor,
+//         y_axis: rect.y_axis * 0.17,
+//         width: rect.width * scaleFactor ,
+//         widtha: rect.width ,
+//         heighta: rect.height ,
+//         height: rect.height * 0.165 ,
+//         glass_state: rect.glass_state,
+//         isActive: false
+//       }));
+//     };  
+//     webSocket.onerror = (error) => {  
+//       console.error('WebSocket Error:', error);  
+//     };
+//     webSocket.onclose = () => {  
+//       console.log('WebSocket Connection Closed');  
+//       // 鍙互閫夋嫨閲嶆柊杩炴帴  
+//     };  
+//   }  
+// };  
 const connectWebSocket = () => {  
   if (!webSocket) {  
 const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
     webSocket = new WebSocket(socketUrl);  
     webSocket.onmessage = (event) => {  
-      const data = JSON.parse(event.data);   
-      const scaleFactor =  1621.78/6000; 
-        adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
-        ...rect,
-        x_axis: (6000 -(rect.x_axis + rect.width)) * scaleFactor,
-        y_axis: rect.y_axis * 0.17,
-        width: rect.width * scaleFactor ,
-        widtha: rect.width ,
-        heighta: rect.height ,
-        height: rect.height * 0.165 ,
-        glass_state: rect.glass_state,
-        isActive: false
-      }));
+      const data = JSON.parse(event.data);  
+      const scaleFactor = 1621.78 / 6000;  
+      const newRects = data.currentCutTerritory[0].map(rect => {  
+        const existingRect = adjustedRects.value.find(r => r.glass_id === rect.glass_id);  
+        if (existingRect) {  
+          return {  
+            ...existingRect,  
+            x_axis: (6000 - (rect.x_axis + rect.width)) * scaleFactor,  
+            y_axis: rect.y_axis * 0.17,  
+            width: rect.width * scaleFactor,  
+            height: rect.height * 0.165,  
+            widtha: rect.width,  
+            heighta: rect.height,  
+            glass_state: rect.glass_state,  
+            // 淇濇寔 isActive 鐘舵�佷笉鍙�  
+          };  
+        } else {  
+          // 濡傛灉涓嶅瓨鍦紝鍒欐坊鍔犳柊鐭╁舰锛岄粯璁� isActive 涓� false  
+          return {  
+            ...rect,  
+            x_axis: (6000 - (rect.x_axis + rect.width)) * scaleFactor,  
+            y_axis: rect.y_axis * 0.17,  
+            width: rect.width * scaleFactor,  
+            height: rect.height * 0.165,  
+            widtha: rect.width,  
+            heighta: rect.height,  
+            glass_state: rect.glass_state,  
+            isActive: false,  
+            glass_id: rect.glass_id,
+          };  
+        }
+      });
+      adjustedRects.value = newRects;  
     };  
-    webSocket.onerror = (error) => {  
-      console.error('WebSocket Error:', error);  
-    };
-    webSocket.onclose = () => {  
-      console.log('WebSocket Connection Closed');  
-      // 鍙互閫夋嫨閲嶆柊杩炴帴  
-    };  
-  }  
+  }
 };  
   
 onMounted(() => {  
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index 3d790cf..53f6d84 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -13,7 +13,10 @@
 const dialogFormVisible = ref(false)
 const dialogFormVisiblea = ref(true)
 const dialogFormVisibleb = ref(false)
-const blind = ref(false)
+const blind1 = ref(false)
+const blind2 = ref(false)
+const blinda = ref(false)
+const blindb = ref(false)
 const width = ref();
 const height = ref();
 const adjustedRects1 = ref([]);
@@ -23,12 +26,10 @@
 const currentGlassId = ref(null);
 const currenttemperingFeedSequence = ref(null);
 const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
-const handleMessage = (data) => {
-// 杩涚倝涓�
-  if(data.intoGlass2!=null){
-    adjustedRects2.value =  data.intoGlass2[0].map(rect => {  
-        isActive: false
-        const scaleFactor =  794.67/5087; 
+const handleMessage = (data) => {  
+  if (data.intoGlass2 && data.intoGlass2.length > 0) {  
+    const newRects = data.intoGlass2[0].map(rect => {  
+      const scaleFactor =  794.67/5087; 
         let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;;
         let newX = rect.yCoordinate; 
       if (rect.width < rect.height) {
@@ -59,15 +60,20 @@
         height: adjustedHeight,  
         widtha: rect.width, 
         heighta: rect.height,
-      };  
-      });
-      }else{
-        adjustedRects1.value = ''
       }
-  if(data.intoGlass!=null){
-      adjustedRects1.value =  data.intoGlass[0].map(rect => {  
-        isActive: false
-        const scaleFactor =  794.67/5087; 
+    });  
+    // 鍚堝苟鏂版棫鐭╁舰锛屼繚鐣� isActive 鐘舵��  
+    adjustedRects2.value = adjustedRects2.value.map(oldRect => {  
+      const newRect = newRects.find(r => r.glassId === oldRect.glassId);  
+      if (newRect) {  
+        return { ...oldRect, ...newRect, isActive: oldRect.isActive };  
+      }  
+      return oldRect; // 濡傛灉鏃х煩褰㈠湪鏂版暟鎹腑涓嶅瓨鍦紝鍒欎繚鐣欏師鏍�  
+    }).concat(newRects.filter(r => !adjustedRects2.value.some(o => o.glassId === r.glassId)));  
+  }
+  if (data.intoGlass && data.intoGlass.length > 0) {  
+    const newRects = data.intoGlass[0].map(rect => {  
+      const scaleFactor =  794.67/5087; 
       let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;;
       let newX = rect.yCoordinate; 
       if (rect.width < rect.height) {
@@ -98,16 +104,20 @@
         height: adjustedHeight,  
         widtha: rect.width, 
         heighta: rect.height,
-      };  
-      });
-      }else{
-        adjustedRects2.value = ''
       }
-  // 杩涚倝鍓�
-  if(data.waitingGlass!=null){
-    adjustedRectsa.value = data.waitingGlass[0].map(rect => {  
-        isActive: false
-        const scaleFactor =  1621.78/5190; 
+    });  
+    // 鍚堝苟鏂版棫鐭╁舰锛屼繚鐣� isActive 鐘舵��  
+    adjustedRects1.value = adjustedRects1.value.map(oldRect => {  
+      const newRect = newRects.find(r => r.glassId === oldRect.glassId);  
+      if (newRect) {  
+        return { ...oldRect, ...newRect, isActive: oldRect.isActive };  
+      }  
+      return oldRect; // 濡傛灉鏃х煩褰㈠湪鏂版暟鎹腑涓嶅瓨鍦紝鍒欎繚鐣欏師鏍�  
+    }).concat(newRects.filter(r => !adjustedRects1.value.some(o => o.glassId === r.glassId)));  
+  }
+  if (data.waitingGlass && data.waitingGlass.length > 0) {  
+    const newRects = data.waitingGlass[0].map(rect => {  
+      const scaleFactor =  1621.78/5190; 
   let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;; 
   let newX = rect.yCoordinate; 
       if (rect.width < rect.height) {
@@ -138,16 +148,20 @@
     height: adjustedHeight,  
     widtha: rect.width, 
     heighta: rect.height,
-  };  
-});
-  }else{
-        adjustedRectsa.value = ''
-      }
-    // 宸插嚭鐐�
-  if(data.outGlass!=null){
-    adjustedRectsb.value = data.outGlass[0].map(rect => {  
-        isActive: false
-        const scaleFactor =  1621.78/5190; 
+  }
+    });  
+    // 鍚堝苟鏂版棫鐭╁舰锛屼繚鐣� isActive 鐘舵��  
+    adjustedRectsa.value = adjustedRectsa.value.map(oldRect => {  
+      const newRect = newRects.find(r => r.glassId === oldRect.glassId);  
+      if (newRect) {  
+        return { ...oldRect, ...newRect, isActive: oldRect.isActive };  
+      }  
+      return oldRect; // 濡傛灉鏃х煩褰㈠湪鏂版暟鎹腑涓嶅瓨鍦紝鍒欎繚鐣欏師鏍�  
+    }).concat(newRects.filter(r => !adjustedRectsa.value.some(o => o.glassId === r.glassId)));  
+  }
+  if (data.outGlass && data.outGlass.length > 0) {  
+    const newRects = data.outGlass[0].map(rect => {  
+      const scaleFactor =  1621.78/5190; 
       const scaleFactory =  550/2800; 
       let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta,newY;
   let newX = rect.yCoordinate; 
@@ -181,12 +195,18 @@
         height: adjustedHeight,  
         widtha: rect.width, 
         heighta: rect.height,
-  };  
-});
-  }else{
-        adjustedRectsb.value = ''
-      }
-};
+  }
+    });  
+    // 鍚堝苟鏂版棫鐭╁舰锛屼繚鐣� isActive 鐘舵��  
+    adjustedRectsb.value = adjustedRectsb.value.map(oldRect => {  
+      const newRect = newRects.find(r => r.glassId === oldRect.glassId);  
+      if (newRect) {  
+        return { ...oldRect, ...newRect, isActive: oldRect.isActive };  
+      }  
+      return oldRect; // 濡傛灉鏃х煩褰㈠湪鏂版暟鎹腑涓嶅瓨鍦紝鍒欎繚鐣欏師鏍�  
+    }).concat(newRects.filter(r => !adjustedRectsb.value.some(o => o.glassId === r.glassId)));  
+  }
+}; 
 onMounted(() => {
   initializeWebSocket(socketUrl, handleMessage);
 });
@@ -219,70 +239,68 @@
       return '#911005';  
   }  
 }
-// if (adjustedRectsb[0].engineerId != null) {
-//     engineerIdDisplayb = adjustedRectsb[0].engineerId
-//   }
-//   if (adjustedRectsa[0].engineerId != null) {
-//     engineerIdDisplaya = adjustedRectsa[0].engineerId
-//   }
-//   if (adjustedRects2[0].engineerId != null) {
-//     engineerIdDisplay2 = adjustedRects2[0].engineerId
-//   }
-//   if (adjustedRects[0].engineerId != null) {
-//     engineerIdDisplay = adjustedRects[0].engineerId
-//   }
-function showDialog1(rect) {  
+function showDialog1(rect) {
+  const index = adjustedRects1.value.findIndex(r => r.glassId === rect.glassId);  
+  if (index !== -1) {  
+    adjustedRects1.value[index].isActive = true;  
+  }  
   currentGlassId.value = rect.glassId;  
   currenttemperingFeedSequence.value = rect.temperingFeedSequence;  
-  blind.value = true;  
-  adjustedRects1.value = adjustedRects1.value.map(rect =>  
-    rect.glass_id === glassId ? { ...rect, isActive: true } : rect  
-  ); 
+  blind1.value = true;  
 } 
-function showDialog2(rect) {  
+function showDialog2(rect) {
+  const index = adjustedRects2.value.findIndex(r => r.glassId === rect.glassId);  
+  if (index !== -1) {  
+    adjustedRects2.value[index].isActive = true;  
+  }  
   currentGlassId.value = rect.glassId;  
   currenttemperingFeedSequence.value = rect.temperingFeedSequence;  
-  blind.value = true;  
-  adjustedRects2.value = adjustedRects2.value.map(rect =>  
-    rect.glass_id === glassId ? { ...rect, isActive: true } : rect  
-  ); 
+  blind2.value = true;  
 } 
-function showDialoga(rect) {  
+function showDialoga(rect) {
+  const index = adjustedRectsa.value.findIndex(r => r.glassId === rect.glassId);  
+  if (index !== -1) {  
+    adjustedRectsa.value[index].isActive = true;  
+  }  
   currentGlassId.value = rect.glassId;  
   currenttemperingFeedSequence.value = rect.temperingFeedSequence;  
-  blind.value = true;  
-  adjustedRectsa.value = adjustedRectsa.value.map(rect =>  
-    rect.glass_id === glassId ? { ...rect, isActive: true } : rect  
-  ); 
+  blinda.value = true;  
 } 
-function showDialogb(rect) {  
+function showDialogb(rect) {
+  const index = adjustedRectsb.value.findIndex(r => r.glassId === rect.glassId);  
+  if (index !== -1) {  
+    adjustedRectsb.value[index].isActive = true;  
+  }  
   currentGlassId.value = rect.glassId;  
   currenttemperingFeedSequence.value = rect.temperingFeedSequence;  
-  blind.value = true;  
-  adjustedRectsb.value = adjustedRectsb.value.map(rect =>  
-    rect.glass_id === glassId ? { ...rect, isActive: true } : rect  
-  ); 
+  blindb.value = true;  
 } 
-const handleDialogClose = () => {  
-  adjustedRects1.value = adjustedRects1.value.map(rect => ({  
-    ...rect,  
-    isActive: false  
-  }));  
-  // adjustedRects2.value = adjustedRects2.value.map(rect => ({  
-  //   ...rect,  
-  //   isActive: false  
-  // }));  
-  // adjustedRectsa.value = adjustedRectsa.value.map(rect => ({  
-  //   ...rect,  
-  //   isActive: false  
-  // }));  
-  adjustedRectsb.value = adjustedRectsb.value.map(rect => ({  
-    ...rect,  
-    isActive: false  
-  }));  
-} 
+  const handleDialogClose1 = () => {  
+  adjustedRects1.value.forEach(rect => {  
+    rect.isActive = false;  
+  });  
+  blind1.value = false; 
+};  
+  const handleDialogClose2 = () => {  
+  adjustedRects2.value.forEach(rect => {  
+    rect.isActive = false;  
+  });  
+  blind2.value = false; 
+};  
+  const handleDialogClosea = () => {  
+  adjustedRectsa.value.forEach(rect => {  
+    rect.isActive = false;  
+  });  
+  blinda.value = false; 
+};  
+  const handleDialogCloseb = () => {  
+  adjustedRectsb.value.forEach(rect => {  
+    rect.isActive = false;  
+  });  
+  blindb.value = false; 
+};  
 // 鐮存崯
-const handleDamage = async () => {
+const handleDamage1 = async () => {
   try  {
   const response = await request.post('/temperingGlass/temperingGlassInfo/updateTemperingState', {
     glassId: currentGlassId.value,
@@ -293,7 +311,76 @@
     })
     if (response.code == 200) {
       ElMessage.success(response.message);
-      blind.value = false;
+      blind1.value = false;
+      updateRectColors();
+    } else {
+      // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+      ElMessage.error(response.message);
+    }
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+const handleDamage2 = async () => {
+  try  {
+  const response = await request.post('/temperingGlass/temperingGlassInfo/updateTemperingState', {
+    glassId: currentGlassId.value,
+    // temperingFeedSequence: currenttemperingFeedSequence.value,
+    line: 4001,
+    status: 2,
+    workingProcedure: '閽㈠寲',
+    })
+    if (response.code == 200) {
+      ElMessage.success(response.message);
+      blind2.value = false;
+      updateRectColors();
+    } else {
+      // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+      ElMessage.error(response.message);
+    }
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+const handleDamagea = async () => {
+  try  {
+  const response = await request.post('/temperingGlass/temperingGlassInfo/updateTemperingState', {
+    glassId: currentGlassId.value,
+    // temperingFeedSequence: currenttemperingFeedSequence.value,
+    line: 4001,
+    status: 2,
+    workingProcedure: '閽㈠寲',
+    })
+    if (response.code == 200) {
+      ElMessage.success(response.message);
+      blinda.value = false;
+      updateRectColors();
+    } else {
+      // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+      ElMessage.error(response.message);
+    }
+}
+catch (error) {
+    // 澶勭悊閿欒
+    console.error(error);
+  }
+}
+const handleDamageb = async () => {
+  try  {
+  const response = await request.post('/temperingGlass/temperingGlassInfo/updateTemperingState', {
+    glassId: currentGlassId.value,
+    // temperingFeedSequence: currenttemperingFeedSequence.value,
+    line: 4001,
+    status: 2,
+    workingProcedure: '閽㈠寲',
+    })
+    if (response.code == 200) {
+      ElMessage.success(response.message);
+      blindb.value = false;
       updateRectColors();
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
@@ -431,8 +518,23 @@
    </el-card>
 </div>
  
-<el-dialog v-model="blind" top="30vh" width="15%" style="text-align: center;" @close="handleDialogClose">
-        <el-button type="warning" plain :icon="Delete" @click="handleDamage"  style="width: 140px;margin-left: 10px;">
+<el-dialog v-model="blind1" top="30vh" width="15%" style="text-align: center;" @close="handleDialogClose1">
+        <el-button type="warning" plain :icon="Delete" @click="handleDamage1"  style="width: 140px;margin-left: 10px;">
+          {{ $t('order.dilapidation') }}
+        </el-button>
+  </el-dialog>  
+<el-dialog v-model="blind2" top="30vh" width="15%" style="text-align: center;" @close="handleDialogClose2">
+        <el-button type="warning" plain :icon="Delete" @click="handleDamage2"  style="width: 140px;margin-left: 10px;">
+          {{ $t('order.dilapidation') }}
+        </el-button>
+  </el-dialog>  
+<el-dialog v-model="blinda" top="30vh" width="15%" style="text-align: center;" @close="handleDialogClosea">
+        <el-button type="warning" plain :icon="Delete" @click="handleDamagea"  style="width: 140px;margin-left: 10px;">
+          {{ $t('order.dilapidation') }}
+        </el-button>
+  </el-dialog>  
+<el-dialog v-model="blindb" top="30vh" width="15%" style="text-align: center;" @close="handleDialogCloseb">
+        <el-button type="warning" plain :icon="Delete" @click="handleDamageb"  style="width: 140px;margin-left: 10px;">
           {{ $t('order.dilapidation') }}
         </el-button>
   </el-dialog> 
diff --git a/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue b/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
index 62f5a07..075ed55 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseStorage.vue
@@ -31,11 +31,9 @@
 }
 let socket = null;
 const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`; 
-// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
-const handleMessage = (data) => {
-  // 鏇存柊 tableData 鐨勬暟鎹�
-  if(data.overGlass!=null){
-    adjustedRects.value =  data.overGlass[0].map(rect => {  
+const handleMessage = (data) => {  
+  if (data.overGlass && data.overGlass.length > 0) {  
+    const newRects = data.overGlass[0].map(rect => {  
       const scaleFactor =  1621.78/5190; 
       let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;
       let newX = rect.yCoordinate; 
@@ -50,15 +48,9 @@
     if (rect.angle === 0) {  
     adjustedWidth = widtha * scaleFactor;  
     adjustedHeight = heighta * 0.16;  
-    // adjustedWidtha = widtha;  
-    // adjustedHeighta = heighta;  
-    // newX = 5190 - (rect.yCoordinate + rect.width); 
   } else {  
     adjustedWidth = heighta * scaleFactor;  
     adjustedHeight = widtha * 0.16;  
-    // adjustedWidtha = heighta;  
-    // adjustedHeighta = widtha;  
-    // newX = 5190 - (rect.yCoordinate + rect.height);  
   }  
   return {  
     ...rect, 
@@ -68,72 +60,20 @@
     height: adjustedHeight,  
     widtha: rect.width, 
     heighta: rect.height,
-    // isActive: false,
-  };  
-});
   }
-};
-// const handleMessage = (data) => {  
-//   // 鍋囪 data.overGlass[0] 鏄煩褰㈡暟缁�  
-//   const newRects = data.overGlass[0].map(newRect => ({  
-//     ...newRect, 
-//     const scaleFactor = 1621.78 / 5190;  
-//     let widtha, heighta, adjustedWidth, adjustedHeight;  
+    });  
   
-//     // 浜ゆ崲瀹藉害鍜岄珮搴︼紙濡傛灉鐭╁舰鏄�滄í鍚戔�濈殑锛�  
-//     if (rect.width < rect.height) {  
-//       widtha = rect.height;  
-//       heighta = rect.width;  
-//     } else {  
-//       widtha = rect.width;  
-//       heighta = rect.height;  
-//     }  
+    // 鍚堝苟鏂版棫鐭╁舰锛屼繚鐣� isActive 鐘舵��  
+    adjustedRects.value = adjustedRects.value.map(oldRect => {  
+      const newRect = newRects.find(r => r.glassId === oldRect.glassId);  
+      if (newRect) {  
+        return { ...oldRect, ...newRect, isActive: oldRect.isActive };  
+      }  
+      return oldRect; // 濡傛灉鏃х煩褰㈠湪鏂版暟鎹腑涓嶅瓨鍦紝鍒欎繚鐣欏師鏍�  
+    }).concat(newRects.filter(r => !adjustedRects.value.some(o => o.glassId === r.glassId)));  
+  }  
+};  
   
-//     // 鏍规嵁瑙掑害璋冩暣瀹藉害鍜岄珮搴�  
-//     if (rect.angle === 0) {  
-//       adjustedWidth = widtha * scaleFactor;  
-//       adjustedHeight = heighta * 0.16;  
-//     } else {  
-//       adjustedWidth = heighta * scaleFactor;  
-//       adjustedHeight = widtha * 0.16;  
-//     }  
-  
-//     // 娉ㄦ剰锛氳繖閲屽彲鑳介渶瑕侀噸鏂拌�冭檻 newX 鐨勮绠楁柟寮�  
-//     // 鏆傛椂淇濈暀涓哄師濮� yCoordinate 鐨勫鐞嗭紝浣嗛�氬父 x 鍧愭爣涓嶅簲鏉ヨ嚜 y 鍧愭爣  
-//     let newX = rect.yCoordinate; // 鍙兘鏄釜閿欒锛岄櫎闈炴湁鐗瑰畾鐢ㄩ��  
-  
-//     // 杩斿洖鏂扮殑鐭╁舰瀵硅薄  
-//     return {  
-//       ...rect, // 澶嶅埗鍘熷鐭╁舰鐨勬墍鏈夊睘鎬�  
-//       xcoordinate: newX * scaleFactor, // 娉ㄦ剰锛氳繖閲岀殑 newX 鍙兘闇�瑕佽皟鏁�  
-//       ycoordinate: rect.xCoordinate * 0.16,  
-//       width: adjustedWidth,  
-//       height: adjustedHeight,  
-//       widtha,  
-//       heighta,  
-//       isActive: false, // 榛樿涓洪潪婵�娲荤姸鎬�  
-//       // 鍙互娣诲姞鍏朵粬闇�瑕佺殑灞炴��  
-//     }
-//   }));  
-  
-  // 浣跨敤鏂版暟鎹洿鏂� adjustedRects  
-  // 娉ㄦ剰锛氳繖閲屾垜浠亣璁� adjustedRects.value 涓殑鐭╁舰涔熸湁 id 灞炴��  
-//   adjustedRects.value = adjustedRects.value.map(oldRect => {  
-//     const updatedRect = newRects.find(newRect => newRect.id === oldRect.id);  
-//     if (updatedRect) {  
-//       // 濡傛灉鎵惧埌浜嗗搴旂殑鐭╁舰锛屽垯鍚堝苟灞炴�у拰淇濈暀鍘熷婵�娲荤姸鎬侊紙濡傛灉闇�瑕佺殑璇濓級  
-//       // 浣嗗湪杩欎釜渚嬪瓙涓紝鎴戜滑鎬绘槸灏� isActive 璁剧疆涓� false  
-//       return {  
-//         ...oldRect,  
-//         ...updatedRect, // 鍚堝苟鏂扮煩褰㈢殑灞炴�э紝浣嗕細瑕嗙洊 isActive  
-//         isActive: false, // 鎬绘槸璁剧疆涓� false锛岄櫎闈炴偍鏈夋洿澶嶆潅鐨勯�昏緫  
-//       };  
-//     }  
-//     // 濡傛灉娌℃湁鎵惧埌瀵瑰簲鐨勭煩褰紝鍒欎繚鐣欏師鏍�  
-//     return oldRect;  
-//   }).concat(newRects.filter(newRect => !adjustedRects.value.some(oldRect => oldRect.id === newRect.id)));  
-//   // concat 鐢ㄤ簬娣诲姞閭d簺鍦� adjustedRects.value 涓笉瀛樺湪鐨勬柊鐭╁舰  
-// };
 function updateRectColors() {  
   adjustedRects.value.forEach(rect => {  
     if (rect.glassId === glassId) {  
@@ -151,17 +91,22 @@
       return '#911005';  
   }  
 }
-function showDialog(rect) {  
-  rect.isActive = true; 
+function showDialog(rect) {
+  const index = adjustedRects.value.findIndex(r => r.glassId === rect.glassId);  
+  if (index !== -1) {  
+    adjustedRects.value[index].isActive = true;  
+  }  
   currentGlassId.value = rect.glassId;  
   currenttemperingFeedSequence.value = rect.temperingFeedSequence;  
   blind.value = true;  
 }  
+  
 const handleDialogClose = () => {  
   adjustedRects.value.forEach(rect => {  
-    rect.isActive = false; // 鍏抽棴瀵硅瘽妗嗘椂閲嶇疆鎵�鏈夌煩褰㈢殑 isActive 鐘舵��  
+    rect.isActive = false;  
   });  
-}; 
+  blind.value = false; 
+};  
 // 鐮存崯
 const handleDamage = async () => {
   try  {

--
Gitblit v1.8.0