From 16425e5c62f3e65a0e529d7c0ab851fa49b88ef0 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期一, 18 八月 2025 18:32:19 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/core/thread/RgvThread.java         |   11 +
 src/main/java/com/zy/asrs/controller/RgvController.java |   34 ++++
 src/main/java/com/zy/asrs/utils/Utils.java              |  130 +++++++++++---------
 src/main/webapp/views/index.html                        |  124 +++++++++++++++----
 src/main/resources/license.lic                          |    0 
 src/main/resources/application.yml                      |   24 ++--
 6 files changed, 217 insertions(+), 106 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java
index 0b889d3..6bcaa10 100644
--- a/src/main/java/com/zy/asrs/controller/RgvController.java
+++ b/src/main/java/com/zy/asrs/controller/RgvController.java
@@ -61,6 +61,8 @@
     @Autowired
     private BasRgvService basRgvService;
     @Autowired
+    private BasDevpService basDevpService;
+    @Autowired
     private MainServiceImpl mainService;
     @Autowired
     private BasDevpPositionService basDevpPositionService;
@@ -355,8 +357,8 @@
             double[] doubles = Utils.getRgvPosNew(perimeter, rgvProtocol.RgvPos.doubleValue());
 //            double[] doubles = Utils.RingThroughXY2(183.0, 100*i );
 
-            ringThroughParam.setValueX(doubles[0]-2.94);
-            ringThroughParam.setValueY(doubles[1]-2.94);
+            ringThroughParam.setValueX(doubles[0]);
+            ringThroughParam.setValueY(doubles[1]);
             ringThroughParam.setModeColor(rgvProtocol.modeType.color);
             ringThroughParam.setStatusColor(rgvProtocol.statusType.color);
             result.add(ringThroughParam);
@@ -371,10 +373,32 @@
         List<RingThroughParam> result = new ArrayList<>();
         List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<>());
         for (BasDevpPosition basDevpPosition : basDevpPositions){
-            if (basDevpPosition.getDevNo() == 134){
-                continue;
-            }
             RingThroughParam ringThroughParam = new RingThroughParam();
+
+            ringThroughParam.setModeColor("#FFFFFF");
+            ringThroughParam.setStatusColor("#FFFFFF");
+            try{
+                BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",basDevpPosition.getDevNo()));
+                if (basDevp.getAutoing().equals("Y")){
+                    if (basDevp.getLoading().equals("Y")){
+                        ringThroughParam.setModeColor("#ab1839");
+                        ringThroughParam.setStatusColor("#ab1839");
+                    }
+                    if (basDevp.getLoading().equals("N")){
+                        ringThroughParam.setModeColor("#27AE60");
+                        ringThroughParam.setStatusColor("#27AE60");
+                    }
+                } else {
+                    ringThroughParam.setModeColor("#C0392B");
+                    ringThroughParam.setStatusColor("#C0392B");
+                }
+
+            } catch (Exception e){
+                System.out.println(e.getMessage());
+                ringThroughParam.setModeColor("#000000");
+                ringThroughParam.setStatusColor("#000000");
+
+            }
             ringThroughParam.setIndex(basDevpPosition.getDevNo());
 //            double[] doubles = Utils.RingThroughXYSta(perimeter, perimeter-basDevpPosition.getPlcPosition());
 //            ringThroughParam.setValueX(doubles[0]>50? doubles[0]+6:doubles[0]-1);
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 2fc9e89..a98d157 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -132,54 +132,54 @@
     }
     public static double[] getRgvPosNew(Integer devNo,double a, double b) {
         double[] rgvPosNew = getRgvPosNew(a, b);
-        switch (devNo){
-            case 101:
-            case 102:
-            case 103:
-            case 104:
-            case 105:
-            case 106:
-            case 107:
-            case 108:
-            case 109:
-            case 110:
-            case 111:
-                rgvPosNew[0] = rgvPosNew[0] - 30;
-                rgvPosNew[1] = rgvPosNew[1];
-                break;
-            case 112:
-            case 113:
-            case 114:
-            case 115:
-                rgvPosNew[0] = rgvPosNew[0] + 30;
-                rgvPosNew[1] = rgvPosNew[1];
-                break;
-            case 116:
-            case 117:
-            case 118:
-            case 119:
-            case 120:
-            case 121:
-            case 122:
-            case 123:
-            case 124:
-            case 125:
-            case 126:
-            case 127:
-            case 128:
-            case 129:
-            case 130:
-            case 131:
-            case 132:
-            case 133:
-                rgvPosNew[0] = rgvPosNew[0];
-                rgvPosNew[1] = rgvPosNew[1] + 30;
-                break;
-            case 134:
-                rgvPosNew[0] = rgvPosNew[0];
-                rgvPosNew[1] = rgvPosNew[1] - 30;
-                break;
-        }
+//        switch (devNo){
+//            case 101:
+//            case 102:
+//            case 103:
+//            case 104:
+//            case 105:
+//            case 106:
+//            case 107:
+//            case 108:
+//            case 109:
+//            case 110:
+//            case 111:
+//                rgvPosNew[0] = rgvPosNew[0] - 50;
+//                rgvPosNew[1] = rgvPosNew[1];
+//                break;
+//            case 112:
+//            case 113:
+//            case 114:
+//            case 115:
+//                rgvPosNew[0] = rgvPosNew[0] + 30;
+//                rgvPosNew[1] = rgvPosNew[1];
+//                break;
+//            case 116:
+//            case 117:
+//            case 118:
+//            case 119:
+//            case 120:
+//            case 121:
+//            case 122:
+//            case 123:
+//            case 124:
+//            case 125:
+//            case 126:
+//            case 127:
+//            case 128:
+//            case 129:
+//            case 130:
+//            case 131:
+//            case 132:
+//            case 133:
+//                rgvPosNew[0] = rgvPosNew[0];
+//                rgvPosNew[1] = rgvPosNew[1] + 70;
+//                break;
+//            case 134:
+//                rgvPosNew[0] = rgvPosNew[0];
+//                rgvPosNew[1] = rgvPosNew[1] - 30;
+//                break;
+//        }
         return rgvPosNew;
 
     }
