From 2c060bac4185d5aba89ce2562a98a3a7f6a46c4f Mon Sep 17 00:00:00 2001 From: wu <731351411@qq.com> Date: 星期一, 22 七月 2024 14:14:49 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- UI-Project/src/views/PurchaseReturn/purchaseReturn.vue | 121 +++++++++++++++++++++++++++++----------- 1 files changed, 87 insertions(+), 34 deletions(-) diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue index ee84543..d22626b 100644 --- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue +++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue @@ -22,54 +22,107 @@ const handleMessage = (data) => { // 杩涚倝涓� if(data.intoGlass!=null){ - adjustedRects.value = data.intoGlass[0].map(rect => ({ + adjustedRects.value = data.intoGlass[0].map(rect => { + let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; + if (rect.angle === 90) { + adjustedWidth = rect.height * 0.3; + adjustedHeight = rect.width * 0.3; + adjustedWidtha = rect.height; + adjustedHeighta = rect.width; + } else { + adjustedWidth = rect.width * 0.3; + adjustedHeight = rect.height * 0.3; + adjustedWidtha = rect.width; + adjustedHeighta = rect.height; + } + return { ...rect, xcoordinate: rect.xCoordinate * 0.3, ycoordinate: rect.yCoordinate * 0.3, - width: rect.width * 0.2, - height: rect.height * 0.2, - widtha: rect.width, - heighta: rect.height, - })); - } + width: adjustedWidth, + height: adjustedHeight, + widtha: adjustedWidtha, + heighta: adjustedHeighta, + }; + }); + } if(data.intoGlass2!=null){ - adjustedRects2.value = data.intoGlass2[0].map(rect => ({ + adjustedRects2.value = data.intoGlass2[0].map(rect => { + let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; + if (rect.angle === 90) { + adjustedWidth = rect.height * 0.3; + adjustedHeight = rect.width * 0.3; + adjustedWidtha = rect.height; + adjustedHeighta = rect.width; + } else { + adjustedWidth = rect.width * 0.3; + adjustedHeight = rect.height * 0.3; + adjustedWidtha = rect.width; + adjustedHeighta = rect.height; + } + return { ...rect, xcoordinate: rect.xCoordinate * 0.3, ycoordinate: rect.yCoordinate * 0.3, - width: rect.width * 0.2, - height: rect.height * 0.2, - widtha: rect.width, - heighta: rect.height, - })); - } + width: adjustedWidth, + height: adjustedHeight, + widtha: adjustedWidtha, + heighta: adjustedHeighta, + }; + }); + } // 杩涚倝鍓� if(data.waitingGlass!=null){ - adjustedRectsa.value = data.waitingGlass[0].map(rect => ({ - ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬� - x: rect.xCoordinate * 0.4, - y: rect.yCoordinate * 0.4, - width: rect.width * 0.4, - height: rect.height * 0.4, - widtha: rect.width, - heighta: rect.height, - state: rect.state, - })); - } + adjustedRectsa.value = data.waitingGlass[0].map(rect => { + let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; + if (rect.angle === 90) { + adjustedWidth = rect.height * 0.4; + adjustedHeight = rect.width * 0.4; + adjustedWidtha = rect.height; + adjustedHeighta = rect.width; + } else { + adjustedWidth = rect.width * 0.4; + adjustedHeight = rect.height * 0.4; + adjustedWidtha = rect.width; + adjustedHeighta = rect.height; + } + return { + ...rect, + x: rect.xCoordinate * 0.4, + y: rect.yCoordinate * 0.4, + width: adjustedWidth, + height: adjustedHeight, + widtha: adjustedWidtha, + heighta: adjustedHeighta, + }; +}); + } // 宸插嚭鐐� if(data.outGlass!=null){ - adjustedRectsb.value = data.outGlass[0].map(rect => ({ + adjustedRectsb.value = data.outGlass[0].map(rect => { + let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; + if (rect.angle === 90) { + adjustedWidth = rect.height * 0.4; + adjustedHeight = rect.width * 0.4; + adjustedWidtha = rect.height; + adjustedHeighta = rect.width; + } else { + adjustedWidth = rect.width * 0.4; + adjustedHeight = rect.height * 0.4; + adjustedWidtha = rect.width; + adjustedHeighta = rect.height; + } + return { ...rect, // 澶嶅埗鍘熷瀵硅薄鐨勫叾浠栧睘鎬� x: rect.xCoordinate * 0.4, y: rect.yCoordinate * 0.4, - width: rect.width * 0.4, - height: rect.height * 0.4, - widtha: rect.width, - heighta: rect.height, - state: rect.state - })); - console.log(data.outGlass[0]); - } + width: adjustedWidth, + height: adjustedHeight, + widtha: adjustedWidtha, + heighta: adjustedHeighta, + }; +}); + } }; onMounted(() => { initializeWebSocket(socketUrl, handleMessage); -- Gitblit v1.8.0