From 2d67ed727031e32a6762d0ca77a8d9dd18fb13f0 Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Mon, 12 Nov 2018 17:02:06 +0800 Subject: [PATCH] update --- src/main/webapp/js/moralmap.js | 103 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 96 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js index 1364c59..f5e33a1 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"]; @@ -651,7 +656,52 @@ var moralMarker = new moralMap.MoralMarker(option); // var mark =new BMap.Marker(pointObj,{icon:iconObj}); //==================infoWindow-start============================ + var infoWindow = (function() { + //��������������� + var winOpts = { + width: 110, // ������������������ + height: 80, // ������������������ + title: getTitleOutHtml(), // ������������������ + offset: new BMap.Size(-8,-5) //��������������������� + } + + function getTitleOutHtml() { + //title���������������... + var title = (option["name"] == null) ? "" : option["name"]; + if(title.length > 13) { + title = title.slice(0, 13) + "..."; + } + var titleOutHtml = ""; + titleOutHtml += "<p style='width:210px;font:bold 14px/16px arial,sans-serif;margin:0;color:#cc5522;white-space:nowrap;overflow:hidden'" + titleOutHtml += "title='" + option["name"] + "'>"; + titleOutHtml += title + "</p>"; + return titleOutHtml; + } + + function getAdressOutHtml() { + var address = (option["address"] == null) ? "" : option["address"]; + if(address.length > 18) { + address = address.slice(0, 18) + "..."; + } + var adressOutHtml = ""; + adressOutHtml += "<div onmouseover='moralMap.clearCloseInfoWindow()'"; + adressOutHtml += "onmouseout='moralMap.closeInfoWindow()'"; + adressOutHtml +=" style='font:12px arial,sans-serif;margin-top:12px'><table cellspacing='0' style='overflow:hidden;table-layout:fixed;width:100%;font:12px arial,sans-serif'>"; + 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 += "</tbody></table></div>"; + //$("#searchParam").val(address); + return adressOutHtml; + } + return new BMap.InfoWindow(getAdressOutHtml(), winOpts); + })(); + if (!showEquipmentInfoWindow) { + showEquipmentInfoWindow = infoWindow; + } + + /*var infoWindow = (function() { //��������������� var winOpts = { width: option["online_width"], // ������������������ @@ -725,7 +775,7 @@ } return grade+"00"; } - }; + };*/ if(moralMarker["infoWindow"] == undefined) { moralMarker["infoWindow"] = infoWindow; @@ -740,7 +790,7 @@ } moralMap.closeSearchBox(); baiduMap.openInfoWindow(infoWindow, this._point); //������������������ - if(infoWindow.getContent() == "") { + /*if(infoWindow.getContent() == "") { var data = this.getData(); var option = this.getOption(); if(data==null||data["state"]==4){ @@ -752,7 +802,7 @@ } infoWindow.setContent(dataHandle._getDataOutHtml(data)); infoWindow.redraw(); - } + }*/ }); moralMarker.addEventListener("mouseout", function() { baiduMap.closeInfoWindow(); @@ -763,6 +813,7 @@ //��������������� moralMap.putEquipment(option['mac'], moralMarker); var _super_refreshState = moralMarker.refreshState; + //$("#searchParam").val(option['mac']); return $.extend(moralMarker, { refreshState: function(data) { if(data != null && data!="") { @@ -770,7 +821,7 @@ this.setData(data); //������������ _super_refreshState.call(this, data["state"]); //������������������������������,������������������������ - if(infoWindow.isOpen()) { + /*if(infoWindow.isOpen()) { if(data["state"]==4){ if(state!=4){ infoWindow.setHeight(option["offline_height"]); @@ -799,7 +850,7 @@ $(itme_data_mac_key).text(dataValue); } } - } + }*/ } }, setData:function(data){ @@ -902,6 +953,44 @@ } } - } + } + + 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") { + var parma={}; + parma["layer"] = "equipments"; + parma["markerKeys"] = [condition.mac]; + parma["areaCode"] = moralMap['params']["areaCode"]; + parma["orgId"] = moralMap['params']["orgId"]; + baiduMap.setZoom(18); + //condition.data = {}; + new moralMap.Equipment(condition); + moralMap.openInfoWindow(showEquipmentInfoWindow, new_point); + showEquipmentInfoWindow = null; + /*$.ajax({ + type: "post", + url: "get-real-state-data", + data:JSON.stringify(parma), + dataType:"json", + contentType:"application/json;charset=utf-8", + cache: false, + async: true, + success: function(data) { + + } + });*/ + } + } + + window.moralMap = moralMap; })(jQuery, BMap, window); \ No newline at end of file -- Gitblit v1.8.0