xufenglei
2018-11-14 1f5d96b654079484dd03de0c6d38559075e88bdb
src/main/webapp/js/moralmap.js
@@ -697,6 +697,9 @@
         }
         return new BMap.InfoWindow(getAdressOutHtml(), winOpts);
      })();
      if (!showEquipmentInfoWindow) {
         showEquipmentInfoWindow = infoWindow;
      }
      
      /*var infoWindow = (function() {
         //生成信息框
@@ -779,7 +782,7 @@
      }
        var  mouseOverHandle = option['mouseover'];
      //弹窗打开和关闭
      moralMarker.addEventListener("mouseover", function() {
      /*moralMarker.addEventListener("mouseover", function() {
         if(mouseOverHandle!=null&&mouseOverHandle instanceof  Function){
                //将arguments转换成数组
                var args = Array.prototype.slice.call(arguments);
@@ -787,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){
@@ -799,20 +802,25 @@
            }
            infoWindow.setContent(dataHandle._getDataOutHtml(data));
            infoWindow.redraw();
         }*/
         }
      });
      moralMarker.addEventListener("mouseout", function() {
         baiduMap.closeInfoWindow();
         infoWindow.setContent("");
         moralMap.openSearchBox();
      });*/
      moralMarker.addEventListener("mouseover", function() {
         moralMap.openInfoWindow(infoWindow, this._point); //开启信息窗口
      });
      moralMarker.addEventListener("mouseout", function() {
            moralMap.closeInfoWindow();
      });
      //==================infoWindow-end============================
      //储存监控点
      moralMap.putEquipment(option['mac'], moralMarker);
      var _super_refreshState = moralMarker.refreshState;
      if (!showEquipmentInfoWindow) {
         showEquipmentInfoWindow = infoWindow;
      }
      //$("#searchParam").val(option['mac']);
      return $.extend(moralMarker, {
         refreshState: function(data) {
@@ -960,35 +968,41 @@
      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;
      var parma={};
        parma["areaCode"] = moralMap['params']["areaCode"];
        parma["orgId"] = moralMap['params']["orgId"];
        if (condition.type == "mpoint") {
         parma["layer"] = "monitorpoints";
         parma["markerKeys"] = [condition.id];
      } 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) {
                }
            });*/
         parma["layer"] = "equipments";
         parma["markerKeys"] = [condition.mac];
      }
        //$("#searchParam").val(JSON.stringify(parma));
      $.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) {
            condition.state = data["extData"]["markers"][0]["state"];
            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;
            }
         }
      });
   }