From c09814ee3fa3dbd47d221d229fcdfc796314f7e8 Mon Sep 17 00:00:00 2001 From: LiJun <LiJun@192.168.10.10> Date: 星期一, 22 十月 2018 14:32:22 +0800 Subject: [PATCH] 机房停电数显示基站状态中处于停电状态的机房数目,并且点击之后进入到所有基站状态查询页面 --- gx_tieta/WebRoot/index.jsp | 191 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 152 insertions(+), 39 deletions(-) diff --git a/gx_tieta/WebRoot/index.jsp b/gx_tieta/WebRoot/index.jsp index 27666f9..2ed62dc 100644 --- a/gx_tieta/WebRoot/index.jsp +++ b/gx_tieta/WebRoot/index.jsp @@ -75,6 +75,12 @@ .ui-resizable-s, .ui-resizable-se { display: none !important; } + + .ui-autocomplete { + height: 200px; + overflow-y: auto; + overflow-x: hidden; + } </style> <script type="text/javascript" src="js/jquery-1.8.3.js"></script> @@ -1333,15 +1339,6 @@ }); }); - // 鐐瑰嚮鍦板浘鐨勬悳绱㈡寜閽畾浣嶅湴鍧� - $(function() { - $('#map').on('click', '.search .search-btn', function() { - var posTxt = $('#map .search .pos-txt').val(); - addrAnalyze(posTxt); - }); - }); - - $(window).resize(function() { getMapHt(); }); @@ -1586,11 +1583,11 @@ // 閬嶅巻鏌ヨ鍐呭鐢熸垚瀵瑰簲鐨勫浘鏍� for(var i = 0; i < dotList.length; i++) { - var dotIcon = new BMap.Icon(getMapStateImg(mapImages, dotList[0].msg), new BMap.Size(36, 30)); // 璁剧疆鍥剧墖 + 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鐐� - addMenu(mk, mapDel); + // addMenu(mk, mapDel); deletePoint(map, dotList[i].title); // 鍚憁k鐐规坊鍔爈abel var home_name = new BMap.Label(dotList[i].title, {offset:new BMap.Size(20,-10)}); @@ -1605,20 +1602,15 @@ this.getLabel().setStyle({display: 'none'}); }); - mk.addEventListener('click', function(e) { + /* mk.addEventListener('click', function(e) { var target = e.target; showMapPanel(target, dotList); - }); + }); */ mkList.push(mk); // 鍚戝湴鍥炬坊鍔犺鐩栫墿 map.addOverlay(mk); } } - - - - - // // 鍒犻櫎鍦板浘涓婄殑鎸囧畾鐐� function deletePoint(map, msg){ @@ -1740,6 +1732,7 @@ function showMapPanel(target, warnList) { var point = target.point; + console.log(target.getLabel()); var searchInforWin = null; for(var i = 0; i < warnList.length; i++) { if(warnList[i].lng == point.lng && warnList[i].lat == point.lat) { @@ -1995,7 +1988,7 @@ var dot = dots[i]; var lat = dot.lat; var lng = dot.lng; - var sId = dot.binformation.StationId; + var sId = dot.sId; var isExist = checkMarker(sId); // 鏈娣诲姞杩� @@ -2035,12 +2028,54 @@ gl.BMap.queryInRect = queryInRect; })(jQuery, window, document, GLOBAL); - searchStation(true); - var allStation; + + // 鍦板浘鏈烘埧鎼滅储妯″潡 + ;(function($, window, document, gl, undefined) { + // 璁剧疆鍛藉悕绌洪棿BMap.Search妯″潡 + gl.namespace('BMap.Search'); + + var homeInfor = []; + + // 璁剧疆homeInfor鐨勫�� + function setHomeInfor(data) { + homeInfor = data; + } + // 灏嗗嚱鏁扮粦瀹氬埌鍛藉悕绌洪棿涓� + gl.BMap.Search.setHomeInfor = setHomeInfor; + + // 鏍规嵁homeInfor鐨勫�艰繑鍥瀐ome鍒楄〃 + function getHomeList() { + var rs = []; + // 閬嶅巻homeInfor鐨勫�� + for(var i=0; i<homeInfor.length; i++) { + rs.push(homeInfor[i].title); + } + return rs; + } + // 灏嗗嚱鏁扮粦瀹氬埌鍛藉悕绌洪棿涓� + gl.BMap.Search.getHomeList = getHomeList; + })(jQuery, window, document, GLOBAL); + + // 鏌ヨ骞惰缃満鎴跨殑鍥炬爣 + $(function () { + searchStation(true); + }); + + + var allStation = []; + var mapPages = { + pageSize:2, // 姣忛〉鐨勮鏁� + pageCurr:1, // 褰撳墠椤电爜鏁� + pageAll:1, // 鏁扮洰 + 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 = []; @@ -2054,35 +2089,105 @@ data:"json="+json, success: function(data){ data = eval('('+data+')'); - var list = eval('('+data.result+')'); - console.log(list.length); + // 鑾峰彇缁撴灉闆� + var rs = JSON.parse(data.result); + var list = rs.data; + // console.log(list); allStation = new Array(); if(list!=undefined && list.length>0){ + // 璁剧疆鍒嗛〉淇℃伅 + mapPages.pageAll = list.length; + setMapPages(); + console.info(mapPages); + // 閬嶅巻鏌ヨ缁撴灉 for(var i=0;i<list.length;i++){ - var tmp = { - binformation:list[i].data, - alarm_num:list[i].code, //鍛婅鏁扮洰 - low_num:list[i].sum, //钀藉悗鏁扮洰 - delay_num:list[i].newsum, //寤舵椂鏁扮洰 - msg: list[i].msg - }; - allStation.push(analyzeData(tmp)); + var _list = list[i]; + allStation.push(formatAllStation(_list)); } + // 鏄剧ず鍖哄煙鐨勫浘鏍� - GLOBAL.BMap.setDots(allStation); - GLOBAL.BMap.queryInRect(map,createMapDot); - // 鏄惁璁剧疆鎷栧埌鍜岀缉鏀� + bmap.setDots(allStation); + bmap.queryInRect(map,createMapDot); + // 鏄惁绗竴娆℃墽琛� if(setRect) { - map.addEventListener("moveend", GLOBAL.BMap.queryInRect.bind({},map, createMapDot)); // 鎷栧姩 - map.addEventListener("zoomend", GLOBAL.BMap.queryInRect.bind({},map, createMapDot)); // 缂╂斁 + map.addEventListener("moveend", bmap.queryInRect.bind({},map, createMapDot)); // 鎷栧姩 + map.addEventListener("zoomend", bmap.queryInRect.bind({},map, createMapDot)); // 缂╂斁 + updateStation(); } - - //createMapDot(map, allStation); - } } }); } + + // 鏍煎紡鍖栨煡璇㈢粨鏋� + function formatAllStation(list) { + var obj = new Object(); + // 鏋勯�犵粨鏋滈泦 + obj.lng = list.longitude; + obj.lat = list.latitude; + obj.title = list.StationName; + obj.sId = list.StationId; + obj.fbsId = list.FBSDeviceId; + obj.addr = list.Address; + obj.msg = ""; + return obj; + } + + // 璁剧疆鍒嗛〉鐨勪俊鎭� + function setMapPages() { + var pageNum = Math.ceil(mapPages.pageAll/mapPages.pageSize); + mapPages.pageNum = pageNum; + } + + // 杞鏇存柊鍦板浘鐨勭偣鏌ヨ + function updateStation() { + var updateStationData = []; + $.ajax({ + type: "post", + url: "BattMap_informationAction!searchUserManageStation2", + async: true, + dataType:'json', + data: "json="+JSON.stringify(mapPages), + success: function(result) { + var data = JSON.parse(result.result); + for(var i=0; i<data.length; i++) { + var _data = data[i]; + updateStationData.push(formatUpdateStation(_data)); + + // 鍒ゆ柇鏄惁鏇存柊 + } + + createMapDot(map, updateStationData); + + // 鏇存柊鍒嗛〉淇℃伅 + mapPages.pageCurr++; + if(mapPages.pageCurr>mapPages.pageNum) { + mapPages.pageCurr=1; + mapPages.pageNew=false; + } + + setTimeout(updateStation, 4000); + } + }); + } + + // 鏍煎紡鍖栨煡璇㈢粨鏋� + function formatUpdateStation(list) { + var obj = {}; + var data = list.data; + // 鏋勯�犵粨鏋滈泦 + obj.lng = data.longitude; + obj.lat = data.latitude; + obj.title = data.StationName; + obj.sId = data.StationId; + obj.fbsId = data.FBSDeviceId; + obj.addr = data.Address; + obj.msg = list.msg; + return obj; + } + + // 鏇存柊鎵�鏈夋満鎴� + function setAllStation(obj,allstation){ //console.info(allstation); @@ -3115,5 +3220,13 @@ img.attr('src', navImg); } } + + // 鐐瑰嚮鍦板浘鐨勬悳绱㈡寜閽畾浣嶅湴鍧� + $(function() { + $('#map').on('click', '.search .search-btn', function() { + var posTxt = $('#map .search .pos-txt').val(); + addrAnalyze(posTxt); + }); + }); </script> </html> -- Gitblit v1.9.1