From ee2c98d774c546f4bccf1ff3b80ba5415f179e5b Mon Sep 17 00:00:00 2001
From: 于杰 <1210123631@qq.com>
Date: 星期五, 01 八月 2025 13:33:19 +0800
Subject: [PATCH] 解决前端调整玻璃调整方向错误的问题

---
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue |   10 +++++-----
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue     |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
index 8762748..d8e2286 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -563,7 +563,7 @@
 
   const newRect = { ...glassDetail };
   newRect.x += deltaX / scale;
-  newRect.y -= deltaY / scale;
+  newRect.y += deltaY / scale;
 
   const otherRects = layout.glassDetails.filter(r => !r.isRemain && r !== glassDetail);
   let isValidMove = true;
@@ -829,10 +829,10 @@
 
   switch (direction) {
     case 'up':
-      glassDetail.y -= maxStep;
+      glassDetail.y += maxStep;
       break;
     case 'down':
-      glassDetail.y += maxStep;
+      glassDetail.y -= maxStep;
       break;
     case 'left':
       glassDetail.x -= maxStep;
@@ -962,7 +962,7 @@
 
 //鍚戜笂绉诲姩璁$畻鍧愭爣
 const getAvailableSpaceUp = (glassDetail, layout, obstacles) => {
-  let maxSpace = glassDetail.y;
+  let maxSpace = layout.height - glassDetail.y - glassDetail.height;
   obstacles.forEach(obstacle => {
     if (obstacle.y > glassDetail.y + glassDetail.height &&
         obstacle.x <= glassDetail.x + glassDetail.width &&
@@ -975,7 +975,7 @@
 
 //鍚戜笅绉诲姩璁$畻鍧愭爣
 const getAvailableSpaceDown = (glassDetail, layout, obstacles) => {
-  let maxSpace = layout.height - (glassDetail.y + glassDetail.height);;
+  let maxSpace = glassDetail.y;
   obstacles.forEach(obstacle => {
     if (obstacle.y + obstacle.height < glassDetail.y &&
         obstacle.x <= glassDetail.x + glassDetail.width &&
diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue
index 9ae3ea2..411dd7f 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue
@@ -197,7 +197,7 @@
   return {
     position: 'absolute',
     left: `${glassDetail.x * scale}px`,
-    bottom: `${glassDetail.y * scale}px`,
+    top: `${glassDetail.y * scale}px`,
     width: `${glassDetail.width * scale}px`,
     height: `${glassDetail.height * scale}px`,
     backgroundColor: glassDetail.isRemain ? '#f0f0f0' : '#a0d8ef',

--
Gitblit v1.8.0