From 4fdc4a6da681223148849a9b2eaf90227a56148a Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Fri, 09 Nov 2018 13:22:47 +0800 Subject: [PATCH] 地图 更改从列表定位 --- src/main/webapp/js/moralmap.js | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js index 1364c59..f097d2b 100644 --- a/src/main/webapp/js/moralmap.js +++ b/src/main/webapp/js/moralmap.js @@ -550,6 +550,7 @@ //new BMap.Marker()������������IE7��������������������� moralMap.MoralMarker.prototype = new BMap.Marker(); //��������������� ������Mark������ + var showMonitorpointInfoWindow = null; moralMap.Monitorpoint = function(option) { var icon = {}; icon["stateIcons"] = ["/img/ico00.png", "/img/ico01.png", "/img/ico02.png", "/img/ico03.png", "/img/ico04.png"]; @@ -593,12 +594,15 @@ adressOutHtml += "<tbody><tr><td style='vertical-align:top;width:38px;white-space:nowrap;word-break:keep-all'>��������� </td><td style='line-height:16px'>"; adressOutHtml += address + " "; adressOutHtml += "</td></tr>"; - adressOutHtml += "<tr><td style='width:98%;padding-top:10px;'colspan='2'><a href='javascript:void(0);' style='display:block;position: relative;float: right;' onclick='moralMap.showPointMonitor("+option.id+")'>������������>></a></td></tr>"; + //adressOutHtml += "<tr><td style='width:98%;padding-top:10px;'colspan='2'><a href='javascript:void(0);' style='display:block;position: relative;float: right;' onclick='moralMap.showPointMonitor("+option.id+")'>������������>></a></td></tr>"; adressOutHtml += "</tbody></table></div>"; return adressOutHtml; } return new BMap.InfoWindow(getAdressOutHtml(), winOpts); })(); + if (!showMonitorpointInfoWindow) { + showMonitorpointInfoWindow = infoWindow; + } if(moralMarker["infoWindow"] == undefined) { moralMarker["infoWindow"] = infoWindow; } @@ -638,6 +642,7 @@ } //���������mac���key������ //��������������� ������MoralMark������ + var showEquipmentInfoWindow = null; moralMap.Equipment = function(option) { var icon = {}; icon["stateIcons"] = ["/img/ico_coo00.png", "/img/ico_coo01.png", "/img/ico_coo02.png", "/img/ico_coo03.png", "/img/ico_coo04.png"]; @@ -674,6 +679,9 @@ } return new BMap.InfoWindow("", winOpts); })(); + if (!showEquipmentInfoWindow) { + showEquipmentInfoWindow = infoWindow; + } var dataHandle = { _getDataOutHtml: function(data) { if(data==null||data["state"]==4){ @@ -902,6 +910,26 @@ } } - } + } + + 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); + new moralMap.Monitorpoint(condition); + moralMap.openInfoWindow(showMonitorpointInfoWindow, new_point); + showMonitorpointInfoWindow = null; + } else if (condition.type == "device") { + baiduMap.setZoom(18); + new moralMap.Equipment(condition); + moralMap.openInfoWindow(showEquipmentInfoWindow, new_point); + showEquipmentInfoWindow = null; + } + } + + window.moralMap = moralMap; })(jQuery, BMap, window); \ No newline at end of file -- Gitblit v1.8.0