From de26c331fc9febdc11b85ff98ad657fb12cc2b73 Mon Sep 17 00:00:00 2001
From: wanglizhong <wlz>
Date: 星期六, 03 五月 2025 19:57:36 +0800
Subject: [PATCH] feat:车辆GPS

---
 ruoyi-ui/src/views/system/gps/map.vue |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/ruoyi-ui/src/views/system/gps/map.vue b/ruoyi-ui/src/views/system/gps/map.vue
index 2e93143..c659550 100644
--- a/ruoyi-ui/src/views/system/gps/map.vue
+++ b/ruoyi-ui/src/views/system/gps/map.vue
@@ -151,10 +151,14 @@
     };
   },
   created() {
-    // 鑾峰彇URL鍙傛暟涓殑杞︾墝鍙�
-    const vehicleNo = this.$route.query.vehicleNo;
-    if (vehicleNo) {
-      this.queryParams.vehicleNo = vehicleNo;
+    // 鑾峰彇URL鍙傛暟
+    const query = this.$route.query;
+    if (query.vehicleNo) {
+      this.queryParams.vehicleNo = query.vehicleNo;
+    }
+    // 璁剧疆鏃堕棿鑼冨洿
+    if (query.startTime && query.endTime) {
+      this.dateRange = [query.startTime, query.endTime];
     }
     this.getList();
   },
@@ -347,6 +351,7 @@
               padding: "2px 6px",
               borderRadius: "3px",
             });
+
             marker = new BMap.Marker(bdPoint,{rotation:direction});
             marker.setLabel(label);
           } else {
@@ -365,6 +370,21 @@
               rotation: direction,
             });
           }
+          //鍦ㄨ溅鍥炬爣涓婃樉绀鸿溅鐗�
+          const label = new BMap.Label(currentSegment[index].vehicleNo, {
+            offset: new BMap.Size(0, -25), // 鍚戜笂鍋忕Щ25鍍忕礌
+            position: bdPoint,
+          });
+          label.setStyle({
+            color: "white",
+            fontSize: "12px",
+            backgroundColor: "#3388ff",
+            border: "none",
+            padding: "2px 6px",
+            borderRadius: "3px",
+          });
+          marker.setLabel(label);
+          
 
           // 鑾峰彇鍦板潃淇℃伅
           const geoc = new BMap.Geocoder();
@@ -500,6 +520,25 @@
           convertor.translate([point], 1, 5, (data) => {
             if (data.status === 0) {
               const bdPoint = data.points[0];
+              //鏄剧ず杞﹁締鍥炬爣
+              const myIcon = new BMap.Icon(
+                "/car_blue.png",
+                new BMap.Size(20, 20),
+                {
+                  imageSize: new BMap.Size(20, 20),
+                  anchor: new BMap.Size(10, 10),
+                }
+              );
+              const marker = new BMap.Marker(bdPoint, {
+                icon: myIcon,
+                rotation: item.direction,
+              });
+               // 绉婚櫎涔嬪墠鐨勬爣璁扮偣
+               if (this.currentMarker) {
+                this.map.removeOverlay(this.currentMarker);
+              }
+              this.currentMarker=marker;
+              this.map.addOverlay(marker);
               this.map.setCenter(bdPoint);
               this.map.setZoom(15);
             }

--
Gitblit v1.9.1