From 21e38bfe17d3077d7ab0e05ee065f59547536692 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期二, 03 十二月 2024 10:33:19 +0800
Subject: [PATCH] 1.添加当前巡检状态的功能。 2.修复工单界面刷新已完成列表导致未完成列表数据被清除的bug

---
 app/src/main/assets/js/map.js |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/app/src/main/assets/js/map.js b/app/src/main/assets/js/map.js
index 760cee6..f149f39 100644
--- a/app/src/main/assets/js/map.js
+++ b/app/src/main/assets/js/map.js
@@ -30,12 +30,12 @@
             "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=d8beed89b43160a9a185e5aff431f85d";
         //鍒涘缓鑷畾涔夊浘灞傚璞�
         //褰卞儚娉ㄨ锛堝湴鍥句笂鐨勫湴鍧�锛�
-        var imgURL2 ="http://t0.tianditu.gov.cn/cia_w/wmts?" +"SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
-        "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}" +
-        "&tk=d8beed89b43160a9a185e5aff431f85d";
+        var imgURL2 = "http://t0.tianditu.gov.cn/cia_w/wmts?" + "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
+            "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}" +
+            "&tk=d8beed89b43160a9a185e5aff431f85d";
         var lay = new T.TileLayer(imageURL, { minZoom: 6, maxZoom: 18 });
         var lay2 = new T.TileLayer(imgURL2, { minZoom: 6, maxZoom: 18 });
-        var config = { layers: [lay,lay2] };
+        var config = { layers: [lay, lay2] };
         map = new T.Map("mapDiv", config);
         var scale = new T.Control.Scale();
         //娣诲姞姣斾緥灏烘帶浠�
@@ -153,8 +153,8 @@
 
 
     //璁剧疆鍦板浘涓績鐐�
-    function setCenterAndZoom(lng, lat,thiszoom) {
-    zoom=thiszoom;
+    function setCenterAndZoom(lng, lat, thiszoom) {
+        zoom = thiszoom;
         console.log("function銆嬨�嬨�嬨�嬨�媠etCenterAndZoom>>>>lng:" + lng + ",lat:" + lat);
         map.centerAndZoom(new T.LngLat(lng, lat), zoom);
     }
@@ -166,7 +166,7 @@
         window.showToast = showToast;
         window.addMarker = addMarker;
         window.setCenterAndZoom = setCenterAndZoom;
-        window.updateLocation=updateLocation;
+        window.updateLocation = updateLocation;
     }
 
     // 璋冪敤鍘熺敓瀹夊崜鏂规硶鏄剧ず鍙栨按鍙h鎯�
@@ -260,7 +260,7 @@
                 position: marker.getLngLat(),
                 offset: new T.Point(-35, 8), // 璁剧疆鏍囨敞鏂囧瓧鐨勪綅缃�
                 opacity: 1, // 璁剧疆鏂囨湰鐨勬樉绀轰笉閫忔槑搴︼紙鑼冨洿0-1锛�
-                    });
+            });
             label.setBorderLine(0); // 璁剧疆鏂囨湰鐨勮竟妗嗙嚎瀹�
             label.setBackgroundColor("transparent"); // 璁剧疆鏂囨湰鐨勮儗鏅壊锛堥�忔槑鑹诧級
             label.setFontColor("#0000FF");
@@ -270,19 +270,31 @@
         return "addMarker鍔犺浇鎴愬姛"
     }
     //淇濆瓨瀹氫綅鍧愭爣鐢熸垚杞ㄨ抗
-    var path=[];
-    function updateLocation(lat,log){
-        var newPoint = new T.LatLng(latitude, longitude);
+    var path = [];
+    var lineLayer = new T.Polyline([], { color: '#ff4500', weight: 3, opacity: 0.8 });
+    let locationMarker;
+    function updateLocation(log, lat) {
+        var lastLat = lat;
+        // const intervalId = setInterval(() => {
+        // lastLat=lastLat+0.0001;
+        var newPoint = new T.LngLat(log, lastLat);
         path.push(newPoint);
-        var polyline = new T.Polyline({
-            path: path,  // 杞ㄨ抗鍧愭爣
-            strokeColor: "#FF0000",  // 杞ㄨ抗棰滆壊
-            strokeWeight: 6,  // 杞ㄨ抗绾垮
-            strokeOpacity: 0.7  // 杞ㄨ抗閫忔槑搴�
+        lineLayer.setLngLats(path);
+        map.addOverLay(lineLayer);
+        let icon = new T.Icon({
+            iconUrl: locationIMGPath,
+            iconSize: new T.Point(27, 27),
+            iconAnchor: new T.Point(13, 20)
         });
-        map.addOverlay(polyline);
-         // 绉诲姩鍦板浘瑙嗚鍒版渶鍚庝竴涓綅缃�
-         map.panTo(newPoint);
+        if (locationMarker) {
+            map.removeOverLay(locationMarker);
+        }
+        locationMarker = new T.Marker(new T.LngLat(log, lastLat), { icon: icon });
+        map.addOverLay(locationMarker);
+        // 绉诲姩鍦板浘瑙嗚鍒版渶鍚庝竴涓綅缃�
+        map.panTo(newPoint);
+        // }, 500);
+
     }
 
 

--
Gitblit v1.8.0