fengxiang
2018-05-22 ca72da809fdf68f2d6833ed77ad92c9aadc0663d
src/main/webapp/js/moralmap.js
@@ -224,7 +224,6 @@
            moralMap["_closeInfoWinTimer"] = null;
        },1200);
        moralMap["_closeInfoWinTimer"] = timer;
   }
   moralMap.clearOverlays = function() {
      baiduMap.clearOverlays();
@@ -274,6 +273,7 @@
            return;
        }
      var equ = {
            methodName : 'chart'== select ?'showChart':'showDeviceMonitor',
         name: row['name'],
         mac: (row['mac']).toLowerCase(),
         longitude: row['longitude'],
@@ -283,23 +283,21 @@
      };
      !!select?equ['monitorPointId'] = row["monitorPointId"]:null;
      var equStr = JSON.stringify(equ);
        if(!!select&&select==='chart'){
            if(window['external']&&window['external']['showChartInfo']){
                window['external'].showChartInfo(equStr);
            }else{
                alert(equStr);
            }
        if(window["console"]!=undefined){
            console.log(equStr);
        }
        if(!!window['external']&&window['external']['callWin']){
            window['external'].callWin(equStr);
        }else{
             if(!!select&&select==='chart'&&!!window['external']&&window['external']['showChartInfo']){
                    window['external'].showChartInfo(equStr);
                }else if(!!window['external']&&window['external']['showMonitorInfo']){
                    window['external'].showMonitorInfo(equStr);
                }else{
                    alert(equStr);
                }
      }
      else{
            if(window["console"]!=undefined){
                console.log(equStr);
            }
            if(window['external']&&window['external']['showMonitorInfo']){
                window['external'].showMonitorInfo(equStr);
            }else{
                alert(equStr);
            }
      }
   }
   moralMap.setPopupEqus = function(arr) {
      moralMap["_equs"] = arr;
@@ -528,7 +526,7 @@
         //生成信息框
         var winOpts = {
            width: 110, // 信息窗口宽度
            height: 50, // 信息窗口高度
            height: 80, // 信息窗口高度
            title: getTitleOutHtml(), // 信息窗口标题
            offset: new BMap.Size(-2, -21) //设置信息窗偏移
         }
@@ -552,12 +550,14 @@
               address = address.slice(0, 18) + "...";
            }
            var adressOutHtml = "";
            adressOutHtml += "<div onmouseover='moralMap.clearCloseInfoWindow()'"
                adressOutHtml +=   "onmouseout='moralMap.closeInfoWindow()'"
            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'>地址:&nbsp;</td><td style='line-height:16px'>";
            adressOutHtml += address + "&nbsp;";
            adressOutHtml += "</td></tr></tbody></table></div>";
            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 += "</tbody></table></div>";
            return adressOutHtml;
         }
         return new BMap.InfoWindow(getAdressOutHtml(), winOpts);
@@ -832,5 +832,35 @@
      }
      return markers;
   }
    moralMap.showPointMonitor = function (id) {
        var mpointMarker = moralMap.getMpoint(id);
        var mpoint = mpointMarker.getOption();
        if(!!mpoint){
           delete mpoint['organization'];
           delete mpoint['icon'];
           delete mpoint['click'];
            if(window["console"]!=undefined){
                console.log(mpoint);
            }
            $.get("getvers?mptid="+id,function (res) {
                if(!!res&&res.code==1){
                    mpoint['versions'] = res.data;
                    mpoint['methodName'] = 'showPointMonitor';
                    var mpointStr = JSON.stringify(mpoint);
                    if(!!window['external']&&window['external']['callWin']){
                        window['external'].callWin(mpointStr);
                    }else{
                        alert(JSON.stringify(mpointStr));
                    }
                }
            })
      }else{
            if(window["console"]!=undefined){
                console.log("option of mpointMarker is null");
                console.log(mpointMarker);
            }
      }
    }
   window.moralMap = moralMap;
})(jQuery, BMap, window);