From 0f6c820ada8ef981aeeda45607c31a7a18804796 Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.25> Date: 星期二, 30 十月 2018 15:47:27 +0800 Subject: [PATCH] Merge branch 'dev_lxw' of https://whyclxw1@gitlab.com/whyclxw1/gx_tieta.git into dev_lxw --- gx_tieta/WebRoot/index.jsp | 101 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 80 insertions(+), 21 deletions(-) diff --git a/gx_tieta/WebRoot/index.jsp b/gx_tieta/WebRoot/index.jsp index 41ac7e9..7f02c46 100644 --- a/gx_tieta/WebRoot/index.jsp +++ b/gx_tieta/WebRoot/index.jsp @@ -545,6 +545,10 @@ $('#map').on('dblclick', '.explain-header', function() { return false; }); + + $('.nav-map').on('click', '.explain-list input', function() { + setMapImgStyles(); + }); }); //鍒涘缓鎸囧畾鍏冪礌涓嬪厠闅嗚〃鏍煎ご閮� @@ -625,7 +629,7 @@ centerMapByPoint(map); // 鏍规嵁褰撳墠鐢ㄦ埛璁惧畾鐨勪綅缃樉绀轰腑蹇冪偣 map.enableScrollWheelZoom(); map.disableDoubleClickZoom(); - //map.setMapStyle({style: 'grayscale'}); // 璁剧疆鍦板浘鐨勯鏍� + map.setMapStyle({style: 'grayscale'}); // 璁剧疆鍦板浘鐨勯鏍� // 娣诲姞鍦板浘绫诲瀷鎺т欢 map.addControl(new BMap.MapTypeControl()); // 缁欏湴鍥炬坊鍔犲伐鍏锋潯(鍦板浘-鍗槦-涓夌淮)鍜屾瘮渚嬪昂鎺т欢 @@ -1512,7 +1516,8 @@ mapEle.parent().append(iconExplain); - + // 璁剧疆鍦板浘鍥炬爣绉嶇被 + setMapImgStyles(); } // 鍒囨崲鍦板浘鍥炬爣璇存槑 function changeMapImgDesc(iconExplain, type) { @@ -1531,7 +1536,7 @@ function mapImgDescNormal(iconExplain) { // 鏈烘埧钀藉悗 var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>'); - var input = $('<input type="checkbox" checked="checked">'); + var input = $('<input type="checkbox" data-img="item-behind" checked="checked">'); var icon = $('<img src="'+mapImages.behind+'">'); var span = $('<span>鐢垫睜缁勮惤鍚庢満鎴�</span>'); iconList.append(input); @@ -1541,7 +1546,7 @@ // 鏈烘埧鍛婅 var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>'); - var input = $('<input type="checkbox" checked="checked">'); + var input = $('<input type="checkbox" data-img="item-warn" checked="checked">'); var icon = $('<img src="'+mapImages.warn+'">'); var span = $('<span>鐢垫睜缁勫憡璀︽満鎴�</span>'); iconList.append(input); @@ -1552,7 +1557,7 @@ // 鏈烘埧寤舵椂 var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>'); - var input = $('<input type="checkbox" checked="checked">'); + var input = $('<input type="checkbox" data-img="item-timeout" checked="checked">'); var icon = $('<img src="'+mapImages.timeout+'">'); var span = $('<span>鐢垫睜缁勬斁鐢靛欢鏃舵満鎴�</span>'); iconList.append(input); @@ -1562,7 +1567,7 @@ // 姝e父鏈烘埧 var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>'); - var input = $('<input type="checkbox" checked="checked">'); + var input = $('<input type="checkbox" data-img="item-normal" checked="checked">'); var icon = $('<img src="'+mapImages.normal+'">'); var span = $('<span>姝e父鏈烘埧</span>'); iconList.append(input); @@ -1656,14 +1661,13 @@ function createMapDot(map, dotList, isTop) { // 娓呯┖瑕嗙洊鐗╁拰瀵瑰簲鐨刴k鐐� mkList = []; - // 閬嶅巻鏌ヨ鍐呭鐢熸垚瀵瑰簲鐨勫浘鏍� - for(var i = 0; i < dotList.length; i++) { + for(var i = 0; i<dotList.length; i++) { + var isShow = checkMapImgStyle(dotList[i].msg); var dotIcon = new BMap.Icon(getMapStateImg(mapImages, dotList[i].msg), new BMap.Size(36, 30)); // 璁剧疆鍥剧墖 var pt = new BMap.Point(dotList[i].lng, dotList[i].lat); var mk = new BMap.Marker(pt, {icon: dotIcon}); // 瀹氫箟marker鐐� - // 鍒犻櫎鎸囧畾鐨勭偣(璇ョ偣浼氬湪鏈嚱鏁板悗闈㈤噸鏂板垱寤�) deletePoint(map, dotList[i].title); @@ -1695,14 +1699,16 @@ mkList.push(mk); // 鍚戝湴鍥炬坊鍔犺鐩栫墿 - map.addOverlay(mk); + if(isShow) { + map.addOverlay(mk); + } } } // 鍒犻櫎鍦板浘涓婄殑鎸囧畾鐐� function deletePoint(map, msg){ var allOverlay = map.getOverlays(); - for (var i = 0; i < allOverlay.length -1; i++){ + for (var i = 0; i < allOverlay.length; i++){ try{ if(allOverlay[i].getLabel().content == msg){ map.removeOverlay(allOverlay[i]); @@ -1715,6 +1721,37 @@ } } + // 鑾峰彇鍦板浘闇�瑕佹樉绀哄浘鏍囩殑绫诲瀷 + var magImgStyles = []; + + function setMapImgStyles() { + var ipts = $('#mapImgDesc .explain-list input'); + magImgStyles = []; + ipts.each(function(i) { + var imgStyle = $(this).data('img'); + if($(this).is(':checked')) { + magImgStyles.push(imgStyle); + } + }); + + magImgStyles.push(''); + // 鏍规嵁褰撳墠鍐呭鏇存柊鍦板浘鍥炬爣 + // map.clearOverlays(); + searchStation(); + } + + // 妫�娴嬪綋鍓嶅浘鏍囨槸鍚︾鍚� + function checkMapImgStyle(imgStyle) { + var isShow = false; + for(var i=0; i<magImgStyles.length; i++) { + if(magImgStyles[i] == imgStyle) { + isShow = true; + break; + } + } + + return isShow; + } // 鍒涘缓鍛婅鐐� function createWarnDot(map, warnDotList) { for(var i = 0; i < warnDotList.length; i++) { @@ -2045,6 +2082,16 @@ // 鏍规嵁鍙鑼冨洿鏄剧ず鍧愭爣鐐� var dots = []; var currMarkers = {}; + + // 鍒濆鍖� + function init() { + dots = []; + currMarkers = {}; + } + // init鍑芥暟缁戝畾鍒癎LOBAL.BMap涓� + gl.BMap.init = init; + + // 鏌ヨ褰撳墠鑼冨洿鍐呭鐨勫浘鏍� function queryInRect(map, callback) { var cp = map.getBounds(); // 杩斿洖map鍙鍖哄煙锛屼互鍦扮悊鍧愭爣琛ㄧず @@ -2170,16 +2217,15 @@ pageNum: 0, pageNew: true }; + //鏌ヨ鏈烘埧 function searchStation(setRect){ var temp = createSearchParam(); var json = JSON.stringify(temp); var bmap = GLOBAL.BMap; // BMap鐨勫懡鍚嶇┖闂� - var bmap_s = bmap.Search; // Search鐨勫懡鍚嶇┖闂� - commonDot = new Array(); - warnDotList = new Array(); - dischargeDotList = []; - behindCellList = []; + var init = bmap.init; + //init(); + // 鏌ヨ鍚庡彴 $.ajax({ type: "post", //url: "BattMap_informationAction!searchAll", @@ -2198,21 +2244,22 @@ // 璁剧疆鍒嗛〉淇℃伅 mapPages.pageAll = list.length; setMapPages(); - + //console.log(123); // 閬嶅巻鏌ヨ缁撴灉 for(var i=0;i<list.length;i++){ var _list = list[i]; allStation.push(formatAllStation(_list)); } - // 鏄剧ず鍖哄煙鐨勫浘鏍� bmap.setDots(allStation); bmap.queryInRect(map, createMapDot); + updateStation(); + // 鏄惁绗竴娆℃墽琛� if(setRect) { map.addEventListener("moveend", bmap.queryInRect.bind({},map, createMapDot)); // 鎷栧姩 map.addEventListener("zoomend", bmap.queryInRect.bind({},map, createMapDot)); // 缂╂斁 - updateStation(); + } } } @@ -2265,9 +2312,7 @@ } } - //console.log(updateStationData); createMapDot(map, updateStationData, true); - // 鏇存柊鍒嗛〉淇℃伅 mapPages.pageCurr++; if(mapPages.pageCurr>mapPages.pageNum || updateStationData.length<mapPages.pageSize) { @@ -2276,6 +2321,7 @@ } setTimeout(updateStation, 4000); + } }); } @@ -2296,6 +2342,19 @@ return obj; } + // 鏍规嵁allStation鐨勫�煎幓鏇存柊鍐呭 + function updateMapByAllStation() { + var bmap = GLOBAL.BMap; // BMap鐨勫懡鍚嶇┖闂� + var init = bmap.init; // 鍒濆鍖栧唴瀹� + + // 鍒濆鍖栧湴鍥惧唴瀹� + init(); + + // 鏄剧ず鍖哄煙鐨勫浘鏍� + bmap.setDots(allStation); + bmap.queryInRect(map, createMapDot); + } + // 鏌ヨ鏈烘埧闈㈡澘淇℃伅 function searchPanelInfo(data) { var point = data.point; -- Gitblit v1.9.1