| | |
| | |
|
| | | <title><s:text name="HomePage"></s:text></title>
|
| | | <meta name="renderer" content="webkit">
|
| | | <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
| | | <!-- 导入百度地图API -->
|
| | | <link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
|
| | | <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=QAerSFEiGDCx1oHPB7Z5XYcBHI6R3qwx"></script>
|
| | | <script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
|
| | | <link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
|
| | | <script type="text/javascript" src="js/AreaRestriction_min.js"></script>
|
| | | <link href="css/basic.css" type="text/css" rel="stylesheet" />
|
| | | <link href="css/common.css" type="text/css" rel="stylesheet" />
|
| | | <link href="css/index_layout.css" type="text/css" rel="stylesheet" />
|
| | | <link rel="stylesheet" href="css/img-change.css">
|
| | | <link rel="stylesheet" href="css/confirm.css">
|
| | | <link rel="stylesheet" href="css/loading.css">
|
| | | <link rel="stylesheet" href="src/css/layui.css">
|
| | | <link rel="stylesheet" href="pages/css/mylayui.css">
|
| | | <style type="text/css">
|
| | | #map .explain-header:hover {
|
| | | .explain-header:hover {
|
| | | cursor: pointer;
|
| | | background-color: #84ABFA !important;
|
| | | color: #D6D1D1
|
| | |
| | | overflow-y: auto;
|
| | | overflow-x: hidden;
|
| | | }
|
| | | .BMapLib_bubble_content a {
|
| | | color: #2A3AF0;
|
| | | }
|
| | | .BMapLib_bubble_content a:hover {
|
| | | text-decoration: underline;
|
| | | }
|
| | | body .layui-layer-dialog {
|
| | | min-width:400px;
|
| | | }
|
| | | </style>
|
| | | <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
|
| | | |
| | | <script type="text/javascript" src="js/echarts.js"></script>
|
| | | <script type="text/javascript" src="js/createTab.js"></script>
|
| | |
|
| | |
| | | <jsp:include page="nav.jsp" flush="true"/>
|
| | | <!--导航结束-->
|
| | | <div id="content">
|
| | | |
| | | <div class="nav-map small">
|
| | | <!-- 地图内容筛选 -->
|
| | | <div class="map-info-panel-left">
|
| | | <div class="map-info-panel-content">
|
| | | <div class="map-info">
|
| | | <span>限制显示区域: </span><span class="k-point red" id="mapVsArea">中国</span>
|
| | | <span class="mr5">机房显示类型:</span><span class="k-point red" id="mapIconStyle">全部</span>
|
| | | <span class="map-info-btn-icon" id="showMapInfoDetail" title="详情"><i class="fa fa-angle-double-down"></i></span>
|
| | | </div>
|
| | | <div class="map-info-detail">
|
| | | <table>
|
| | | <tbody>
|
| | | <tr>
|
| | | <td class="w8em alg-c">限制显示区域:</td>
|
| | | <td>
|
| | | <select name="mapVsAreaSel" id="mapVsAreaSel">
|
| | | <option>中国</option>
|
| | | <option>中国-广西</option>
|
| | | </select>
|
| | | </td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td class="w8em alg-c">机房显示类型:</td>
|
| | | <td>
|
| | | <select name="mapIconStyleSel" id="mapIconStyleSel">
|
| | | <option>全部</option>
|
| | | </select>
|
| | | </td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | <div class="map-info-footer alg-r">
|
| | | <button type="button" class="mr10 map-panel-hide" value="确定" id="mapPanelEn">确定</button>
|
| | | <button type="button" class="mr10 map-panel-hide" value="隐藏">隐藏</button>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <!-- 电池分布图 -->
|
| | | <div class="china-map" id="map">
|
| | | <div class="img-change" style="display:none;">
|
| | |
| | |
|
| | | <!-- 电池故障与电池告警饼状图 -->
|
| | | <div class="pie-con">
|
| | |
|
| | | <div class="pie-conf">
|
| | | <a href="javascript:;" class="pie-btn" id="faCog" title="图表配置">
|
| | | <i class="fa fa-cog"></i>
|
| | | </a>
|
| | | </div>
|
| | | <!-- 电池故障饼状图 -->
|
| | | <div class="brdn-pie module"></div>
|
| | | <!-- 电池告警饼状图 -->
|
| | |
| | | <script type="text/javascript" src="pages/js/base.js"></script>
|
| | | <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>
|
| | | <script type="text/javascript" src="js/createMap.js"></script>
|
| | | <script type="text/javascript" src="js/myConfirm.js"></script>
|
| | | <script type="text/javascript" src="js/loading.js"></script>
|
| | | <script type="text/javascript" src="src/layui.js"></script>
|
| | | <script type="text/javascript">
|
| | | var permits;
|
| | | <% Object obj=session.getAttribute("permits");
|
| | |
| | | var search;
|
| | | var warnOpts;
|
| | | //console.info(BMap);
|
| | | var mapDefults = new Image().src = 'image/mapDefault.gif';
|
| | | var mapImages = getMapImageUrl();
|
| | | // 定义省-市资源内容
|
| | | var area = [
|
| | |
| | | });
|
| | |
|
| | | $(function() { // 显示和隐藏图标说明
|
| | | $('#map').on('click', '.explain-header', function() {
|
| | | $('#map .explain-list').fadeToggle();
|
| | | $('.nav-map').on('click', '.explain-header', function() {
|
| | | $('.explain-list').fadeToggle();
|
| | | });
|
| | |
|
| | | $('#map').on('dblclick', '.explain-header', function() {
|
| | | return false;
|
| | | });
|
| | | |
| | | $('.nav-map').on('click', '.explain-list input', function() {
|
| | | setMapImgStyles();
|
| | | });
|
| | | });
|
| | |
|
| | |
| | | centerMapByPoint(map); // 根据当前用户设定的位置显示中心点
|
| | | map.enableScrollWheelZoom();
|
| | | map.disableDoubleClickZoom();
|
| | | map.setMapStyle({style: 'grayscale'}); // 设置地图的风格
|
| | | //map.setMapStyle({style: 'grayscale'}); // 设置地图的风格
|
| | | // 添加地图类型控件
|
| | | map.addControl(new BMap.MapTypeControl());
|
| | | // 给地图添加工具条(地图-卫星-三维)和比例尺控件
|
| | |
| | | var menu = new BMap.ContextMenu();
|
| | | var txtMenuItem = [
|
| | | {
|
| | | text: '设置中心点',
|
| | | callback: function(e) {
|
| | | myConfirm.show({
|
| | | title: '设置地图默认显示位置',
|
| | | content: '是否确认修改地图默认中心坐标',
|
| | | enfun:updateMapCenterPoint,
|
| | | enparams:[e]
|
| | | });
|
| | | }
|
| | | },
|
| | | {
|
| | | text: '搜索地址',
|
| | | callback: function(e) {
|
| | | search.showSearch();
|
| | |
| | | smallMap();
|
| | | }
|
| | | },
|
| | | |
| | | {
|
| | | text: '设置中心点',
|
| | | callback: function(e) {
|
| | | myConfirm.show({
|
| | | title: '设置地图默认显示位置',
|
| | | content: '是否确认修改地图默认中心坐标',
|
| | | enfun:updateMapCenterPoint,
|
| | | enparams:[e]
|
| | | });
|
| | | text: '返回中心点',
|
| | | callback: function(e){
|
| | | centerMapByPoint(map); // 根据当前用户设定的位置显示中心点
|
| | | }
|
| | | }
|
| | | ];
|
| | |
| | | });
|
| | |
|
| | | $(window).resize(function() {
|
| | | console.log(123);
|
| | | getMapHt();
|
| | | });
|
| | | // 改变div的大小
|
| | |
| | |
|
| | | changeMapImgDesc(iconExplain, 'normal');
|
| | |
|
| | | mapEle.prepend(iconExplain);
|
| | | mapEle.parent().append(iconExplain);
|
| | | |
| | | // 设置地图图标种类
|
| | | setMapImgStyles();
|
| | | }
|
| | | |
| | | // 切换地图图标说明
|
| | | function changeMapImgDesc(iconExplain, type) {
|
| | | iconExplain.find('.explain-list').remove();
|
| | |
| | | function mapImgDescNormal(iconExplain) {
|
| | | // 机房落后
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.behind+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">电池组落后机房</span>');
|
| | | iconList.append(icon);
|
| | | var input = $('<input type="checkbox" data-img="item-behind" checked="checked">');
|
| | | var icon = $('<img src="'+mapImages.behind+'">');
|
| | | var span = $('<span>电池组落后机房</span>');
|
| | | iconList.append(input);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | |
|
| | | // 机房告警
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.warn+'" style="float:left;">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">电池组告警机房</span>');
|
| | | iconList.append(icon);
|
| | | var input = $('<input type="checkbox" data-img="item-warn" checked="checked">');
|
| | | var icon = $('<img src="'+mapImages.warn+'">');
|
| | | var span = $('<span>电池组告警机房</span>');
|
| | | iconList.append(input);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconList.append('<div class="clear"></div>');
|
| | | iconExplain.append(iconList);
|
| | |
|
| | | // 机房延时
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.timeout+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">电池组放电延时机房</span>');
|
| | | iconList.append(icon);
|
| | | var input = $('<input type="checkbox" data-img="item-timeout" checked="checked">');
|
| | | var icon = $('<img src="'+mapImages.timeout+'">');
|
| | | var span = $('<span>电池组放电延时机房</span>');
|
| | | iconList.append(input);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | |
|
| | | // 正常机房
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.normal+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">正常机房</span>');
|
| | | iconList.append(icon);
|
| | | var input = $('<input type="checkbox" data-img="item-normal" checked="checked">');
|
| | | var icon = $('<img src="'+mapImages.normal+'">');
|
| | | var span = $('<span>正常机房</span>');
|
| | | iconList.append(input);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | | }
|
| | |
|
| | |
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.nuclear+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">核容/停电放电</span>');
|
| | | iconList.append(icon);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | |
|
| | | // 告警
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.devalarm+'" style="float:left;">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">61850设备告警</span>');
|
| | | iconList.append(icon);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconList.append('<div class="clear"></div>');
|
| | | iconExplain.append(iconList);
|
| | |
|
| | |
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.precharge+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">61850预充电</span>');
|
| | | iconList.append(icon);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | |
|
| | | // 在线浮充
|
| | | var iconList = $('<div class="explain-list" style="padding: 4px 6px; border-bottom: 1px slid #ccc; display:block"></div>');
|
| | | var icon = $('<img src="'+mapImages.float+'" style="float:left">');
|
| | | var span = $('<span style="line-height: 30px; text-align:center; margin-left: 4px">61850在线浮充</span>');
|
| | | iconList.append(icon);
|
| | | iconList.append(span);
|
| | | iconList.append(icon);
|
| | | iconExplain.append(iconList);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 生成地图图标
|
| | | function createMapDot(map, dotList) {
|
| | | 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点
|
| | | addMenu(mk, mapDel);
|
| | | // 删除指定的点(该点会在本函数后面重新创建)
|
| | | deletePoint(map, dotList[i].title);
|
| | | |
| | | // 给点右键菜单添加删除按钮
|
| | | addMenu(mk, mapDel);
|
| | | |
| | | // 向mk点添加label
|
| | | var home_name = new BMap.Label(dotList[i].title, {offset:new BMap.Size(20,-10)});
|
| | | home_name.setStyle({display: 'none', padding: '4px 2px'});
|
| | |
| | |
|
| | | mk.addEventListener('click', function(e) {
|
| | | var target = e.target;
|
| | | showMapPanel(target, dotList);
|
| | | //showMapPanel(target, dotList);
|
| | | searchPanelInfo(target);
|
| | | });
|
| | | |
| | | if(isTop) {
|
| | | mk.setTop(true);
|
| | | }
|
| | | |
| | | 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 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) {
|
| | |
| | | function showMapPanelByPoint(point, dataList) {
|
| | | var searchInforWin = null;
|
| | | var opts = {
|
| | | //title : warnList[i].title+'<a href="javascript:loadToHomeInfo();" style="margin-left: 1em;text-decoration:none">详情>></a>', //标题
|
| | | title : dataList.title+'<a href="javascript:loadToHomeInfo();" style="margin-left: 1em;text-decoration:none;cursor:not-allowed">详情>></a>', //标题未开启
|
| | | width : '290', //宽度
|
| | | height : 140, //高度
|
| | | height : 160, //高度
|
| | | panel : "panel", //检索结果面板
|
| | | enableAutoPan : true, //自动平移
|
| | | enableSendToPhone:false,
|
| | |
| | | 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可视区域,以地理坐标表示
|
| | |
| | | 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);
|
| | |
|
| | | // 未被添加过
|
| | |
| | | function setDots(data) {
|
| | | dots = data;
|
| | | }
|
| | | |
| | | // 将变量绑定到命名空间下
|
| | | gl.BMap.setDots = setDots;
|
| | | |
| | | // 更新dots集合的数据
|
| | | function updateDots(data) {
|
| | | for(var i=0; i<dots.length; i++) {
|
| | | var _dots = dots[i];
|
| | | if(_dots.sId == data.sId) {
|
| | | _dots.msg = data.msg;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | // 将变量绑定到命名空间下
|
| | | gl.BMap.updateDots = updateDots;
|
| | |
|
| | | // 将函数绑定到命名空间下
|
| | | gl.BMap.queryInRect = queryInRect;
|
| | |
| | | });
|
| | |
|
| | |
|
| | | var allStation;
|
| | | var allStation = [];
|
| | | var mapPages = {
|
| | | pageSize:50, // 每页的行数
|
| | | 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 = [];
|
| | | behindCellList = [];
|
| | | var init = bmap.init;
|
| | | //init();
|
| | | // 查询后台
|
| | | $.ajax({
|
| | | type: "post",
|
| | | //url: "BattMap_informationAction!searchAll",
|
| | |
| | | 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.log(123);
|
| | | // 遍历查询结果
|
| | | 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));
|
| | | }
|
| | | // 显示区域的图标
|
| | | bmap.setDots(allStation);
|
| | | bmap.queryInRect(map,createMapDot);
|
| | | // 是否设置拖到和缩放
|
| | | bmap.queryInRect(map, createMapDot);
|
| | | updateStation();
|
| | | |
| | | // 是否第一次执行
|
| | | if(setRect) {
|
| | | map.addEventListener("moveend", bmap.queryInRect.bind({},map, createMapDot)); // 拖动
|
| | | map.addEventListener("zoomend", bmap.queryInRect.bind({},map, createMapDot)); // 缩放
|
| | | |
| | | }
|
| | | |
| | | //createMapDot(map, allStation);
|
| | | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | // 格式化查询结果
|
| | | function formatAllStation(list) {
|
| | | var obj = new Object();
|
| | | // GPS坐标转化为百度坐标
|
| | | var point = GPS.wgs2bd(list.latitude, list.longitude);
|
| | | // 构造结果集
|
| | | obj.lng = point.lon;
|
| | | obj.lat = point.lat;
|
| | | obj.title = list.StationName;
|
| | | obj.sId = list.StationId;
|
| | | obj.fbsId = list.FBSDeviceId;
|
| | | obj.addr = list.Address;
|
| | | obj.msg = "";
|
| | | obj.num = list.num;
|
| | | return obj;
|
| | | }
|
| | | |
| | | // 设置分页的信息
|
| | | function setMapPages() {
|
| | | var pageNum = Math.ceil(mapPages.pageAll/mapPages.pageSize);
|
| | | mapPages.pageNum = pageNum;
|
| | | mapPages.pageNew= true;
|
| | | }
|
| | | |
| | | // 轮询更新地图的点查询
|
| | | function updateStation() {
|
| | | var bmap = GLOBAL.BMap; // BMap的命名空间
|
| | | 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);
|
| | | //console.log(data);
|
| | | for(var i=0; i<data.length; i++) {
|
| | | var _data = data[i];
|
| | | var _list = formatUpdateStation(_data);
|
| | | updateStationData.push(_list);
|
| | | //_list.msg = 'item-nuclear_cap';
|
| | | // 判断是否更新
|
| | | if(mapPages.pageNew) {
|
| | | bmap.updateDots(_list);
|
| | | }
|
| | | }
|
| | | |
| | | createMapDot(map, updateStationData, true);
|
| | | // 更新分页信息
|
| | | mapPages.pageCurr++;
|
| | | if(mapPages.pageCurr>mapPages.pageNum || updateStationData.length<mapPages.pageSize) {
|
| | | mapPages.pageCurr=1;
|
| | | mapPages.pageNew=false;
|
| | | }
|
| | | |
| | | 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 = point.lon;
|
| | | obj.lat = point.lat;
|
| | | obj.title = data.StationName;
|
| | | obj.sId = data.StationId;
|
| | | obj.fbsId = data.FBSDeviceId;
|
| | | obj.addr = data.Address;
|
| | | 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);
|
| | | }
|
| | | |
| | | // 查询机房面板信息
|
| | | function searchPanelInfo(data) {
|
| | | var point = data.point;
|
| | | var stationInfo = getStaionByPoint(point);
|
| | | if(!stationInfo) {
|
| | | alert('面板信息查询失败!');
|
| | | return;
|
| | | }
|
| | | var temp = {
|
| | | StationId: stationInfo.sId
|
| | | };
|
| | | // 查询面板信息
|
| | | $.ajax({
|
| | | type: 'post',
|
| | | async: true,
|
| | | url: 'BattMap_informationAction!searchUserManageStation3',
|
| | | data: 'json='+JSON.stringify(temp),
|
| | | dataType: 'json',
|
| | | success: function(result) {
|
| | | var rs = JSON.parse(result.result);
|
| | | if(rs.length != 0) {
|
| | | var data = rs[0];
|
| | | //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>'+
|
| | | '<div style="padding:6px"><a href="javascript:loadToRealTime();">实时数据</a><a style="margin-left: 20px" href="javascript:loadToOldTime();">历史数据</a></div>'+
|
| | | '<div style="padding:6px;"><span>地址:</span>'+data.data.Address+'</div>'+
|
| | | '<input type="hidden" class="ipt-hide home" value="'+data.data.StationName+'">'+
|
| | | '<input type="hidden" class="ipt-hide province" value="'+data.data.stationName1+'">'+
|
| | | '<input type="hidden" class="ipt-hide city" value="'+data.data.stationName2+'">';
|
| | | |
| | | var list = {
|
| | | title: data.data.StationName,
|
| | | content: content
|
| | | };
|
| | | |
| | | showMapPanelByPoint(point, list);
|
| | | }
|
| | | |
| | | }
|
| | | }); |
| | | }
|
| | | |
| | | |
| | | // 根据经纬度获取机房的信息
|
| | | function getStaionByPoint(point) {
|
| | | var stationInfo = false;
|
| | | // 遍历所有机房
|
| | | for(var i=0; i<allStation.length; i++) {
|
| | | var info = allStation[i];
|
| | | if(info.lng == point.lng && info.lat == point.lat) {
|
| | | stationInfo = info;
|
| | | }
|
| | | }
|
| | | return stationInfo;
|
| | | }
|
| | | function setAllStation(obj,allstation){
|
| | | //console.info(allstation);
|
| | | var flag = false;
|
| | | var index = 0;
|
| | | for(var i = 0;i < allstation.length;i++){
|
| | | for(var i = 0;i < allStation.length;i++){
|
| | | //console.info(obj.binformation.num + "==" + allstation[i].binformation.num);
|
| | | if(obj.binformation.num == allstation[i].binformation.num){
|
| | | flag = true;
|
| | |
| | | }
|
| | | // 定位到实时数据页面
|
| | | function loadToRealTime() {
|
| | | var battgroupId = $('.ipt-hide').eq(0).val();
|
| | | var homeId = $('.ipt-hide').eq(1).val();
|
| | | window.open('control.jsp?battgroupId='+battgroupId+'&stationId='+homeId);
|
| | | var home = $('.ipt-hide.home').val();
|
| | | var province = $('.ipt-hide.province').val();
|
| | | var city = $('.ipt-hide.city').val();
|
| | | window.open('control.jsp?province='+province+'&city='+city+'&home='+home);
|
| | | }
|
| | |
|
| | | // 定位到历史数据页面
|
| | | function loadToOldTime() {
|
| | | var battgroupId = $('.ipt-hide').eq(0).val();
|
| | | var homeId = $('.ipt-hide').eq(1).val();
|
| | | window.open('charge-test.jsp?battgroupId='+battgroupId+'&stationId='+homeId);
|
| | | var home = $('.ipt-hide.home').val();
|
| | | var province = $('.ipt-hide.province').val();
|
| | | var city = $('.ipt-hide.city').val();
|
| | | window.open('charge-test.jsp?province='+province+'&city='+city+'&home='+home);
|
| | | }
|
| | |
|
| | | //定位到告警页面
|
| | |
| | | text: '删除',
|
| | | callback: function(e) {
|
| | | //console.info(allStation);
|
| | | console.info(mk);
|
| | | console.info(allStation);
|
| | | var temp = getStationMap(allStation, mk.point);
|
| | | if(confirm("确认从地图上删除'"+temp.StationName+"'的位置信息吗?")){
|
| | | if(confirm("确认从地图上删除'"+temp.title+"'的位置信息吗?")){
|
| | | if(temp != undefined){
|
| | | //console.info(temp);
|
| | | var json = JSON.stringify(temp);
|
| | | $.ajax({
|
| | | type: "post",
|
| | |
| | | function getStationMap(list,localposi){
|
| | | if(list != undefined){
|
| | | for(var i = 0 ; i < list.length ; i++){
|
| | | if(list[i].binformation.latitude == localposi.lat && list[i].binformation.longitude == localposi.lng){
|
| | | return list[i].binformation;
|
| | | if(list[i].lat == localposi.lat && list[i].lng == localposi.lng){
|
| | | return list[i];
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | rs.devalarm = "User_ChartAction!serchByInfo?json={Chart_file:'"+user_logo+"',Chart_name:chart_dev_alarm}"; // 设备告警
|
| | | rs.precharge = "User_ChartAction!serchByInfo?json={Chart_file:'"+user_logo+"',Chart_name:chart_pre_charge}"; // 预充电
|
| | | rs.float = "User_ChartAction!serchByInfo?json={Chart_file:'"+user_logo+"',Chart_name:chart_online_charge}"; // 浮充
|
| | | rs.defaults = mapDefults;
|
| | | return rs;
|
| | | }
|
| | | /* $(function(){
|
| | |
| | | function getMapStateImg(imgs, cla) {
|
| | | var rs = imgs.normal;
|
| | | switch(cla) {
|
| | | case 'item-normal':
|
| | | rs = imgs.normal;
|
| | | break
|
| | | case 'item-warn': // 告警
|
| | | rs = imgs.warn;
|
| | | break;
|
| | |
| | | break;
|
| | | case 'item-pre_charge': // 61850预充电
|
| | | rs = imgs.precharge;
|
| | | break;
|
| | | default:
|
| | | rs = imgs.defaults;
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | addrAnalyze(posTxt);
|
| | | });
|
| | | });
|
| | | |
| | | layui.use(['form', 'layer', 'laytpl'], function() {
|
| | | var form = layui.form;
|
| | | var layer = layui.layer; |
| | | var laytpl = layui.laytpl;
|
| | | |
| | | // 点击饼状图配置
|
| | | $('#faCog').click(function() {
|
| | | searchUserBieState(); // 查询当前饼状图的配置状态
|
| | | });
|
| | | |
| | | var layerMsg;
|
| | | |
| | | // 点击配置项复选框
|
| | | $('body').on('click', '#tplTblOpts .tpl-tbl-opts-header input[type=checkbox]', function(event) {
|
| | | layer.close(layerMsg);
|
| | | var iptList = $('#tplTblOpts .tpl-tbl-opts-header input[type=checkbox]');
|
| | | var num = 0;
|
| | | iptList.each(function() {
|
| | | if($(this).is(':checked')) {
|
| | | num++;
|
| | | }
|
| | | });
|
| | | if(num>4) {
|
| | | layerMsg = layer.msg("最多选择四个!", {
|
| | | type: 1
|
| | | });
|
| | | $(this).prop('checked', false);
|
| | | }
|
| | | |
| | | });
|
| | | |
| | | |
| | | var pie = GLOBAL.Index.Pie;
|
| | | var pieType = pie.pieType;
|
| | | var pieConfTpl = getTpl('iframe/pie-config.html');
|
| | | //查询当前用户设置饼状图的使能状态
|
| | | function searchUserBieState(){
|
| | | $.ajax({ |
| | | type:"post", |
| | | url: "Echarts_usrAction!serchByCondition", |
| | | async:true, |
| | | dataType:'json',
|
| | | data:null, |
| | | success: function(data){ |
| | | var model = eval('('+data.result+')');
|
| | | if(model.code == 1) {
|
| | | var result = model.data;
|
| | | var formatData = formatPieRsData(result[0]);
|
| | | laytpl(pieConfTpl).render(formatData, function(html) {
|
| | | layer.open({
|
| | | id: 'pie',
|
| | | title: '饼状图配置',
|
| | | maxHeight: 450,
|
| | | content: html,
|
| | | yes: function(index) {
|
| | | var iptList = $('#tplTblOpts .tpl-tbl-opts-header input[type=checkbox]');
|
| | | var iptArr = [];
|
| | | iptList.each(function() {
|
| | | if($(this).is(':checked')) {
|
| | | iptArr.push(1);
|
| | | }else {
|
| | | iptArr.push(0);
|
| | | }
|
| | | });
|
| | | |
| | | var temp = structUpdatePie(iptArr);
|
| | | layer.load();
|
| | | updateUserBieState(temp);
|
| | | }
|
| | | });
|
| | | });
|
| | | }
|
| | | |
| | | } |
| | | });
|
| | | }
|
| | | |
| | | // 格式化查询结果
|
| | | function formatPieRsData(result) {
|
| | | var data={};
|
| | | data.tblData=[];
|
| | | // 遍历pieType的类型
|
| | | for(var i=0; i<pieType.length; i++) {
|
| | | var tmp = {};
|
| | | var num = i+1;
|
| | | var key = 'echarts'+num+'_enable';
|
| | | tmp.name = pieType[i].name;
|
| | | tmp.status = result[key];
|
| | | data.tblData.push(tmp);
|
| | | }
|
| | | |
| | | return data;
|
| | | }
|
| | | |
| | | |
| | | // 构造更新饼状图参数
|
| | | function structUpdatePie(arr) {
|
| | | var rs = {
|
| | | echarts1_enable:0,
|
| | | echarts2_enable:0,
|
| | | echarts3_enable:0,
|
| | | echarts4_enable:0,
|
| | | echarts5_enable:0,
|
| | | echarts6_enable:0,
|
| | | echarts7_enable:0,
|
| | | echarts8_enable:0,
|
| | | echarts9_enable:0,
|
| | | echarts10_enable:0
|
| | | };
|
| | | |
| | | // 遍历arr给rs值重定义
|
| | | for(var i=0; i<arr.length; i++) {
|
| | | var num = i+1;
|
| | | var key = 'echarts'+num+'_enable';
|
| | | rs[key] = arr[i];
|
| | | }
|
| | | |
| | | return rs; |
| | | }
|
| | | |
| | | // 更新当前用户设置饼状图的使能状态
|
| | | function updateUserBieState(temp, dialog, load){
|
| | | // 更新后台数据
|
| | | $.ajax({ |
| | | type:"post", |
| | | url: "Echarts_usrAction!add", |
| | | async:true, |
| | | dataType:'json',
|
| | | data:'json='+JSON.stringify(temp), |
| | | success: function(data){ |
| | | layer.closeAll();
|
| | | |
| | | var model = eval('('+data.result+')');
|
| | | if(model.code == 1) {
|
| | | layer.msg('配置成功!!!');
|
| | | }else {
|
| | | layer.msg('配置失败!!!');
|
| | | }
|
| | | } |
| | | });
|
| | | }
|
| | | |
| | | // 地图左上方面板模块
|
| | | var mapViewArea = GLOBAL.BMap.mapViewArea; // 地图显示区域的信息
|
| | | // 点击面板上方的小图标显示设定信息
|
| | | $('#showMapInfoDetail').click(function() {
|
| | | $('.map-info-detail').slideToggle();
|
| | | });
|
| | | |
| | | // 点击隐藏
|
| | | $('.map-info-detail .map-panel-hide').click(function() {
|
| | | $('.map-info-detail').slideUp();
|
| | | });
|
| | | |
| | | // 遍历mapViewArea获取mapVsAreaSel下拉框的值
|
| | | var mapVsAreaSel = $('#mapVsAreaSel');
|
| | | var mapVsAreaSelOpts = [];
|
| | | for(var i=0; i<mapViewArea.length; i++) {
|
| | | var _data = mapViewArea[i];
|
| | | var tmp = getOptionsData(_data.name, _data.area, _data);
|
| | | mapVsAreaSelOpts.push(tmp);
|
| | | }
|
| | | // 生成面板中的mapVsAreaSel
|
| | | createOptions(mapVsAreaSel, mapVsAreaSelOpts);
|
| | | // 显示默认区域-中国
|
| | | setMapViewArea(mapViewArea[0]);
|
| | | centerMapByPoint(map); // 根据当前用户设定的位置显示中心点
|
| | | // 点击面板确定按钮
|
| | | $('#mapPanelEn').click(function() {
|
| | | var areaData = mapVsAreaSel.find('option:selected').data('attr');
|
| | | |
| | | // 设置头部可视区域的文本
|
| | | $('#mapVsArea').text(areaData.name);
|
| | | |
| | | // 设置可视区域
|
| | | setMapViewArea(areaData);
|
| | | });
|
| | | |
| | | // 设置地图的可视区域
|
| | | function setMapViewArea(data) {
|
| | | var left = new BMap.Point(data.left.lng, data.left.lat);
|
| | | var right = new BMap.Point(data.right.lng, data.right.lat);
|
| | | var b = new BMap.Bounds(left, right);
|
| | | |
| | | var cLng = (data.left.lng+data.right.lng)/2;
|
| | | var cLat = (data.left.lat+data.right.lat)/2;
|
| | | var f = new BMap.Point(cLng, cLat);
|
| | | map.panTo(f, {
|
| | | noAnimation: "no"
|
| | | });
|
| | | |
| | | |
| | | try {
|
| | | BMapLib.AreaRestriction.setBounds(map, b);
|
| | | } catch (e) {
|
| | | alert(e);
|
| | | }
|
| | | }
|
| | | });
|
| | | </script>
|
| | | </html>
|