From dd3b23f7dd793c2eb1aa971aac76d3740bac7565 Mon Sep 17 00:00:00 2001 From: hdw <496960745@qq.com> Date: 星期五, 28 九月 2018 10:02:20 +0800 Subject: [PATCH] 地图设置 历史数据管理 电池组全部时为0 --- gx_tieta/WebRoot/index.jsp | 114 +++++++++++++++++++++++++++++++++++++++++++++++--------- gx_tieta/WebRoot/dataManage.jsp | 1 2 files changed, 96 insertions(+), 19 deletions(-) diff --git a/gx_tieta/WebRoot/dataManage.jsp b/gx_tieta/WebRoot/dataManage.jsp index 200518c..708cdd1 100644 --- a/gx_tieta/WebRoot/dataManage.jsp +++ b/gx_tieta/WebRoot/dataManage.jsp @@ -742,6 +742,7 @@ // 鏍规嵁鏁版嵁鐢熸垚涓嬫媺鍒楄〃 createOptions($select, optsList, true); + $select.find('option:selected').eq(0).val(0); }else{ $("#battgroup_name").text('').html('<option>鏆傛棤鍙祴钃勭數姹犵粍</option>'); } diff --git a/gx_tieta/WebRoot/index.jsp b/gx_tieta/WebRoot/index.jsp index 99c41b4..27666f9 100644 --- a/gx_tieta/WebRoot/index.jsp +++ b/gx_tieta/WebRoot/index.jsp @@ -597,7 +597,6 @@ flushFourPie(); //鏇存柊鍥涚楗肩姸鍥� }); - // 璁剧疆鍙抽敭鑿滃崟 var menu = new BMap.ContextMenu(); var txtMenuItem = [ @@ -632,17 +631,7 @@ enparams:[e] }); } - }, - /* { - text: '鏈烘埧瀹氫綅', - callback: function(e) { - panel.setPanelLayout(); - panel.showPanel(); - $('#map .panel-mask').bind('click', function() { - panel.hidePanel(); - }); - } - } */ + } ]; //console.info(getPermit('taskchange_edit_permit', permits)+"*******"); if(getPermit('batt_map_edit_permit', permits)) { @@ -1594,6 +1583,7 @@ function createMapDot(map, dotList) { // 娓呯┖瑕嗙洊鐗╁拰瀵瑰簲鐨刴k鐐� mkList = []; + // 閬嶅巻鏌ヨ鍐呭鐢熸垚瀵瑰簲鐨勫浘鏍� for(var i = 0; i < dotList.length; i++) { var dotIcon = new BMap.Icon(getMapStateImg(mapImages, dotList[0].msg), new BMap.Size(36, 30)); // 璁剧疆鍥剧墖 @@ -1624,6 +1614,9 @@ map.addOverlay(mk); } } + + + // @@ -1966,10 +1959,86 @@ } } - searchStation(); + // 璁剧疆椤甸潰涓殑鍙鍖哄煙鍥炬爣 + ;(function($, window, document, gl, undefined) { + // 璁剧疆鍛藉悕绌洪棿 + gl.namespace('BMap'); + // 鏍规嵁鍙鑼冨洿鏄剧ず鍧愭爣鐐� + var dots = []; + var currMarkers = {}; + // 鏌ヨ褰撳墠鑼冨洿鍐呭鐨勫浘鏍� + function queryInRect(map, callback) { + var cp = map.getBounds(); // 杩斿洖map鍙鍖哄煙锛屼互鍦扮悊鍧愭爣琛ㄧず + var sw = cp.getSouthWest(); // 杩斿洖鐭╁舰鍖哄煙鐨勮タ鍗楄 + var ne = cp.getNorthEast(); // 杩斿洖鐭╁舰鍖哄煙鐨勪笢鍖楄 + //var zoom = map.getZoom(); //褰撳墠缂╂斁绾у埆 + //console.log(dots); + var mapDots = getDotsList(sw, ne); + callback(map, mapDots); + } + + // 鑾峰彇dots鐨勯泦鍚� + function getDotsList(sw, ne) { + var rs = []; + swlng=sw.lng, + swlat=sw.lat, + nelng=ne.lng, + nelat=ne.lat; + + var maxLng = sw.lng>ne.lng?sw.lng:ne.lng; + var minLng = sw.lng<ne.lng?sw.lng:ne.lng; + + var maxLat = sw.lat>ne.lat?sw.lat:ne.lat; + var minLat = sw.lat<ne.lat?sw.lat:ne.lat; + + for(var i=0; i<dots.length; i++) { + var dot = dots[i]; + var lat = dot.lat; + var lng = dot.lng; + var sId = dot.binformation.StationId; + var isExist = checkMarker(sId); + + // 鏈娣诲姞杩� + if(!isExist) { + // 鍒ゆ柇缁忕含搴︽槸鍚﹀瓨鍦ㄨ鍖哄煙 + if(lng<maxLng && lng>minLng && lat<maxLat && lat>minLat) { + currMarkers['markers'+sId] = sId; + rs.push(dot); + } + } + } + return rs; + } + + + // 妫�娴嬪綋鍓嶇偣鏄惁宸茬粡琚坊鍔犺繃 + function checkMarker(id) { + var flag = false; + // 閬嶅巻宸茬粡娣诲姞鐨勭偣杩斿洖鏄惁宸茬粡琚坊鍔犺繃 + Object.keys(currMarkers).forEach(function(key) { + if(currMarkers[key] == id) { + flag = true; + } + }); + + return flag; + } + + // 璁剧疆dots闆嗗悎鐨勫�� + function setDots(data) { + dots = data; + } + // 灏嗗彉閲忕粦瀹氬埌鍛藉悕绌洪棿涓� + gl.BMap.setDots = setDots; + + // 灏嗗嚱鏁扮粦瀹氬埌鍛藉悕绌洪棿涓� + gl.BMap.queryInRect = queryInRect; + })(jQuery, window, document, GLOBAL); + + searchStation(true); var allStation; //鏌ヨ鏈烘埧 - function searchStation(){ + function searchStation(setRect){ var temp = createSearchParam(); var json = JSON.stringify(temp); commonDot = new Array(); @@ -1980,7 +2049,7 @@ type: "post", //url: "BattMap_informationAction!searchAll", url: "BattMap_informationAction!searchUserManageStation", - async:true, + async: true, dataType:'text', data:"json="+json, success: function(data){ @@ -1989,7 +2058,7 @@ console.log(list.length); allStation = new Array(); if(list!=undefined && list.length>0){ - for(var i=0;i<10;i++){ + for(var i=0;i<list.length;i++){ var tmp = { binformation:list[i].data, alarm_num:list[i].code, //鍛婅鏁扮洰 @@ -1999,10 +2068,17 @@ }; allStation.push(analyzeData(tmp)); } - //console.info(allStation); - createMapDot(map, allStation); + // 鏄剧ず鍖哄煙鐨勫浘鏍� + GLOBAL.BMap.setDots(allStation); + GLOBAL.BMap.queryInRect(map,createMapDot); + // 鏄惁璁剧疆鎷栧埌鍜岀缉鏀� + if(setRect) { + map.addEventListener("moveend", GLOBAL.BMap.queryInRect.bind({},map, createMapDot)); // 鎷栧姩 + map.addEventListener("zoomend", GLOBAL.BMap.queryInRect.bind({},map, createMapDot)); // 缂╂斁 + } - //setTimeout(searchStation, 4000); + //createMapDot(map, allStation); + } } }); -- Gitblit v1.9.1