| | |
| | | <td>
|
| | | <select name="mapIconStyleSel" id="mapIconStyleSel">
|
| | | <option>全部</option>
|
| | | <option>已安装</option>
|
| | | <option>未安装</option>
|
| | | </select>
|
| | | </td>
|
| | | </tr>
|
| | |
| | | <script type="text/javascript" src="pages/js/common.js"></script>
|
| | | <script type="text/javascript" src="pages/js/pages/siderbar.js"></script>
|
| | | <script type="text/javascript" src="pages/js/pages/index-common.js"></script>
|
| | | <script type="text/javascript" src="pages/js/GPS.js"></script>
|
| | | <script type="text/javascript" src="js/panel.js"></script>
|
| | | <script type="text/javascript" src="js/search.js"></script>
|
| | | <script type="text/javascript" src="js/changePinYin.js"></script>
|
| | |
| | |
|
| | | $('#map').on('dblclick', '.explain-header', function() {
|
| | | return false;
|
| | | });
|
| | | |
| | | $('.nav-map').on('click', '.explain-list input', function() {
|
| | | setMapImgStyles();
|
| | | });
|
| | | });
|
| | |
|
| | |
| | |
|
| | | mapEle.parent().append(iconExplain);
|
| | |
|
| | | |
| | | // 设置地图图标种类
|
| | | setMapImgStyles();
|
| | | }
|
| | | // 切换地图图标说明
|
| | | function changeMapImgDesc(iconExplain, type) {
|
| | |
| | | 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);
|
| | |
| | |
|
| | | // 机房告警
|
| | | 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);
|
| | |
| | |
|
| | | // 机房延时
|
| | | 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);
|
| | |
| | |
|
| | | // 正常机房
|
| | | 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>正常机房</span>');
|
| | | iconList.append(input);
|
| | |
| | | function createMapDot(map, dotList, isTop) {
|
| | | // 清空覆盖物和对应的mk点
|
| | | 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);
|
| | |
|
| | |
| | |
|
| | | 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]);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // 获取地图需要显示图标的类型
|
| | | 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('');
|
| | | // 根据当前内容更新地图图标
|
| | | 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++) {
|
| | |
| | | function getAddHomeInfo() {
|
| | | var lng = $('.add-panel .lng').text(); // 获取经度
|
| | | var lat = $('.add-panel .lat').text(); // 获取纬度
|
| | | var wgsPoint = GPS.bd2wgs(lat, lng); // 百度地图坐标转化为GPS
|
| | | |
| | | var addr = $('.add-panel .addr').text(); // 获取地址
|
| | | var homeName = $('.add-panel select option:selected').text(); // 机房名称
|
| | | var homeId = $('.add-panel select option:selected').val(); // 机房ID
|
| | |
| | | StationId:homeId, //机房编号
|
| | | StationName:homeName, //机房名称
|
| | | Address:addr, //机房物理信息
|
| | | longitude:lng, // 经度
|
| | | latitude:lat, // 纬度
|
| | | longitude: wgsPoint.lon, // 经度
|
| | | latitude: wgsPoint.lat, // 纬度
|
| | | information:"", //备注
|
| | | };
|
| | | var json = JSON.stringify(temp);
|
| | |
| | | // 根据可视范围显示坐标点
|
| | | var dots = [];
|
| | | var currMarkers = {};
|
| | | |
| | | // 初始化
|
| | | function init() {
|
| | | dots = [];
|
| | | currMarkers = {};
|
| | | }
|
| | | // init函数绑定到GLOBAL.BMap下
|
| | | gl.BMap.init = init;
|
| | | |
| | | |
| | | // 查询当前范围内容的图标
|
| | | function queryInRect(map, callback) {
|
| | | var cp = map.getBounds(); // 返回map可视区域,以地理坐标表示
|
| | |
| | | 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",
|
| | |
| | | // 设置分页信息
|
| | | 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();
|
| | | |
| | | }
|
| | | }
|
| | | }
|
| | |
| | | // 格式化查询结果
|
| | | function formatAllStation(list) {
|
| | | var obj = new Object();
|
| | | // GPS坐标转化为百度坐标
|
| | | var point = GPS.wgs2bd(list.latitude, list.longitude);
|
| | | // 构造结果集
|
| | | obj.lng = list.longitude;
|
| | | obj.lat = list.latitude;
|
| | | obj.lng = point.lon;
|
| | | obj.lat = point.lat;
|
| | | obj.title = list.StationName;
|
| | | obj.sId = list.StationId;
|
| | | obj.fbsId = list.FBSDeviceId;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //console.log(updateStationData);
|
| | | createMapDot(map, updateStationData, true);
|
| | | |
| | | // 更新分页信息
|
| | | mapPages.pageCurr++;
|
| | | if(mapPages.pageCurr>mapPages.pageNum || updateStationData.length<mapPages.pageSize) {
|
| | |
| | | }
|
| | |
|
| | | 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.lng = data.longitude;
|
| | | obj.lat = data.latitude;
|
| | | obj.lng = point.lon;
|
| | | obj.lat = point.lat;
|
| | | obj.title = data.StationName;
|
| | | obj.sId = data.StationId;
|
| | | obj.fbsId = data.FBSDeviceId;
|
| | |
| | | obj.msg = list.msg;
|
| | | obj.num = list.num;
|
| | | return obj;
|
| | | }
|
| | | |
| | | // 根据allStation的值去更新内容
|
| | | function updateMapByAllStation() {
|
| | | var bmap = GLOBAL.BMap; // BMap的命名空间
|
| | | var init = bmap.init; // 初始化内容
|
| | | |
| | | // 初始化地图内容
|
| | | init();
|
| | | |
| | | // 显示区域的图标
|
| | | bmap.setDots(allStation);
|
| | | bmap.queryInRect(map, createMapDot);
|
| | | }
|
| | |
|
| | | // 查询机房面板信息
|
| | |
| | | var rs = JSON.parse(result.result);
|
| | | if(rs.length != 0) {
|
| | | var data = rs[0];
|
| | | console.info(data);
|
| | | //console.info(data);
|
| | | var content = '<div style="padding:6px;"><span>蓄电池组告警数目:</span>'+data.code+'<a style="margin-left: 14px" href="javascript:loadToWarnPage();">详情>></a></div>'+
|
| | | '<div style="padding:6px;"><span>蓄电池组落后数目:</span>'+data.sum+'<a style="margin-left: 14px" href="javascript:loadToBehindPage();">详情>></a></div>'+
|
| | | '<div style="padding:6px;"><span>蓄电池组延时数目:</span>'+data.newsum+'<a style="margin-left: 14px" href="javascript:loadToDischargeDelay();">详情>></a></div>'+
|