| | |
| | | <table>
|
| | | <tbody>
|
| | | <tr>
|
| | | <td class="alg-c f-bold"><span class="mrl8">机房类型:</span></td>
|
| | | <td colspan="2" id="homeType">
|
| | | <span class="mrl8 mrr8"><input type="checkbox" value="2" checked="checked">2V</span>
|
| | | <span><input type="checkbox" checked="checked" value="12">12V</span>
|
| | | </td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td class="w5em alg-c f-bold"><span class="mrl8">机房名称:</span></td>
|
| | | <td><input type="text" id="mapToolSearch"></td>
|
| | | <td class="w54 btn-container">
|
| | |
| | |
|
| | | $('.nav-map').on('click', '.explain-list input', function() {
|
| | | setMapImgStyles();
|
| | | updateStation(true);
|
| | | });
|
| | | });
|
| | |
|
| | |
| | |
|
| | | // 更新地图图标
|
| | | function updateMapDotIcon(map, dotList, isTop) {
|
| | | var homeType = getHomeType();
|
| | | // 遍历查询内容生成对应的图标
|
| | | for(var i = 0; i<dotList.length; i++) {
|
| | | var isAcType = checkHomeType(dotList[i].type, homeType);
|
| | | var isShow = checkMapImgStyle(dotList[i].msg);
|
| | | var dotIcon = new BMap.Icon(getMapStateImg(mapImages, dotList[i].msg), new BMap.Size(36, 30)); // 设置图片
|
| | | var mk = getMapMarker(map, dotList[i].title);
|
| | |
| | | }
|
| | |
|
| | | // 隐藏marker点
|
| | | isShow?mk.show():mk.hide();
|
| | | isShow&&isAcType?mk.show():mk.hide();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | // 获取结果集
|
| | | var rs = JSON.parse(data.result);
|
| | | var list = rs.data;
|
| | | // console.log(list);
|
| | | //console.log(list);
|
| | | allStation = new Array();
|
| | | if(list!=undefined && list.length>0){
|
| | | // 设置分页信息
|
| | |
| | | // 显示区域的图标
|
| | | bmap.setDots(allStation);
|
| | | bmap.queryInRect(map, createMapDot);
|
| | | updateStation();
|
| | | updateStation(setRect);
|
| | |
|
| | | // 更新小工具搜索机房功能
|
| | | updateSearchSource(allStation);
|
| | |
| | | }
|
| | |
|
| | | // 轮询更新地图的点查询
|
| | | function updateStation() {
|
| | | var updateTimeout;
|
| | | var updateLoad;
|
| | | function updateStation(isLoad) {
|
| | | var bmap = GLOBAL.BMap; // BMap的命名空间
|
| | | var updateStationData = [];
|
| | | |
| | | if(isLoad) {
|
| | | updateLoad = layer.load(1);
|
| | | }
|
| | | |
| | | $.ajax({
|
| | | type: "post",
|
| | | url: "BattMap_informationAction!searchUserManageStation2",
|
| | |
| | | dataType:'json',
|
| | | data: "json="+JSON.stringify(mapPages),
|
| | | success: function(result) {
|
| | | layer.close(updateLoad);
|
| | | var data = JSON.parse(result.result);
|
| | | //console.log(data);
|
| | | for(var i=0; i<data.length; i++) {
|
| | |
| | | bmap.updateDots(_list);
|
| | | }
|
| | | }
|
| | | |
| | | //console.log(updateStationData);
|
| | | updateMapDotIcon(map, updateStationData, true);
|
| | | // 更新分页信息
|
| | | mapPages.pageCurr++;
|
| | |
| | | mapPages.pageCurr=1;
|
| | | mapPages.pageNew=false;
|
| | | }
|
| | | |
| | | setTimeout(updateStation, 4000);
|
| | | // 关闭并添加延时执行
|
| | | clearInterval(updateTimeout);
|
| | | updateTimeout = setTimeout(updateStation, 4000);
|
| | |
|
| | | }
|
| | | });
|
| | |
| | | function formatUpdateStation(list) {
|
| | | var obj = {};
|
| | | var data = list.data;
|
| | | //console.log(list);
|
| | | // GPS坐标转化为百度坐标
|
| | | var point = GPS.wgs2bd(data.latitude, data.longitude);
|
| | | // 构造结果集
|
| | |
| | | obj.fbsId = data.FBSDeviceId;
|
| | | obj.addr = data.Address;
|
| | | obj.msg = list.msg;
|
| | | obj.num = list.num;
|
| | | obj.num = data.num;
|
| | | obj.type = data.monvolstd;
|
| | | return obj;
|
| | | }
|
| | | |
| | | // 根据显示的类型筛选数据
|
| | | |
| | |
|
| | | // 根据allStation的值去更新内容
|
| | | function updateMapByAllStation() {
|
| | |
| | | $( "#mapToolSearch" ).on('input propertychange', function(){
|
| | | $('#mapToolSearchBtn').data('homeInfo', 0);
|
| | | });
|
| | | |
| | | // 定义机房查询信息
|
| | | $( "#mapToolSearch" ).autocomplete({
|
| | | source: [],
|
| | |
| | | $('#mapToolSearchBtn').data('homeInfo', ui.item); // 设置机房信息内容
|
| | | }
|
| | | });
|
| | | |
| | | // 点击机房类型复选框
|
| | | $('#homeType input[type=checkbox]').click(function() {
|
| | | var homeType = getHomeType();
|
| | | updateStation(true);
|
| | | });
|
| | | |
| | |
|
| | | // 点击查看homeInfo的值
|
| | | $('#mapToolSearchBtn').click(function() {
|
| | |
| | | };
|
| | | });
|
| | |
|
| | | // 0=全部不选 14=全部选中 2=选中2V 12=选中12V
|
| | | function getHomeType() {
|
| | | var boxList = $('#homeType input[type=checkbox]')
|
| | | var rs = 0; // 全部
|
| | | |
| | | boxList.each(function() {
|
| | | if($(this).is(':checked')) {
|
| | | rs += Number($(this).val());
|
| | | }
|
| | | });
|
| | | |
| | | return rs;
|
| | | }
|
| | | |
| | | |
| | | // 检测当前机房是否符合2V或12V
|
| | | function checkHomeType(homeType, type) {
|
| | | var rs = false;
|
| | | var _homeType = Number(homeType);
|
| | | if(type == 14 || homeType == type) {
|
| | | rs = true;
|
| | | }
|
| | | |
| | | return rs;
|
| | | }
|
| | | |
| | | // 更新地图工具搜索机房
|
| | | function updateSearchSource(data) {
|
| | | var homeSource = [];
|