xufenglei
2018-11-12 be9fe39e90412b4b46c8348bea94d0edaa1b19ae
update
1 files modified
71 ■■■■■ changed files
src/main/webapp/js/moralmap.js 71 ●●●●● patch | view | raw | blame | history
src/main/webapp/js/moralmap.js
@@ -656,7 +656,49 @@
        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'>地址:&nbsp;</td><td style='line-height:16px'>";
                adressOutHtml += address + "&nbsp;";
                adressOutHtml += "</td></tr>";
                adressOutHtml += "</tbody></table></div>";
                //$("#searchParam").val(address);
                return adressOutHtml;
            }
            return new BMap.InfoWindow(getAdressOutHtml(), winOpts);
        })();
        /*var infoWindow = (function() {
            //生成信息框
            var winOpts = {
                width: option["online_width"], // 信息窗口宽度
@@ -730,7 +772,7 @@
                }
                return grade+"00";
            }
        };
        };*/
        if(moralMarker["infoWindow"] == undefined) {
            moralMarker["infoWindow"] = infoWindow;
@@ -745,7 +787,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){
@@ -757,7 +799,7 @@
                }
                infoWindow.setContent(dataHandle._getDataOutHtml(data));
                infoWindow.redraw();
            }
            }*/
        });
        moralMarker.addEventListener("mouseout", function() {
            baiduMap.closeInfoWindow();
@@ -771,6 +813,7 @@
        if (!showEquipmentInfoWindow) {
            showEquipmentInfoWindow = infoWindow;
        }
        //$("#searchParam").val(option['mac']);
        return $.extend(moralMarker, {
            refreshState: function(data) {
                if(data != null && data!="") {
@@ -778,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"]);
@@ -807,7 +850,7 @@
                                            $(itme_data_mac_key).text(dataValue);
                                        }
                                    }
                            }
                            }*/
                }
            },
            setData:function(data){
@@ -923,10 +966,28 @@
            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) {
                }
            });*/
        }
    }