<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
%>
|
<%@ taglib uri="/struts-tags" prefix="s"%>
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<!-- 默认使用最高内核 -->
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
|
<base href="<%=basePath%>">
|
<title><s:text name="Device_status_records_query"/></title> <!-- 设备状态记录查询 -->
|
<link rel="stylesheet" href="css/basic.css">
|
<link rel="stylesheet" type="text/css" href="css/nocontent.css">
|
<link rel="stylesheet" type="text/css" href="css/loading.css">
|
<link rel="stylesheet" type="text/css" href="css/basic-layout.css"/>
|
<link rel="stylesheet" href="css/sidebar.css" />
|
</head>
|
|
<body>
|
<!--头部内容开始-->
|
<jsp:include page="Top.jsp" flush="true"/>
|
<!--头部内容结束-->
|
<!--导航开始-->
|
<jsp:include page="nav.jsp" flush="true"/>
|
<div class="page-content">
|
<div class="content-item side-bar-container">
|
<div class="lside"></div>
|
</div>
|
<div class="content-item data-show">
|
<div class="data-container">
|
<!-- 筛选条件 -->
|
<div class="filter-container">
|
<div class="filter-title"><a href="javascript:changeFilterStats();"><s:text name="Device_status_records_query"/>--><s:text name="Show/hide_the_query_conditions"/></a></div> <!-- 显示或隐藏查询条件 -->
|
<div class="filter-content">
|
<table>
|
<tbody>
|
<tr>
|
<th style="width: 30%">状态切换原因</th>
|
<th colspan="2">查询时间段</th>
|
<th rowspan="2" style="width: 20%">
|
<div style="position: relative">
|
<div id="radio">
|
<input type="radio" id="tblRadio" name="radio" checked><label for="tblRadio">数据表格</label>
|
<input type="radio" id="graphRadio" name="radio" disabled><label for="graphRadio">分布图</label>
|
</div>
|
</div>
|
</th>
|
</tr>
|
<tr>
|
<td>
|
<select name="" id="statsList">
|
<option value="-1">全部</option>
|
<option value="0">手动停止</option>
|
<option value="1">放电时间到</option>
|
<option value="2">放电容量到</option>
|
<option value="3">单体下限到</option>
|
<option value="4">组端下限到</option>
|
<option value="5">市电中断</option>
|
<option value="6">内存不足</option>
|
<option value="7">温度异常</option>
|
</select>
|
</td>
|
<td><input type="text" id="record_start_time" value="2012-12-01" readonly="readonly"/></td>
|
<td><input type="text" id="record_end_time" value="2018-03-24" readonly="readonly"/></td>
|
</tr>
|
</tbody>
|
</table>
|
</div>
|
</div>
|
<!-- 数据表格显示 -->
|
<div class="tbl-header"></div>
|
<div class="tbl-body"></div>
|
<!-- 用于导出表格的功能 -->
|
<form id="export_excel" action="ExportTable.servlet" method="post">
|
<input type="hidden" name="PageName" value="equip-stats-change.jsp"/>
|
<input type="hidden" id="table_th_arr" name="table_th_arr"/>
|
<input type="hidden" id="table_td_arr" name="table_td_arr"/>
|
</form>
|
<div class="data-footer">
|
<!-- 分页内容 -->
|
<div id="paging">
|
<a href="javascript:" class="search"><s:text name="Search"/></a> <!-- 查询 -->
|
<a href="javascript:" id="export_table"><s:text name="Export"/></a> <!-- 导出 -->
|
<span id="current">1/1</span>
|
<span><s:text name="Each_page"/><!-- 每页 --><input type="text" id="number" value="10"/><s:text name="Item"/><!-- 条 --></span>
|
<s:text name="Total_data"/><!-- 数据总量 --><span id="total">0</span>
|
<a href="javascript:" id="home"><s:text name="HomePage"/><!-- 首页 --></a>
|
<a href="javascript:" id="pre"><s:text name="Page_Up"/><!-- 上一页 --></a>
|
<a href="javascript:" id="next_p"><s:text name="Page_Down"/><!-- 下一页 --></a>
|
<a href="javascript:" id="last"><s:text name="End_Page"/><!-- 尾页 --></a>
|
<span id="cont">
|
<s:text name="Goto"/><!-- 转到 --><input type="text" id="page_num" value="1"/>
|
<a href="javascript:" id="go"><s:text name="Jump"/><!-- 跳转 --></a>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script type="text/javascript" src="jqueryui/jquery-ui.min.js"></script>
|
<script type="text/javascript" src="js/equip-stats-change.jquery.ui.js"></script>
|
<script type="text/javascript" src="js/basic-layout.js"></script>
|
<script type="text/javascript" src="js/sidebar.js"></script>
|
<script type="text/javascript" src="js/pageUtil.js"></script>
|
<script type="text/javascript">
|
var arrTh = [];
|
var arrTd = [];
|
var Page = {
|
pageCurr:1,
|
pageSize:10,
|
pageAll:0
|
};
|
/* 左侧导航点击事件 需要引入sidebar.js */
|
$(function () {
|
//二级左菜单的显示和隐藏
|
$('.lside').on('click','.fir', function(){
|
// 判断是否是第一次生成内容
|
if ($(this).next().length == 0) {
|
searchAllStationByProvince($(this).attr('name'));
|
//createLsideSec(secObj, $(this).attr('name'));
|
}else {
|
//修复二级为空时的bug
|
for(var i=0;i<$(this).next().children().length;i++)
|
{
|
if($(this).next().children().eq(i).children().eq(0).text()=='')
|
{
|
$(this).next().children().eq(i).children().eq(0).remove();
|
$(this).next().children().eq(i).children().eq(0).next().slideToggle();
|
}
|
}
|
$(this).next().slideToggle(function() {
|
changeFirImg($(this));
|
});
|
}
|
});
|
|
// 三级菜单背景色改变
|
$('.lside').on('click', '.thr', function(){
|
$('.lside .thr').removeClass('active');
|
$('.lside .fir').removeClass('active');
|
$('.lside .sec').removeClass('active');
|
$(this).addClass("active");
|
// 下方添加点击三级菜单触发事件
|
searchDevHistoryRecord();
|
});
|
|
//三级左菜单的显示和隐藏
|
$('.lside').on('click', '.sec', function(){
|
$('.lside .thr').removeClass('active');
|
$('.lside .fir').removeClass('active');
|
$('.lside .sec').removeClass('active');
|
$(this).addClass("active");
|
$(this).next().slideToggle();
|
});
|
});
|
|
|
// 生成页面中的表格
|
$(function () {
|
arrTh = ['设备Id', '机房名称', '变迁前状态', '变迁后状态', '变迁原因', '变迁时间'];
|
createFullTbl($('.tbl-header'), $('.tbl-body'), arrTh, arrTd);
|
var stop_types = [
|
'手动停止', '暂停', '正在放电测试', '正在等待放电', '正在限流放电',
|
'正在直流充电', '正在等待充电', '放电时间到', '放电容量到', '单体下限到',
|
'组端下限到', '市电中断停止', '存储数据满', '机内温度异常', '放电电流过流',
|
'后台通信中断', '负载模块中断', '在线模块中断', '负载模块过功率', '内部程序异常'
|
];
|
createSel($('#statsList'), stop_types);
|
|
// 切换下拉选项更改表格内容
|
$('#statsList').on('change', function() {
|
searchDevHistoryRecord();
|
});
|
|
// 查询时间段改变
|
$('#record_start_time').on('change', function() {
|
searchDevHistoryRecord();
|
});
|
$('#record_stop_time').on('change', function() {
|
searchDevHistoryRecord();
|
});
|
/**
|
* 生成下拉框
|
*@param jquery ele 下拉元素
|
*@param array dataList 数据列表
|
*/
|
function createSel(ele, dataList) {
|
ele.text(" ");
|
|
var $opt = '<option value="-1">全部</option>';
|
|
// 遍历dataList向ele添加更多的选项
|
for(var i=0; i<dataList.length; i++) {
|
$opt += '<option value="'+i+'">'+dataList[i]+'</option>';
|
}
|
ele.html($opt);
|
}
|
});
|
|
// 生成左侧导航
|
$(function(){
|
searchAllProvince();
|
});
|
|
/**
|
* 生成左侧一级导航
|
* @param array mList 一级导航的数据机房名称,机房ID
|
* [{StationName:string,StationId:string}...]
|
*/
|
function createLsideFir(contain,mList){
|
// 清除contain的内容
|
contain.text('');
|
var _ul = $('<ul></ul>');
|
// 遍历mList根据其数据生成页面中的内容
|
for (var i = 0; i < mList.length; i++) {
|
var _li = $('<li></li>');
|
var _a = $('<a href="javascript:;" class="fir" name="'+mList[i].StationName1+'"><strong class="arrow down"></strong><span></span>'+mList[i].StationName1+'</a>');
|
_li.append(_a);
|
_ul.append(_li);
|
}
|
|
contain.append(_ul);
|
}
|
|
/**
|
* 生成左侧二级导航
|
* @param array mList 一级导航的数据机房名称,机房ID
|
* [{StationName:string,StationId:string,BattGroupId:string,BattGroupName:string}...]
|
*/
|
function createLsideSec(mList, stationName){
|
// 根据_stationId的值确定要生成二级导航的位置
|
var _fir = $('.lside .fir');
|
|
_fir.each(function() {
|
if($(this).attr('name') == stationName) {
|
$(this).next('ul').remove();
|
$(this).children('strong.arrow').removeClass('down').addClass('up');
|
|
var _ul = $('<ul style="display:block"></ul>');
|
var _li = $('<li></li>');
|
var _a = $('<a href="javascript:;" class="sec" id="'+mList[0].FBSDeviceId+'" value="'+mList[0].StationName+'" style="display:none"></a>');
|
_li.append(_a);
|
var __ul = $('<ul style="display: block"></ul>');
|
var tagStr = "";
|
// 遍历mList生成第二级内容
|
for(var _i = 0; _i < mList.length; _i++) {
|
tagStr += '<li><a href="javascript:;" class="thr" id="'+mList[_i].FBSDeviceId+'">'+mList[_i].StationName+'</a></li>';
|
}
|
var __li = $(tagStr);
|
__ul.append(__li);
|
_li.append(__ul);
|
_ul.append(_li);
|
$(this).after(_ul);
|
}
|
});
|
}
|
|
/**
|
* 展开左边导航的第一个
|
*/
|
function slideFirstSideBar(mList, stationname) {
|
createLsideSec(mList, stationname);
|
$('.lside').find('.fir').eq(0).next().find('.thr').eq(0).addClass('active');
|
}
|
|
//查询所有的维护区
|
function searchAllProvince(){
|
$.ajax({
|
type:"post",
|
//url: "BattInfAction!serchByStation", //查询所有的维护区
|
url: "User_battgroup_baojigroup_battgroupAction!serchStationName1InGroup", //查询当前用户管理的维护区
|
async:true,
|
dataType:'text',
|
data:null,
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
if(model.code == 1){
|
//console.info('****');
|
//console.info(model);
|
var arr = new Array();
|
for(var i=0;i<model.data.length;i++){
|
arr.push({
|
StationName1:model.data[i]
|
});
|
}
|
createLsideFir($('.lside'), arr);
|
searchAllStationByProvinceFir(arr[0].StationName1);
|
}else{
|
noContent.showNoContent("暂无管理的维护区");
|
}
|
}
|
});
|
}
|
|
//根据维护区查询所有的机房
|
function searchAllStationByProvince(stationname){
|
addLoadingToMenu(stationname);
|
$.ajax({
|
type:"post",
|
//url: "BattInfAction!serchByStationName",
|
url: "User_battgroup_baojigroup_battgroupAction!serchStationInfoByStationName1",
|
async:true,
|
dataType:'text',
|
//data:"bif.StationName1="+stationname,
|
data:"json="+JSON.stringify({UNote:stationname}),
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
//console.info(model);
|
removeLoadingMenu(stationname); // 移除数据加载等待
|
if(model.code == 1){
|
createLsideSec(model.data, stationname);
|
}else{
|
|
}
|
}
|
});
|
}
|
|
// 第一次生成左侧导航
|
function searchAllStationByProvinceFir(stationname) {
|
addLoadingToMenu(stationname);
|
$.ajax({
|
type:"post",
|
//url: "BattInfAction!serchByStationName",
|
url: "User_battgroup_baojigroup_battgroupAction!serchStationInfoByStationName1",
|
async:true,
|
dataType:'text',
|
//data:"bif.StationName1="+stationname,
|
data:"json="+JSON.stringify({UNote:stationname}),
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
removeLoadingMenu(stationname); // 移除数据加载等待
|
if(model.code == 1){
|
//console.info(model.data);
|
slideFirstSideBar(model.data, stationname);
|
searchDevHistoryRecord();
|
}else{
|
|
}
|
}
|
});
|
}
|
|
//根据维护区查询所有的机房
|
function searchDevHistoryRecord(){
|
arrTd = new Array();
|
loading.showLoading($('.tbl-body'));
|
$.ajax({
|
type:"post",
|
url: "Fbsdev_Statechange_infAction!serchByCondition",
|
async:true,
|
dataType:'text',
|
data:"json="+JSON.stringify(createSearchParam()),
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
//console.info(model);
|
if(model.code == 1){
|
for(var i=0;i<model.data.length;i++){
|
arrTd.push(model.data[i].dev_id); //设备id
|
arrTd.push(model.data[i].note); //机房名称
|
arrTd.push(model.data[i].last_stat_name); //变换前状态
|
arrTd.push(model.data[i].now_stat_name); //变化后状态
|
arrTd.push(model.data[i].state_change_reason_name); //变换原因
|
arrTd.push(model.data[i].rec_time); //变换时间
|
|
if(model.data[i].page != undefined){
|
Page.pageAll = model.data[i].page.pageAll; //总记录条数
|
}
|
}
|
}else{
|
noContent.showNoContent("未查询到状态变换记录");
|
Page.pageAll = 0;
|
}
|
$('#total').text(Page.pageAll);
|
var pageNum = Math.ceil(Page.pageAll/Page.pageSize);
|
$('#current').text(Page.pageCurr+"/"+pageNum);
|
|
loading.hideLoading($('.tbl-body'));
|
createFullTbl($('.tbl-header'), $('.tbl-body'), arrTh, arrTd);
|
}
|
});
|
}
|
|
/**
|
** 构造查询 条件
|
*/
|
function createSearchParam(){
|
var temp ={
|
state_change_reason: -1,
|
dev_id:"910000012", //设备id
|
rec_time:$('#record_start_time').val()+" 00:00:00", //设备id
|
rec_time1:$('#record_end_time').val()+" 23:59:59", //设备id
|
page:Page,
|
};
|
temp.dev_id = $('.lside .thr.active').attr('id');
|
temp.state_change_reason = $('#statsList').val();
|
return temp;
|
}
|
|
$(function(){
|
$('#paging .search').click(function (){
|
searchDevHistoryRecord();
|
});
|
|
//点击首页
|
$('#home').click(function(){
|
GotoFirstPage(Page,searchDevHistoryRecord);
|
});
|
|
//点击上一页
|
$('#pre').click(function(){
|
GotoPrePage(Page,searchDevHistoryRecord);
|
});
|
|
//点击下一页
|
$('#next_p').click(function(){
|
GotoNextPage(Page,searchDevHistoryRecord);
|
});
|
|
//点击尾页
|
$('#last').click(function(){
|
GotoLastPage(Page,searchDevHistoryRecord);
|
});
|
|
//设置每页大小数
|
$('#number').blur(function(){
|
var pageSize = $(this).val();
|
if(pageSize>0){
|
Page.pageSize = parseInt(pageSize);
|
}else{
|
$(this).val(Page.pageSize);
|
}
|
});
|
|
//设置跳转到的页数
|
$('#page_num').blur(function(){
|
var pageCurr = $(this).val();
|
if(pageCurr>0){
|
Page.pageCurr = parseInt(pageCurr);
|
}else{
|
$(this).val(Page.pageCurr);
|
}
|
});
|
|
//点击跳转
|
$('#go').click(function(){
|
GotoAppointPage($('#page_num'),Page,searchDevHistoryRecord);
|
});
|
});
|
|
//点击导出按钮 $('.tbl-header'), $('.tbl-body')
|
$('#export_table').click(function(){
|
console.info($('#tbHead .tbFixed thead th').length);
|
exprotTable($('.tbl-body th'),$('.tbl-body tbody td'),$('#export_excel'),$('#table_th_arr'),$('#table_td_arr'));
|
});
|
|
function exprotTable(eleTh,eleTd,eleform,eleTh_Text,eleTd_Text){
|
//alert("导出");
|
var ArrTh=new Array();
|
for(var i=0;i<eleTh.length;i++)
|
{
|
ArrTh[i]=eleTh.eq(i).text();
|
}
|
var ArrTd="";
|
for(var i=0;i<eleTd.length;i++)
|
{
|
ArrTd+=eleTd.eq(i).text()+"&";
|
}
|
eleTh_Text.attr('value',ArrTh);
|
eleTd_Text.attr('value',ArrTd);
|
//console.info(ArrTh);
|
//console.info(ArrTd);
|
eleform.submit();
|
}
|
</script>
|
</body>
|
</html>
|