@@ -189,32 +189,44 @@
         // 绫诲瀷璇存槑锛�0-鐩寸嚎锛�1-鍦嗗姬锛堥渶瑕佸渾蹇冨潗鏍囷級
         Object[][] intervals = {
                 // 鐩寸嚎鍖洪棿锛�0-134400锛�
-                {0.0, 120000.0, 0, 390.0, 775.0, 25.0, 775.0},
+//                {璧风偣, 缁堢偣, 绫诲瀷, x1, y1, x2, y2,
+                {0.0, 120000.0, 0, 390.0, 750.0, 60.0, 750.0},
 //                // 寮х嚎鍖洪棿锛侊紒锛佺洿绾垮尯闂达紒锛侊紒
-                {120000.0, 127500.0, 0, 25.0, 775.0, 45.0, 822.0},
+//                {120000.0, 127500.0, 2, 60.0, 750.0, 10.0, 800.0, 10.0, 750.0}, // 淇缁堢偣鍧愭爣
+                {120000.0, 127500.0, 2, 60.0, 750.0, 10.0, 800.0, 60.0, 800.0}, // 淇缁堢偣鍧愭爣
+//                {120000.0, 127500.0, 0, 25.0, 775.0, 45.0, 822.0},
                 // 寮х嚎鍖洪棿锛侊紒锛佺洿绾垮尯闂达紒锛侊紒
-                {127500.0, 134900.0, 0, 45.0, 822.0, 65.0, 882.0},
+//                {127500.0, 134900.0, 2, 10.0, 800.0, 60.0, 850.0, 10.0, 850.0}, // 淇缁堢偣鍧愭爣
+                {127500.0, 134900.0, 2, 10.0, 800.0, 60.0, 850.0, 60.0, 800.0}, // 淇缁堢偣鍧愭爣
+//                {127500.0, 134900.0, 0, 45.0, 822.0, 65.0, 882.0},
                 // 鐩寸嚎鍖洪棿
-                {134900.0, 680103.0,0, 65.0, 882.0, 1115.0, 882.0},
+                {134900.0, 680103.0,0, 60.0, 850.0, 1100.0, 850.0},
 
 //                // 寮х嚎鍖洪棿锛堟嫄鐐�116-115锛夛紝鎺у埗鐐瑰亣璁句负(1125, 882)
 //                {680103, 731550, 1115, 882, 1215, 775, 1125, 882},
 
                 // 鍦嗗姬鍖洪棿锛堟嫄鐐�116-115锛夋柊鍙傛暟锛氬渾蹇�(1115,775)
-                {680103.0, 731550.0, 2, 1115.0, 882.0, 1215.0, 775.0, 1115.0, 775.0}, // 淇缁堢偣鍧愭爣
+//                {680103.0, 731550.0, 2, 1100.0, 850.0, 1200.0, 750.0, 1200.0, 850.0}, // 淇缁堢偣鍧愭爣
+                {680103.0, 731550.0, 2, 1100.0, 850.0, 1200.0, 750.0, 1100.0, 750.0}, // 淇缁堢偣鍧愭爣
 
                 // 鐩寸嚎鍖洪棿
-                {731550.0, 972950.0,0, 1215.0, 775.0, 1215.0, 125.0},
+                {731550.0, 972950.0,0, 1200.0, 750.0, 1200.0, 100.0},
                 // 寮х嚎鍖洪棿锛堟嫄鐐�112-椤剁偣锛夛紝鎺у埗鐐瑰亣璁句负(1215, 80)锛侊紒锛佺洿绾垮尯闂达紒锛侊紒
-                {972950.0, 1016193.0,0, 1215.0, 125.0, 1164.0, 80.0},
+//                {972950.0, 1016193.0, 2, 1200.0, 100.0, 1150.0, 50.0, 1200.0, 50.0}, // 淇缁堢偣鍧愭爣
+                {972950.0, 1016193.0, 2, 1200.0, 100.0, 1150.0, 50.0, 1150.0, 100.0}, // 淇缁堢偣鍧愭爣
+//                {972950.0, 1016193.0,0, 1215.0, 125.0, 1164.0, 80.0},
                 // 寮х嚎鍖洪棿锛堟嫄鐐�-椤剁偣-111锛夛紝鎺у埗鐐瑰亣璁句负(1164, 125)锛侊紒锛佺洿绾垮尯闂达紒锛侊紒
-                {1016193.0, 1063563.0,0, 1164.0, 80.0, 1115.0, 125.0},
+//                {1016193.0, 1063563.0, 2, 1150.0, 50.0, 1100.0, 100.0, 1100.0, 50.0}, // 淇缁堢偣鍧愭爣
+                {1016193.0, 1063563.0, 2, 1150.0, 50.0, 1100.0, 100.0, 1150.0, 100.0}, // 淇缁堢偣鍧愭爣
+//                {1016193.0, 1063563.0,0, 1164.0, 80.0, 1115.0, 125.0},
                 // 鐩寸嚎鍖洪棿
-                {1063563.0, 1315250.0,0, 1115.0, 150.0, 1115.0, 720.0},
+                {1063563.0, 1315250.0,0, 1100.0, 100.0, 1100.0, 700.0},
                 // 寮х嚎鍖洪棿锛堟嫄鐐�101-杞集锛夛紝鎺у埗鐐瑰亣璁句负(1115, 750)
-                {1315250.0, 1322829.0,0, 1115.0, 720.0, 1100.0, 750.0},
+//                {1315250.0, 1322829.0, 2, 1100.0, 700.0, 1050.0, 750.0, 1100.0, 750.0}, // 淇缁堢偣鍧愭爣
+                {1315250.0, 1322829.0, 2, 1100.0, 700.0, 1050.0, 750.0, 1050.0, 700.0}, // 淇缁堢偣鍧愭爣
+//                {1315250.0, 1322829.0,0, 1115.0, 720.0, 1100.0, 750.0},
                 // 鐩寸嚎鍖洪棿
-                {1322829.0, 1737000.0,0, 1090.0, 775.0, 390.0, 775.0},
+                {1322829.0, 1737000.0,0, 1050.0, 750.0, 390.0, 750.0},
         };
 
         for (Object[] interval : intervals) {
diff --git a/src/main/java/com/zy/core/thread/RgvThread.java b/src/main/java/com/zy/core/thread/RgvThread.java
index 3a0abbd..a7ef7c1 100644
--- a/src/main/java/com/zy/core/thread/RgvThread.java
+++ b/src/main/java/com/zy/core/thread/RgvThread.java
@@ -13,6 +13,7 @@
 import com.zy.asrs.service.BasRgvErrLogService;
 import com.zy.asrs.service.BasRgvOptService;
 import com.zy.asrs.service.BasRgvService;
+import com.zy.asrs.utils.NumUtils;
 import com.zy.core.ThreadHandler;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.OutputQueue;
@@ -53,6 +54,7 @@
     private boolean resetFlag2 = false;
     private boolean connectRgv = false;
     private boolean alarmChangeSign = false;
+    private int rgvIII = 1;
 
     public RgvThread(RgvSlave slave) {
         this.slave = slave;
@@ -61,6 +63,7 @@
     @Override
     @SuppressWarnings("InfiniteLoopStatement")
     public void run() {
+        rgvIII = this.slave.getId();
         connectRgv = this.connect();
         while(!connectRgv){
             try {
@@ -311,7 +314,13 @@
                 alarmChangeSign = new HashSet<>(alarmList).equals(new HashSet<>(rgvProtocol.getAlarmList()));
                 rgvProtocol.setAlarmList(alarmList);
 
-//                rgvProtocol.setRgvPos((long)NumUtils.GetRandomIntInRange(1737000));
+//                rgvProtocol.setRgvPos((long) NumUtils.GetRandomIntInRange(1737000));
+                rgvProtocol.setRgvPos((long) (10000*rgvIII+rgvProtocol.getRgvNo()*10000));
+                if (rgvProtocol.getRgvPos()>1737000){
+                    rgvIII = rgvProtocol.getRgvNo();
+                    rgvProtocol.setRgvPos((long) (10000*rgvIII+rgvProtocol.getRgvNo()*10000));
+                }
+                rgvIII++;
                 OutputQueue.RGV.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 
 
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 807458d..40b1a79 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -8,8 +8,8 @@
     name: @pom.build.finalName@
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-    url: jdbc:sqlserver://127.0.0.1:50751;databasename=gdhmasrs
-#    url: jdbc:sqlserver://127.0.0.1:50948;databasename=gdhmasrs
+#    url: jdbc:sqlserver://127.0.0.1:50751;databasename=gdhmasrs
+    url: jdbc:sqlserver://127.0.0.1:50948;databasename=gdhmasrs
     username: sa
     password: sa@123
   mvc:
@@ -64,7 +64,7 @@
   # RGV绌挎杞�1
   rgv[0]:
     id: 1
-    ip: 172.17.196.3
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -72,7 +72,7 @@
   # RGV绌挎杞�1
   rgv[1]:
     id: 2
-    ip: 172.17.196.6
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -80,7 +80,7 @@
   # RGV绌挎杞�1
   rgv[2]:
     id: 3
-    ip: 172.17.196.9
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -88,7 +88,7 @@
   # RGV绌挎杞�1
   rgv[3]:
     id: 4
-    ip: 172.17.196.12
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -96,7 +96,7 @@
   # RGV绌挎杞�1
   rgv[4]:
     id: 5
-    ip: 172.17.196.15
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -104,7 +104,7 @@
   # RGV绌挎杞�1
   rgv[5]:
     id: 6
-    ip: 172.17.196.18
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -112,7 +112,7 @@
   # RGV绌挎杞�1
   rgv[6]:
     id: 7
-    ip: 172.17.196.21
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -120,7 +120,7 @@
   # RGV绌挎杞�1
   rgv[7]:
     id: 8
-    ip: 172.17.196.25
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -128,7 +128,7 @@
   # RGV绌挎杞�1
   rgv[8]:
     id: 9
-    ip: 172.17.196.28
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
@@ -136,7 +136,7 @@
   # RGV绌挎杞�1
   rgv[9]:
     id: 10
-    ip: 172.17.196.31
+    ip: 192.168.4.250
     port: 502
     rack: 0
     slot: 0
diff --git a/src/main/resources/license.lic b/src/main/resources/license.lic
index dc4e62b..8cc20fc 100644
--- a/src/main/resources/license.lic
+++ b/src/main/resources/license.lic
Binary files differ
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index b2aeede..c0cb1c5 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -35,7 +35,7 @@
         .map {
             position: relative;
             width: 52vw;
-            height: 80vh;
+            height: 72vh;
             border-radius: 50%;
             display: flex;
             justify-content: center;
@@ -163,7 +163,7 @@
             background: #f0f9eb;
         }
         .container {
-            width: 100vh;
+            width: 52vw;
             height: 72vh;
             position: absolute;
             /*background: #8c939d;*/
@@ -204,7 +204,7 @@
         }
     </style>
 </head>
-<body>
+<body id="app1">
     <!--<header>-->
     <!--    鐜舰绌挎杞︽櫤鑳界郴缁�-->
     <!--</header>-->
@@ -217,19 +217,9 @@
             <!--        <div class="outer-ring"></div>-->
 <!--            <div v-for="track in energyGatheringRing" class="inner-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
 <!--            <div v-for="track in energyGatheringRing" class="outer-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
-            <svg class="container">
-<!--                <path d="M 100,250-->
-<!--                        L 100,800-->
-<!--                        C 100,800 100,850 150,850-->
-<!--                        C 150,850 200,850 200,800-->
-<!--                        L 200,250-->
-<!--                        C 200,250 200,200 250,200-->
-<!--                        L 1100,200-->
-<!--                        C 1100,200 1150,200 1150,150-->
-<!--                        C 1150,150 1150,100 1100,100-->
-<!--                        L 250,100-->
-<!--                        C 250,100 90,90 100,250 z"-->
-<!--                      style="fill:none; stroke:blue; stroke-width:4;" />-->
+            <svg class="container"
+                 viewBox="0 0 1200 850"
+                 preserveAspectRatio="xMidYMid meet">
                 <path d="M 1200,750
                         L 1200,100
                         C 1200,100 1200,50 1150,50
@@ -244,17 +234,11 @@
 "
                       style="fill:none; stroke:blue; stroke-width:4;" />
             </svg>
-<!--            <div class="bus-station">-->
-<!--                <div v-for="(item,i) in devpPos1" class="bus-item-top" :style="'left:' + (75 + i * 15) + 'px'">{{item.dev_no}}</div>-->
-<!--            </div>-->
-<!--            <div class="bus-station" style="flex-direction: column">-->
-<!--                <div v-for="(item,i) in devpPos2" class="bus-item-left" :style="'top:' + (200 + i * 50) + 'px'">{{item.dev_no}}</div>-->
-<!--            </div>-->
-<!--            <div class="bus-station" style="flex-direction: column">-->
-<!--                <div v-for="(item,i) in devpPos3" class="bus-item-left2" :style="'top:' + (100 + i * 10) + 'px'">{{item.dev_no}}</div>-->
-<!--            </div>-->
-<!--             Stations on outer ring-->
-            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' }">{{ station.index }}</div>
+<!--            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' , backgroundColor: station.modeColor}">{{ station.index }}</div>-->
+            <div v-for="station in tableDataDev" class="station" :style="{
+                top: convertToCSSPosition(station.valueX, station.valueY).y + 'px',
+                left: convertToCSSPosition(station.valueX, station.valueY).x + 'px',
+                backgroundColor: station.modeColor}">{{ station.index }}</div>
             <div>
                 <el-switch
                         style="display: block"
@@ -267,7 +251,11 @@
                 </el-switch>
             </div>
             <!-- Buses -->
-            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
+<!--            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>-->
+            <div v-for="bus in tableDataRgv" class="bus" :style="{
+                top: convertToCSSPosition(bus.valueX, bus.valueY).y + 'px',
+                left: convertToCSSPosition(bus.valueX, bus.valueY).x + 'px',
+                borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
         </div>
 
         <!-- Left Task Bar -->
@@ -477,9 +465,18 @@
     </div>
 
     <script>
+        // 鍦╒ue瀹炰緥澶栬幏鍙朾ody灏哄
+        function getBodySize() {
+            return {
+                width: document.body.clientWidth,
+                height: document.body.clientHeight
+            };
+        }
         var app = new Vue({
             el: '#app',
             data: {
+                containerSize: { width: 0, height: 0},
+                bodySize: { width: 0, height: 0 },
                 activeNames: ['1'],
                 valueLeft: '0',
                 valueLeft1: '0',
@@ -543,6 +540,24 @@
             watch: {
 
             },
+
+            // 鍦� mounted 涓垵濮嬪寲灏哄鍜岀洃鍚�
+            mounted() {
+                this.updateContainerSize();
+                this.updateBodySize();
+                window.addEventListener('resize', this.handleResize);
+            },
+            beforeDestroy() {
+                window.removeEventListener('resize', this.handleResize);
+            },
+            computed: {
+                mappedStations() {
+                    return this.tableDataDev.map(station => ({
+                        ...station,
+                        position: this.convertToCSSPosition(station.valueX, station.valueY)
+                    }));
+                }
+            },
             methods: {
                 init(){
                     this.getTableDataRgv()
@@ -569,6 +584,52 @@
                     }, 1000)
                 },
 
+                // 鑾峰彇瀹瑰櫒瀹為檯灏哄
+                updateContainerSize() {
+                    const mapEl = this.$el.querySelector('.map');
+                    this.containerSize = {
+                        width: mapEl.clientWidth,
+                        height: mapEl.clientHeight
+                    };
+                },
+
+                // 鏇存柊body灏哄
+                updateBodySize() {
+                    this.bodySize = getBodySize();
+                },
+
+                // 鍧愭爣杞崲鍑芥暟
+                convertToCSSPosition(svgX, svgY) {
+                    const svgWidth = 1200;  // SVG 鍘熷瀹藉害
+                    let svgWidthR = 0;  //
+                    const svgHeight = 850; // SVG 鍘熷楂樺害
+                    let svgHeightR = 0; //
+                    if (svgX>svgWidth/2){
+                        svgWidthR = (((svgX-svgWidth/2)/svgWidth) * this.containerSize.width) + this.bodySize.width/2 - this.bodySize.width*((1-0.52)/2);
+                    } else {
+                        svgWidthR = this.bodySize.width/2 - (((svgWidth/2 - svgX)/svgWidth) * this.containerSize.width)  - this.bodySize.width*((1-0.52)/2);
+                    }
+                    if (svgY>svgHeight/2){
+                        svgHeightR = (((svgY-svgHeight/2)/svgHeight) * this.containerSize.height) + this.bodySize.height/2 - this.bodySize.height*((1-0.72)/2);
+                    } else {
+                        svgHeightR = this.bodySize.height/2 - (((svgHeight/2 - svgY)/svgHeight) * this.containerSize.height)  - this.bodySize.height*((1-0.72)/2);
+                    }
+                    return {
+                        x: svgWidthR,
+                        y: svgHeightR
+                    };
+                },
+
+                handleZoom(e) {
+                    const scaleDelta = e.deltaY > 0 ? 0.9 : 1.1;
+                    const currentScale = this.scale || 1;
+                    const newScale = Math.max(0.5, Math.min(2, currentScale * scaleDelta));
+
+                    // 搴旂敤缂╂斁
+                    const svgEl = this.$el.querySelector('.container');
+                    svgEl.style.transform = `scale(${newScale})`;
+                    this.scale = newScale;
+                },
                 verifyPassword(callback) {
                     this.$prompt('璇疯緭鍏ョ鐞嗗憳瀵嗙爜: root', '楠岃瘉', {
                         confirmButtonText: '纭畾',
@@ -877,7 +938,12 @@
                             that.energyGatheringRing = res.data
                         }
                     });
-                }
+                },
+                // 澶勭悊绐楀彛澶у皬鍙樺寲
+                handleResize: _.debounce(function() {
+                    this.updateContainerSize();
+                    this.updateBodySize();
+                }, 100)
             }
         })
 

--
Gitblit v1.9.1