From 722e827a94213a478e0a4b62d3b590fc78d25737 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 06 Dec 2018 10:57:52 +0800
Subject: [PATCH] update

---
 src/main/webapp/js/moralmap.js |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index 5017183..35bb72c 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -956,17 +956,23 @@
 	}
 
     moralMap.callJS = function(condition) {
-		var condition = JSON.parse(condition);
-		var new_point = new BMap.Point(condition.longitude, condition.latitude);
-		baiduMap.panTo(new_point);
-		baiduMap.setCenter(new_point);
-        if (condition.type == "mpoint") {
-			baiduMap.setZoom(17);
-			moralMap.openInfoWindow(moralMap.getMpoint(condition.id)["infoWindow"], new_point);
-		} else if (condition.type == "device") {
-			baiduMap.setZoom(18);
-			moralMap.openInfoWindow(moralMap.getEquipment(condition.mac)["infoWindow"], new_point);
-		}
+    	var new_point = new BMap.Point(condition.longitude, condition.latitude);
+    	baiduMap.panTo(new_point);
+    	baiduMap.setCenter(new_point);
+		baiduMap.setZoom(condition.type == "mpoint" ? 17 : 18);
+    	var interval = setInterval(function(){
+    		var marker;
+    		if (condition.type == "mpoint") {
+    			marker = moralMap.getMpoint(condition.id);
+    		} else if (condition.type == "device") {
+    			marker = moralMap.getEquipment(condition.mac);
+    		}
+			if(marker){
+				clearInterval(interval);
+				moralMap.openInfoWindow(marker["infoWindow"], new_point);
+			}
+		}, 50);
+    	
 	}
 
 

--
Gitblit v1.8.0