<%@ 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="Charge_discharge_data"></s:text>
|
</title>
|
|
<meta http-equiv="pragma" content="no-cache">
|
<meta http-equiv="cache-control" content="no-cache">
|
<meta http-equiv="expires" content="0">
|
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
|
<meta http-equiv="description" content="This is my page">
|
<link href="css/basic.css" type="text/css" rel="stylesheet" />
|
<link href="css/charge_test_style.css" type="text/css" rel="stylesheet" />
|
<link href="css/loading.css" type="text/css" rel="stylesheet" />
|
<link href="jqueryui/jquery-ui.css" type="text/css" rel="stylesheet" />
|
<link href="css/collapse.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="js/echarts2.js"></script>
|
<script type="text/javascript" src="js/frame.js"></script>
|
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
|
|
<script type="text/javascript" src="js/createTab.js"></script>
|
<script type="text/javascript" src="js/right-menu.js"></script>
|
<script type="text/javascript" src="js/Title.js"></script>
|
<script type="text/javascript" src="js/loading.js"></script>
|
<style type="text/css">
|
#allGraph {
|
position: absolute;
|
top: -1000px;
|
left: 0;
|
width: 600px;
|
height: 400px;
|
}
|
.chart-contain {
|
width: 100%;
|
height: 100%;
|
background-color: #FFFFFF;
|
}
|
.chart {
|
width: 100%;
|
height: 100%;
|
}
|
</style>
|
</head>
|
|
<body>
|
<!--头部内容开始-->
|
<jsp:include page="Top.jsp" flush="true"/>
|
<!--头部内容结束-->
|
<!--导航开始-->
|
<jsp:include page="nav.jsp" flush="true"/>
|
<!--导航结束-->
|
<div id="main">
|
<table id="all_content">
|
<tr>
|
<td id="ele_content">
|
<!-- 机房数电池组数 -->
|
<div id="mach_num">
|
<s:text name="Room_num"></s:text>
|
:<span id="room_num"></span>;
|
<s:text name="Batt_group_num"></s:text>
|
:<span id="batt_group_num"></span>
|
</div> <!--电池组菜单栏-->
|
<div id="lside"></div>
|
<div class="batt-listen">
|
<div class="count-num">
|
放电数:<span>0</span>
|
充电数:<span>0</span>
|
</div>
|
<div class="batt-list"></div>
|
</div>
|
</td>
|
<td id="rside">
|
<div id="address_infor"></div>
|
<table id="content">
|
<tr>
|
<td><span><s:text name="Batte_state"></s:text></span>:<input type="text"
|
id="ele_state" readonly="readonly" />
|
</td>
|
<!-- 电池状态 -->
|
<td><span><s:text name="Terminal_vol"></s:text></span>:<span class="vis">隐</span><input
|
type="text" id="ele_tension" readonly="readonly" />
|
</td>
|
<!-- 组端电压 -->
|
<td><span><s:text name="Batt_current"></s:text></span>:<input type="text"
|
id="ele_current" readonly="readonly" />
|
</td>
|
<!-- 电池电流 -->
|
<td><span><s:text name="Test_date"></s:text></span>:<input type="text"
|
id="test_date" readonly="readonly" />
|
</td>
|
<!-- 测试日期 -->
|
</tr>
|
<tr>
|
<td><span><s:text name="Test_timeL"></s:text></span>:<input type="text"
|
id="test_time" readonly="readonly" />
|
</td>
|
<!-- 测试时长 -->
|
<td><span><s:text name="Test_capacity"></s:text></span>:<input
|
type="text" id="test_content" readonly="readonly" />
|
</td>
|
<!-- 测试容量 -->
|
<td><span><s:text name="Residual_capacity"></s:text></span>:<input
|
type="text" id="over_content" readonly="readonly" />
|
</td>
|
<!-- 剩余容量 -->
|
<td><span><s:text name="Endurance"/><s:text name="Time"/></span>:<input type="text"
|
id="reserve_time" readonly="readonly" />
|
</td>
|
<!-- 后备时间 -->
|
</tr>
|
</table>
|
<table>
|
<tr>
|
<td style="width: 300px !important;">
|
<table id="charge_infor" style="width: 300px !important;">
|
<tr>
|
<td id="charge_sec">
|
<select id="charge_select_type">
|
<option value="charge-discharge" selected = "selected" ><s:text name="Charge_discharge_data"/></option> <!-- 充电/放电测试数据 -->
|
<option value="charge"><s:text name="Discharge_data"/></option> <!-- 充电测试数据 -->
|
<option value="discharge"><s:text name="Charge_test_data"/></option> <!-- 放电测试数据 -->
|
<option value="Resistance-conductivity"><s:text name="Conductivity_Resistivity_data"/></option> <!-- 电导电阻数据 -->
|
</select>
|
<div id="charge_sec_infor"></div>
|
</td>
|
</tr>
|
<tr>
|
<td id="charge_thr">
|
<div id="charge_thr_infor">
|
<!-- 真正的头部 -->
|
<table id="charge_thr_th">
|
<thead>
|
<tr>
|
<th style="width:30%;"><s:text name="Number"></s:text>
|
</th>
|
<!-- 编号 -->
|
<th style="width:40%"><s:text name="Voltage"></s:text>(V)</th>
|
<!-- 电压 -->
|
<th style="width:30%"><input type="checkbox">
|
</th>
|
</tr>
|
</thead>
|
<tbody id="t_top">
|
</tbody>
|
</table>
|
<table class="res">
|
<thead>
|
<tr>
|
<th><s:text name="Number"/></th> <!-- 编号 -->
|
<th><s:text name="Voltage"/></th> <!-- 电压 -->
|
<th><s:text name="Temperature"/>(℃)</th> <!-- 温度 -->
|
<th><s:text name="Internal_resistance"/>(mΩ)</th> <!-- 内阻 -->
|
<th><s:text name="Conductance"/></th> <!-- 电导 -->
|
<th><s:text name="Conductivity_percentage"/>(%)</th> <!-- 电导百分比 -->
|
<th><s:text name="Article_connection"/>(mΩ)</th> <!-- 连接条 -->
|
</tr>
|
</thead>
|
<tbody class="t_body">
|
|
</tbody>
|
</table>
|
</div>
|
</td>
|
</tr>
|
</table></td>
|
<td id="r_echarts">
|
<!-- 放大表的容器 -->
|
<div id="big_echarts">
|
<div id="big_echarts_container"></div>
|
</div>
|
<table id="table_echarts">
|
<tr>
|
<td>
|
<div class="graph"><div id="ltop"></div></div>
|
</td>
|
<td>
|
<div class="graph"><div id="lbottom"></div></div>
|
</td>
|
</tr>
|
<tr>
|
<td>
|
<div class="graph"><div id="rtop"></div></div>
|
</td>
|
<td>
|
<div class="graph"><div id="rbottom"></div></div>
|
</td>
|
</tr>
|
</table>
|
|
|
<form action="EchartPictureDowload.servlet" method="post" id="all_picture">
|
<input type="hidden" name="pageName" value="exportTbal" />
|
<input type="hidden" name="ltop_echart" id="ltop_echart" />
|
<input type="hidden" name="rtop_echart" id="rtop_echart" />
|
<input type="hidden" name="lbottom_echart" id="lbottom_echart" />
|
<input type="hidden" name="rbottom_echart" id="rbottom_echart" />
|
<input type="hidden" name="actucap_echart" id="actucap_echart"/>
|
<input type="hidden" name="restcap_echart" id="restcap_echart"/>
|
<input type="hidden" name="capperc_echart" id="capperc_echart"/>
|
<input type="hidden" name="obj-bmd" id="obj-bmd"/>
|
<input type="hidden" name="obj-title" id="obj-title"/>
|
<input type="hidden" name="arr-data" id="arr-data"/>
|
</form>
|
|
|
<form action="EchartPictureDowload.servlet" method="post" id="Big_picture">
|
<input type="hidden" name="pageName" value="charge-test" />
|
<input type="hidden" name="big_pic" id="big_pic" />
|
</form>
|
<div id="charge_bottom">
|
<!-- <div id="slide">
|
<div class="label">2012-12-06 00:00:00</div>
|
</div> -->
|
<div id="slider">
|
<div class="label">2012-12-06 00:00:00</div>
|
</div>
|
</div>
|
</td>
|
</tr>
|
</table>
|
</td>
|
</tr>
|
</table>
|
</div>
|
<!-- 当在图片上右键时 显示菜单-->
|
|
<!-- 鼠标右键菜单显示 -->
|
<div id="right_menu">
|
<ul>
|
<li><a href="javascript:"><s:text name="Check_the_battery_card"></s:text></a></li> <!-- 查看电池组机历卡 -->
|
<li><a href="upload.jsp"><s:text name="Upload_FBO/IDC_data"></s:text></a></li> <!-- 上传'FBO/IDC'数据 -->
|
<li><a href="uploadresis.jsp"><s:text name="Upload_resistance_conductivity_data"></s:text></a></li> <!-- 上传电阻电导数据 -->
|
<li><a href="eleBrdwMaint.jsp"><s:text name="Batt_failure_maintenance_record_query" /></a></li> <!-- 电池故障维护记录查询 -->
|
<li><a href="javascript:targetBattReport();"><s:text name="Battery_statistical_analysis_queries"></s:text></a></li> <!-- 电池统计分析查询-->
|
<!-- <li><a href="eleMonomer.jsp"><s:text name="Batt_statistical_analysis_query"></s:text></a></li> 电池单体统计分析查询 -->
|
<li><a href="javascript:" class="more_menu"><s:text name="Add_battery_test"/><span class="angle">>></span></a> <!-- 添加到蓄电池组放电测试 -->
|
<div class="child_menu">
|
<p><s:text name="Add_switch_check_test"/></p> <!-- 添加到拉闸动环核对性放电测试 -->
|
<p><s:text name="Add_check_test"/></p> <!-- 添加到核对性放电测试 -->
|
<p><s:text name="Add_capacity_test"/></p> <!-- 添加到容量实验放电测试 -->
|
</div>
|
</li>
|
<li><a href="javascript:"><s:text name="Search_engine_or_the_batt_group"></s:text></a></li> <!-- 搜索机房或电池组-->
|
<li><a href="javascript:" id="all_show"><s:text name="Expand_all"></s:text></a></li> <!-- 全部展开 -->
|
<li><a href="javascript:" id="all_hide"><s:text name="Collapse_all"></s:text></a></li> <!-- 全部收缩 -->
|
</ul>
|
</div>
|
<!-- 电池组机历卡详细信息-->
|
<div id="card_infor">
|
<span><s:text name="The_battery_pack_machine_through_the_card"/></span> <!-- 电池组机历卡 -->
|
<table>
|
<tr>
|
<th id="card_infor_left"><s:text name="Parameter_name"/></th> <!-- 参数名称 -->
|
<th><s:text name="Parameter_value"/></th> <!-- 参数值 -->
|
</tr>
|
<tr>
|
<td><s:text name="Computer_room_ID"/></td> <!-- 机房ID -->
|
<td id="StationId"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Computer_name"/></td> <!-- 机房名称 -->
|
<td id="StationName"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Computer_room_IP"/></td> <!-- 机房IP -->
|
<td id="StationIP"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Batt_group"/>ID</td> <!-- 机房ID -->
|
<td id="batt_group_id"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_name"/></td> <!-- 电池组名称 -->
|
<td id="BattGroupName"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_number"/></td> <!-- 电池组序号 -->
|
<td id="BattGroupNum"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_brand"/></td> <!-- 电池品牌 -->
|
<td id="BattProducer"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_model"/></td> <!-- 电池型号 -->
|
<td id="BattModel"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Nominal_capacity"/>(AH)</td> <!-- 标称容量 -->
|
<td id="MonCapStd"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Nomina_voltage_monomer"/>(V)</td> <!-- 标称单体电压 -->
|
<td id="MonVolStd"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Monomer_All"/></td> <!-- 单体数量(节) -->
|
<td id="MonCount"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Put_into_use_time"/>(y-M-d)</td> <!-- 投入使用时间(年-月-日) -->
|
<td id="BattInUseDate"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Guarantee"/><s:text name="Time_limit"/>(<s:text name="Day"/>)</td> <!-- 保修期限(天) -->
|
<td id="BattGuarantDayCount"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_float_charging_valve"/>(A)</td> <!-- 电池浮充电流阀值 -->
|
<td id="BattFloatCurrent"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Battery_voltage_threshold"/>(V)</td> <!-- 电池充电电压阀值 -->
|
<td id="FloatVolLevel"></td>
|
</tr>
|
<tr>
|
<td><s:text name="Head"/></td> <!-- 负责人 -->
|
<td></td>
|
</tr>
|
</table>
|
<input type="button" name="" id="out_card_infor" value="<s:text name='Return'/>">
|
</div>
|
|
<!-- 搜索机房或电池组 -->
|
<div id="search_room">
|
<span><s:text name="Search_engine_or_the_battery_pac"/></span> <!-- 搜索机房或电池组 -->
|
<div id="input_container"><input type="text" name="" id="search_input" placeholder="<s:text name='Please_enter_the_key_words'/>" autocomplete="off" value=""></div>
|
<p><s:text name="Computer_room_or_battery_name"/></p> <!-- 机房或电池组名称 -->
|
<div id="search_info">
|
|
</div>
|
<div class="btn_container">
|
<input type="button" name="" id="en_search" value="<s:text name='Determine'/>">
|
<input type="button" name="" id="out_search" value="<s:text name='Exit'/>">
|
</div>
|
</div>
|
<!-- 整体的遮罩层 -->
|
<div id="allShade"></div>
|
|
<!-- 导出当前图到Excel右键菜单 -->
|
<div id="echarts_menu">
|
<ul class="export-ul">
|
<li><a href="javascript:"><s:text name='Monomer_voltage'/></a></li> <!-- 单体电压 -->
|
<li><a href="javascript:"><s:text name='Monomer'/><s:text name='Actual_capacity'/></a></li> <!-- 单体实际容量 -->
|
<li><a href="javascript:"><s:text name='Monomer'/><s:text name='Residual_capacity'/></a></li> <!-- 单体剩余容量 -->
|
<li><a href="javascript:"><s:text name='Monomer'/><s:text name='Percent_total_capacity'/></a></li> <!-- 单体容量百分比 -->
|
</ul>
|
|
<ul>
|
<li><a href="javascript:" class="export-a"></a></li>
|
<li><a href="javascript:ExportAll()"><s:text name="Export"/><s:text name="Test_data"/><s:text name="Report"/></a></li> <!-- 导出测试数据报表-->
|
</ul>
|
</div>
|
|
<!-- 导出放大之后的图到Excel中 -->
|
<div id="bigecharts_menu">
|
<ul><li><a href="javascript:ExportBigpic()"><s:text name="Export" /><s:text name="Bar_graph" />/<s:text name="Line_graph" /></a></li></ul>
|
</div>
|
|
<div id="bigEchartsCon"></div>
|
<!-- 清除浮动 -->
|
<div class="clear"></div>
|
<div id="allGraph">
|
<div class="chart-contain">
|
<div class="chart"></div>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="jqueryui/jquery-ui.js"></script>
|
<script type="text/javascript" src="js/collapse.js"></script>
|
<script type="text/javascript">
|
var permits;
|
<% Object obj=session.getAttribute("permits");
|
if(obj != null){
|
String permits =obj.toString();%>
|
permits=<%=permits%>;
|
//console.info(json);
|
<% }%>
|
//console.info(permits);
|
var isCanExport = false;
|
|
var BattinfObj;
|
var Battimeinfo; //每个时刻电池的信息
|
var slide_index=0; //滑块停留的位置
|
var battinlist = []; //电池组信息数组
|
var Monnum_list; //声明电池编号数组
|
var Monvol_list; //声明电池电压数组
|
var SlideLength; //滑块距离左端的距离
|
var AllBataDate; //格式化之后的该电池组中所有电池的测试信息
|
var Mon_reacaplist=new Array(); //当前的实际容量数组
|
var Mon_overcaplist=new Array(); //当前的剩余容量数组
|
var Mon_percaplist=new Array(); //当前容量百分比数组
|
|
var BattData; //生成折线图的二维数组
|
var TestTime; //时间数组
|
var BattGroupVol = new Array(); //存放电池组组端电压的数组
|
//var BattOnlineVol; //存放电池组在线电压的数组
|
var BattGroupCurr; //存放电池组电流的数组
|
var AllTestData; //原始的测试数据
|
var thrname; //三张折线图的title
|
var tname; //条形图的title
|
var dbname; //鼠标双击的图名
|
|
var Restitle; //电阻条形图title
|
var Serpercenttitle; //电导百分比折线图title
|
var Montitle; //电压条形图title
|
var Sertitle; //电导条形图title
|
var li_index=0; //用于标记当前选中的是单体电压(0),单体实际容量(1),单体剩余容量(2),单体容量百分比(3)
|
|
var oChargeBtm=document.getElementById("charge_bottom");
|
var Olside = document.getElementById("lside"); //电池组菜单栏
|
|
var allGraph = echarts.init($('#allGraph .chart-contain .chart').get(0));
|
//console.info(allGraph);
|
|
var Ocharge_sec_infor=document.getElementById("charge_sec_infor"); //测试记录显示
|
var lsideLength=Olside.offsetWidth;
|
//console.info(lsideLength);
|
|
var isFirLoadPage = 1; // 判断是否是第一次加载页面
|
|
//console.info(SlideLength);
|
var Ot_top = document.getElementById("t_top");
|
|
loading.showLoading($('#lside'));
|
// 给页面添加等待内容
|
$(document).ready(function() {
|
// 给页面添加等待内容
|
|
loading.showLoading($('#charge_sec_infor'));
|
|
clearfourPicture();
|
});
|
|
function getQueryString(name) {
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
var r = window.location.search.substr(1).match(reg);
|
if (r != null)
|
return unescape(r[2]);
|
return null;
|
}
|
|
//查询所有下拉菜单
|
function findBattin(){
|
$.post("BattInfAction_findMenu", null, function(data) {
|
//data = eval("(" + data + ")");
|
data = data.result;
|
data=eval("("+data+")");
|
//console.info(data);
|
if(data.code==1 && data.data.length>0){
|
data=data.data;
|
//battinlist = data;
|
//console.info(battinlist);
|
//alert(battinlist.length);
|
//createMenu();
|
}
|
});
|
}
|
|
function Inornot(arr,name,length){
|
var flag=false;
|
for(var i=0;i<length;i++){
|
//alert(arr[i]+"&&"+name);
|
if(arr[i]==name){
|
flag=true;
|
break;
|
}
|
}
|
return flag;
|
}
|
|
var Rtdatalist;
|
var BattGroupId=0;
|
var fir_index=0,sec_index=0;
|
var firarr=new Array();
|
var secarr=new Array();
|
//var time;
|
|
var MenuList=new Array();
|
var menu_index=0;
|
//生成下拉菜单
|
function createMenu() {
|
if (battinlist.length > 0) {
|
var Olside = document.getElementById("lside");
|
Olside.innerHTML = "";
|
var ul = createEle("ul");
|
//console.info(battinlist[0]);
|
for ( var i = 0; i < battinlist.length; i++) {
|
if(fir_index>0 && Inornot(firarr, battinlist[i].StationName,fir_index)){
|
continue;
|
}
|
|
//console.info(battinlist[i]);
|
var li1 = createEle("li");
|
var a1 = createEle("a");
|
//console.info(battinlist[i]);
|
a1.innerHTML ="<strong class='arrow down'></strong>"+battinlist[i].StationName;
|
a1.setAttribute("class", "fir");
|
//设置a标签的class改为class="fir"
|
a1.setAttribute("id",battinlist[i].StationName);
|
a1.setAttribute("name",battinlist[i].StationId);
|
|
firarr[fir_index++]=battinlist[i].StationName;
|
|
MenuList[menu_index]=new Array();
|
MenuList[menu_index][0]=battinlist[i].StationId;
|
MenuList[menu_index][1]=battinlist[i].StationName;
|
MenuList[menu_index++][2]=0;
|
|
ul1 = createEle("ul");
|
secarr=new Array();
|
for(var j=i;j<battinlist.length;j++){
|
if(battinlist[j].StationName!=battinlist[i].StationName){
|
continue;
|
}
|
if(sec_index>0 && Inornot(secarr, battinlist[j].BattGroupName1,sec_index)){
|
continue;
|
}
|
li2 = createEle("li");
|
a2 = createEle("a");
|
|
a2.innerHTML =$.trim(battinlist[j].BattGroupName1).length==0?"":"<strong class='mark'>+</strong>"+ battinlist[j].BattGroupName1;
|
secarr[sec_index++]=battinlist[j].BattGroupName1;
|
a2.setAttribute("class", "sec");
|
//设置a标签的class改为class="sec"
|
a2.setAttribute("id",battinlist[j].StationId);
|
a2.setAttribute("value",battinlist[j].StationName);
|
ul2 = createEle("ul");
|
|
if($.trim(battinlist[j].BattGroupName1).length == 0){
|
MenuList[menu_index]=new Array();
|
MenuList[menu_index][0]=battinlist[j].StationId;
|
MenuList[menu_index++][1]=battinlist[j].BattGroupName1;
|
|
//console.info(MenuList);
|
}
|
|
for ( var k = 0; k < battinlist.length; k++) {
|
if (battinlist[i].StationName == battinlist[k].StationName && battinlist[j].BattGroupName1 == battinlist[k].BattGroupName1) {
|
var li3 = createEle("li");
|
var a3 = createEle("a");
|
a3.innerHTML = battinlist[k].BattGroupName;
|
a3.setAttribute("class", "thr");
|
a3.setAttribute("id",battinlist[k].BattGroupId);
|
a3.setAttribute("value",battinlist[k].BattGroupName1);
|
|
MenuList[menu_index]=new Array();
|
MenuList[menu_index][0]=battinlist[k].StationId;
|
MenuList[menu_index][1]=battinlist[k].BattGroupName;
|
MenuList[menu_index][2]=battinlist[k].BattGroupName1;
|
MenuList[menu_index++][3]=battinlist[k].BattGroupId;
|
//设置a标签的class改为class="thr"
|
li3.appendChild(a3);
|
ul2.appendChild(li3);
|
}
|
}
|
|
li2.appendChild(a2);
|
li2.appendChild(ul2);
|
ul1.appendChild(li2);
|
}
|
li1.appendChild(a1);
|
li1.appendChild(ul1);
|
ul.appendChild(li1);
|
}
|
Olside.appendChild(ul);
|
clearSec();
|
}
|
|
// 对空白的二级导航进行清理
|
function clearSec() {
|
$('#lside').find('.sec').each(function(){
|
if($(this).text().trim().length == 0) {
|
$(this).hide();
|
}
|
});
|
}
|
|
//使拖拉的块(#r_b)一直处在div的可视区域
|
$(document).ready(function(){
|
$("#lside").scroll(function(){
|
var scrollHeight=$("#lside").scrollTop(); //获取滚动条滚动的高度
|
// console.info(scrollHeight);
|
var scrollWidth=$("#lside").scrollLeft(); //获取滚动条滚动的宽度
|
// console.log(scrollWidth);
|
$("#r_b").css("top",scrollHeight); //设置(上下)拖拉块的位置
|
$("#r_b").css("right",-scrollWidth);
|
});
|
});
|
|
|
|
//动态的设置左导航的高度
|
$(document).ready(function(){
|
var rHeight=$("#rside").height();
|
var batt_listen = $('#ele_content .batt-listen').height();
|
|
$("#lside").css("height",rHeight-30 -batt_listen+"px");
|
|
});
|
|
|
|
//机房数和电池组数
|
$(document).ready(function() {
|
var MachineRoom = $('.fir').length;
|
var CellGroup = $('.thr').length;
|
// 在id为mach_num的div显示内容
|
$('#room_num').text(MachineRoom);
|
$('#batt_group_num').text(CellGroup);
|
});
|
|
//初始化左导航
|
$(document).ready(function(){
|
//console.info(2222);
|
//根据域名中传递过来的battgroupid找到指定的电池组
|
var thr_id=getQueryString("battgroupId");
|
if(thr_id!=undefined){
|
BattGroupId=thr_id;
|
//获得一级菜单并展示二级菜单
|
var secTag =$('#'+thr_id).parent().parent().siblings().first().parent().parent().siblings().first().next();
|
var secTagA = $('#'+thr_id).parent().parent().siblings().first();
|
//console.info(secTagA.text()+'******');
|
if(secTagA.text().trim().length == 0) {
|
secTagA.hide();
|
}
|
secTag.show();
|
//$('#'+thr_id).parent().parent().siblings().first().parent().parent().siblings().first().next().show();
|
//获得二级菜单并展示三级菜单
|
$('#'+thr_id).parent().parent().siblings().first().next().show();
|
$('#'+thr_id).css('background-color','#9bbaf3');
|
//一级菜单展开样式
|
$('#'+thr_id).parent().parent().siblings().first().parent().parent().siblings().first().children('.arrow').removeClass("down");
|
$('#'+thr_id).parent().parent().siblings().first().parent().parent().siblings().first().children('.arrow').addClass("up");
|
$('#'+thr_id).parent().parent().siblings().first().children('.mark').text('-');
|
$('#'+thr_id).parent().parent().siblings().first().children('.mark').addClass('black');
|
//alert($('#'+thr_id).parent().parent().siblings().first().text());
|
location.hash="#"+thr_id;
|
}else{
|
$('.fir:first').next().css('display','block');
|
$('.sec:first').next().css('display','block');
|
$('.thr:first').css('background-color','#9bbaf3');
|
$('#address_infor').text($('.fir:first').text()+"-"+$('.sec:first').text()+"-"+$('.thr:first').text());
|
|
//初始化内容
|
$(".arrow").eq(0).removeClass("down");
|
$(".arrow").eq(0).addClass("up");
|
$(".mark").eq(0).text("-");
|
$(".mark").eq(0).addClass("black");
|
BattGroupId=$('.thr:first').attr("id");
|
}
|
for(var i=0;i<$('.fir:first').next().children().length;i++)
|
{
|
if($('.fir:first').next().children().eq(i).children().eq(0).text()=='')
|
{
|
$('.fir:first').next().children().eq(i).children().eq(0).css('display','none');
|
}
|
}
|
findBattinfObj();
|
AllBataDate=new Array();
|
clearfourPicture();
|
findBatttestdata_infByBattGroupId();
|
searchAll_lowAction(); //获取阀值
|
});
|
|
// 使用jquery实现左导航的显示和隐藏
|
$(document).ready(function(){
|
//二级左菜单的显示和隐藏
|
$('.fir').click(function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
$(this).css('background-color','#9bbaf3');
|
$(this).css('color','black');
|
// alert($(this).next().children().eq(0).children().eq(0).text());
|
//修复二级为空时的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).css('display','none');
|
$(this).next().children().eq(i).children().eq(0).next().slideToggle();
|
}
|
}
|
$(this).next().slideToggle();
|
});
|
|
//三级左菜单的显示和隐藏
|
$('.sec').click(function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
//alert($(this).parent().parent().siblings().get(0).tagName);
|
$(this).css('background-color','#9bbaf3');
|
$(this).next().slideToggle();
|
});
|
// 三级菜单选中时背景色改变
|
$('.thr').click(function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
$(this).css('background-color','#9bbaf3');
|
|
isCanExport = false;
|
|
//显示电池的详细信息
|
$('#address_infor').text($(this).parent().parent().parent().parent().siblings().first().text()+"-"+$(this).parent().parent().siblings().first().text()+"-"+$(this).text());
|
|
BattGroupId=$(this).attr("id");
|
$("#t_top").get(0).innerHTML="";
|
$("#charge_thr_infor .t_body").get(0).innerHTML="";
|
Ocharge_sec_infor.innerHTML="";
|
if($("#charge_select_type option:selected").val()=='Resistance-conductivity'){
|
findBattinfObj();
|
reflushBattStatus(BattinfObj);
|
findBattresdata_infActiondata();
|
}else{
|
findBatttestdata_infByBattGroupId();
|
}
|
clearfourPicture();
|
});
|
});
|
|
//屏蔽浏览器右键菜单功能
|
$(document).ready(function(){
|
document.oncontextmenu=function(){
|
return false;
|
};
|
});
|
// 菜单栏鼠标右键菜单显示
|
$(document).ready(function(){
|
$('.thr').mousedown(function(e){
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3)
|
{
|
BattGroupId=$(this).attr("id");
|
var disX=(e||event).clientX+10; //得到鼠标点击X的位置
|
var disY=(e||event).clientY+10; //得到鼠标点击Y的位置
|
var scrollY=$(document).scrollTop(); //获取浏览器滚动的高度
|
|
var oRightMenu=document.getElementById("right_menu");
|
$(this).click();
|
|
//显示菜单内容
|
$("#right_menu").show();
|
$("#right_menu .more_menu").hide();
|
//使菜单跟随鼠标位置
|
oRightMenu.style.left=disX+'px';
|
oRightMenu.style.top=disY+scrollY+'px';
|
|
setPosition($("#right_menu"),disX, disY);
|
}
|
});
|
|
//利用not选中器使不是点击.thr时就隐藏菜单
|
$("body:not('.thr')").click(function(){
|
if($("#right_menu").is(':hidden') && $("#echarts_menu").is(':hidden') && $("#bigecharts_menu").is(':hidden'))
|
{ //屏蔽浏览器右键菜单功能
|
document.oncontextmenu=function(){
|
return false;
|
};
|
}else{
|
//隐藏右键菜单
|
$("#right_menu").hide();
|
$("#echarts_menu").hide();
|
$("#bigecharts_menu").hide();
|
}
|
});
|
});
|
//使遮罩层和弹出层一直处在页面内
|
$(document).ready(function(){
|
$(document).scroll(function(){
|
var scrollY=$(document).scrollTop();
|
$('#allShade').css('top',scrollY+"px");
|
});
|
});
|
|
|
//点击返回按钮显示主页面隐藏弹出
|
$(document).ready(function(){
|
//退出电池组机历卡
|
$('#out_card_infor').click(function(){
|
$('#card_infor').hide(); //隐藏电池组机利卡
|
$('#allShade').hide();
|
});
|
//退出上传FBO和IDE数据
|
$('#out_upload_fbo').click(function(){
|
$('#upload_fbo').hide(); //隐藏上传
|
$('#allShade').hide();
|
});
|
//退出搜索机房或电池组
|
$('#out_search').click(function(){
|
$('#search_room').hide();
|
$('#allShade').hide();
|
$('#search_input').val('');
|
document.getElementById("search_info").innerHTML="";
|
});
|
});
|
//显示和隐藏查询选项事件
|
$(document).ready(function(){
|
//点击上传FBO和IDE数据内的显示和隐藏
|
$("#upload_fbo p").click(function(){
|
$("#upload_fbo .show_hide_opt").slideToggle(1000);
|
});
|
});
|
|
}
|
|
//创建指定的小图
|
function createallpicture(){
|
if($('#big_echarts').css("display")=='block'){
|
showBigPicture();
|
}else{
|
var checkvalue=$("#charge_select_type option:selected").val();
|
if(checkvalue=='Resistance-conductivity'){
|
CreateResEchart('ResEchart',oLTop,Monnum_list,monres_list,Restitle);
|
CreateSerpercentChart("mySerpercentChart",oRTop,Monnum_list,percentage_list,Serpercenttitle);
|
CreateMonEchart('MonEchart',oLBottom,Monnum_list,mon_vol_list,Montitle);
|
CreateSerEchart('SerEchart',oRBottom,Monnum_list,monser_list,Sertitle);
|
}else{
|
createEchartBar(AllData,slide_index,li_index);
|
//var title=getTitle(allMonVol[allMonVol.length-1],"Voltage");
|
//CreateEchart(oLBottom,Voltage,Monnum_list,allMonVol[slide_index],title); //生成左下条形图
|
CreateLineEchartTop('myLineChartTop',oLTop,group_vol, TestTime, BattGroupVol,getMaxFromArr(BattGroupVol),getMinFromArr(BattGroupVol),thrname); //生成左上折线图
|
CreateRightLineEchart('myRightLineChart',rtop, batt_curr, TestTime, BattGroupCurr, (Math.max.apply(null, BattGroupCurr)).toFixed(2),(Math.min.apply(null, BattGroupCurr)).toFixed(2),thrname); //生成右上折线图
|
UpdatamyLineChart(checkArray);
|
}
|
}
|
}
|
|
|
//根据当前选中的三级菜单查询其相关信息
|
function findBattinfObj(){
|
if(battinlist!=undefined && battinlist.length>0){
|
|
for(var i=0;i<battinlist.length;i++){
|
if(battinlist[i].BattGroupId==BattGroupId){
|
BattinfObj=battinlist[i];
|
break;
|
}
|
}
|
}else{
|
BattinfObj=undefined;
|
}
|
}
|
|
//根据当前放大的图表拉动页面后显示放大后的图片
|
function showBigPicture(){
|
//console.info(dbname);
|
var checkvalue=$("#charge_select_type option:selected").val();
|
if(dbname=="ltop"){
|
if(checkvalue=='Resistance-conductivity'){
|
CreateResEchart('BigResEchart',big_echarts_container,Monnum_list,monres_list,Sertitle);
|
}else{
|
CreateLineEchartTop('mybigLineChartTop',obig_echarts_container,group_vol, TestTime, BattGroupVol,getMaxFromArr(BattGroupVol),getMinFromArr(BattGroupVol),thrname); //生成左上折线图
|
}
|
}else if(dbname=="rtop"){
|
if(checkvalue=='Resistance-conductivity'){
|
CreateSerpercentChart('mybigSerpercentChart',obig_echarts_container,Monnum_list,percentage_list,Serpercenttitle);
|
}else{
|
CreateRightLineEchart('mybigRightLineChart',obig_echarts_container, batt_curr, TestTime, BattGroupCurr, (Math.max.apply(null, BattGroupCurr)).toFixed(2),(Math.min.apply(null, BattGroupCurr)).toFixed(2),thrname); //生成右上折线图
|
}
|
}else if(dbname=="lbottom"){
|
if(checkvalue=='Resistance-conductivity'){
|
CreateMonEchart('BigMonEchart',obig_echarts_container,Monnum_list,mon_vol_list,Montitle);
|
}else{
|
//console.info(Monnum_list);
|
CreateBigEchart(obig_echarts_container,Voltage,Monnum_list,Monvol_list,Titleobj.getAllTile("Voltage")); //生成左下条形图
|
}
|
}else if(dbname=="rbottom"){
|
if(checkvalue=='Resistance-conductivity'){
|
CreateSerEchart('BigSerEchart',obig_echarts_container,Monnum_list,monser_list,Sertitle);
|
}else{
|
UpdatamyLineChart(checkArray);
|
}
|
}
|
}
|
|
//初始化页面解决页面的bug
|
$(document).ready(function(){
|
$("#lside").scrollTop(0); //初始化左导航上下滑动的位置
|
$("#lside").scrollLeft(0); //初始化左导航左右滑动的位置
|
});
|
|
var batttext_type = ['节能放电','停电放电','节能充电','停电充电'];
|
//根据电池组id查询电池的测试信息
|
function findBatttestdata_infByBattGroupId(){
|
$ajax("post","Batttestdata_infAction_findByInfo","bti.BattGroupId="+BattGroupId,function(data){
|
data=eval("("+data+")");
|
//console.info(data.result);
|
data=data.result;
|
data=eval("("+data+")");
|
var Ocharge_sec_infor=document.getElementById("charge_sec_infor");
|
Ocharge_sec_infor.innerHTML="";
|
|
if(data.code==1 && data.data.length>0){
|
data=data.data;
|
var temp = checktestRecord(data);
|
collapse($('#charge_sec_infor'), temp);
|
/* for(var i=0;i<data.length;i++){
|
if(checkvalue=='charge' && data[i].test_type==3){
|
continue;
|
}else if(checkvalue=='discharge' && data[i].test_type==2){
|
continue;
|
}else if(data[i].test_type != 2 && data[i].test_type!=3){
|
continue;
|
}
|
var li=createEle("li");
|
var testtype=data[i].test_type==3?discharging:data[i].test_type==2?charging:"else";
|
li.innerHTML=(index++)+":"+testtype+"-"+data[i].test_starttime;
|
li.setAttribute("value", data[i].test_record_count);
|
li.setAttribute("class", data[i].test_type==3?"discharge":"charge");
|
ul.appendChild(li);
|
}
|
Ocharge_sec_infor.appendChild(ul); */
|
}else{
|
AllBataDate=undefined;
|
}
|
//setbackground();
|
});
|
}
|
|
function checktestRecord(list){
|
var temp = new Array();
|
//console.info(list);
|
var jienengDisCobj = {
|
title:'节能放电',
|
items:new Array()
|
};
|
var tingdianDisCobj = {
|
title:'停电放电',
|
items:new Array()
|
};
|
var jienengCobj = {
|
title:'节能充电',
|
items:new Array()
|
};
|
var tingdianCobj = {
|
title:'停电充电',
|
items:new Array()
|
};
|
|
for(var i =0 ;list!=undefined && i<list.length;i++){
|
if(list[i].test_type == 3){
|
if(list[i].test_starttype == 3){
|
//节能放电
|
jienengDisCobj.items.push({
|
txt:list[i].test_starttime,
|
val:list[i].test_record_count
|
});
|
}else{
|
//停电放电
|
tingdianDisCobj.items.push({
|
txt:list[i].test_starttime,
|
val:list[i].test_record_count
|
});
|
}
|
}else if(list[i].test_type == 2){
|
if(list[i].test_starttype == 3){
|
//节能充电
|
jienengCobj.items.push({
|
txt:list[i].test_starttime,
|
val:list[i].test_record_count
|
});
|
}else{
|
//停电充电
|
tingdianCobj.items.push({
|
txt:list[i].test_starttime,
|
val:list[i].test_record_count
|
});
|
}
|
}
|
}
|
if($('#charge_select_type').val() == 'charge-discharge'){
|
temp.push(jienengDisCobj);
|
temp.push(tingdianDisCobj);
|
temp.push(jienengCobj);
|
temp.push(tingdianCobj);
|
}else if($('#charge_select_type').val() == 'charge'){
|
temp.push(jienengCobj);
|
temp.push(tingdianCobj);
|
}else if($('#charge_select_type').val() == 'discharge'){
|
temp.push(jienengDisCobj);
|
temp.push(tingdianDisCobj);
|
}
|
//console.info(temp);
|
return temp;
|
}
|
|
$(document).ready(function(){
|
$("#charge_sec_infor").on('dblclick','li a',function(){
|
var AllCheck=$("#charge_thr_th input[type='checkbox']");
|
|
AllCheck.checked="checked";
|
var selectvalue=$("#charge_select_type option:selected").val();
|
if(selectvalue=='Resistance-conductivity'){
|
findbattredata($(this).attr('value'));
|
}else{
|
isCanExport = true;
|
//createWait($('#r_echarts'));
|
loading.showLoading($('#r_echarts'));
|
createPicture($(this).attr('value'));
|
findtestdatastop($(this).attr('value'));
|
|
$('#slider').slider({
|
value: 100
|
});
|
}
|
});
|
});
|
|
$("#charge_sec_infor").on("click","li",function(){
|
$("#charge_sec_infor li").css("background-color","");
|
$(this).css("background-color","#9bbaf3");
|
});
|
|
function toInformationArray(list){
|
Monnum_list = new Array(); //初始化电池编号数组
|
Monvol_list = new Array(); //初始化电池电压数组
|
checkArray = new Array();
|
for(var i=0;i<list.length;i++){
|
Monnum_list[i]="#"+list[i].mon_num;
|
Monvol_list[i]=list[i].mon_vol.toFixed(3);
|
checkArray.push(1);
|
}
|
}
|
|
|
//查询指定的电池组id下指定测试次数的测试数据
|
/* function createPicture(record_count){
|
//alert(record_count);
|
$ajax("post","BatttestdataAction_findByInfo","btd.BattGroupId="+BattGroupId+"&btd.test_record_count="+record_count, function(data){
|
data=eval("("+data+")");
|
data=data.result;
|
data=eval("("+data+")");
|
if(data.code==1){
|
data=data.data;
|
AllTestData=data;
|
//console.info(AllTestData);
|
formatAlldata();
|
}
|
});
|
} */
|
//查询指定的电池组id下指定测试次数的测试数据
|
function createPicture(record_count){
|
$.ajax({
|
type: "post",
|
url: "BatttestdataAction!findhistory",
|
async:true,
|
dataType:'text',
|
data:"json="+JSON.stringify({
|
BattGroupId:BattGroupId,
|
test_record_count:record_count
|
}),
|
success: function(data){
|
data = eval("("+data+")");
|
var model = eval("("+data.result+")");
|
//console.info(model);
|
if(model.code==1){
|
data=model.data;
|
AllTestData = model.data;
|
//console.info(AllTestData);
|
formatAlldata();
|
}
|
loading.hideLoading($('#r_echarts'));
|
},
|
error:function(){
|
noContent.showNoContent("查询失败,请检查网络连接!");
|
loading.hideLoading($('#r_echarts'));
|
}
|
});
|
|
}
|
|
|
//更新电池组状态栏
|
function reflushBattStatus(list){
|
//console.info(list);
|
var checkvalue=$("#charge_select_type option:selected").val();
|
var ele_state=document.getElementById("ele_state"); //电池状态 充电;放电;...
|
var ele_tension = document.getElementById("ele_tension"); //组端电压
|
var ele_current=document.getElementById("ele_current"); //电池电流
|
var test_date=document.getElementById("test_date"); //测试日期
|
var test_time=document.getElementById("test_time"); //测试时长
|
var test_content=document.getElementById("test_content"); //测试容量
|
var over_content=document.getElementById("over_content"); //剩余容量
|
var reserve_time=document.getElementById("reserve_time"); //后备时间
|
if(list!=undefined && checkvalue!="Resistance-conductivity"){
|
//console.info(list);
|
ele_state.value=list.test_type==3?discharging:list.test_type==2?charging:"else";;
|
|
ele_tension.value="在线:"+list.online_vol.toFixed(1)+"V;"+"组端:"+list.group_vol.toFixed(1)+"V";
|
ele_current.value=list.test_curr.toFixed(1)+"A";
|
test_date.value=list.test_starttime;
|
test_time.value=formatSeconds(list.test_timelong);
|
test_content.value=list.test_cap.toFixed(1)+"AH";
|
|
|
var battinf=getBattinfById();
|
var arr = batt_test_data[slide_index];
|
//console.info("MonCapStd:"+battinf.MonCapStd+";test_curr:"+list.test_curr+";test_cap:"+list.test_cap+";maxvol:"+Math.max.apply(null, Monvol_list)+";minvol:"+Math.min.apply(null, Monvol_list)+";monvolstd:"+battinf.MonVolStd);
|
var over_cap=GetMonomerCap(battinf.MonCapStd,GetHourRate(battinf.MonCapStd,list.test_curr),list.test_cap,Math.max.apply(null, arr),Math.min.apply(null, arr),battinf.MonVolStd,CapType_Rest);
|
//console.info(over_cap);
|
if(list.test_type == 2){
|
over_content.value="---";
|
}else{
|
over_content.value=over_cap.toFixed(1)+"AH";
|
}
|
reserve_time.value=formatTime1(GetRestTimeSecond(over_cap,list.test_curr).toFixed(0));
|
//alert(formatTime1(120));
|
}else if(list != undefined && checkvalue=="Resistance-conductivity"){
|
//当选中的是电阻电导数据时
|
//console.info(list);
|
ele_state.value=list.MonCount;
|
ele_tension.value=list.MonVolStd.toFixed(1)+"V";
|
ele_current.value=list.MonCapStd+"A";
|
test_date.value=list.MonResStd.toFixed(3)+"mΩ";
|
test_time.value=list.MonSerStd;
|
test_content.value=list.BattProducer;
|
over_content.value=list.BattInUseDate;
|
reserve_time.value="";
|
}else{
|
|
ele_state.value="";
|
ele_tension.value="";
|
ele_current.value="";
|
test_date.value="";
|
test_time.value="";
|
test_content.value="";
|
over_content.value="";
|
reserve_time.value="";
|
|
}
|
}
|
|
var oChargeThrInfor=document.getElementById("charge_thr_infor");
|
var batteststopDataList = new Array();
|
//根据指定的测试数据查询结束时的指定电池组的数据
|
function findtestdatastop(record_count){
|
$ajax("post","BatttestdatastopAction_findByInfo","btds.BattGroupId="+BattGroupId+"&btds.test_record_count="+record_count, function(data){
|
data=eval("("+data+")");
|
data=data.result;
|
data=eval("("+data+")");
|
if(data.code==1){
|
data=data.data;
|
//console.info(data);
|
batteststopDataList = data;
|
toInformationArray(data);
|
var arr = new Array();
|
//console.info(data);
|
for(var i=0;i<data.length;i++){
|
arr[data[i].mon_num-1]=data[i].mon_vol.toFixed(3);
|
}
|
createBattVoltable(arr);
|
//reflushBattStatus(data[0]);
|
}
|
});
|
|
|
|
|
//选中th内的复选框表格内的复选框都选中
|
$(document).ready(function(){
|
var aInput=oChargeThrInfor.getElementsByTagName("input");
|
//初始化input
|
for(var i=0;i<aInput.length;i++)
|
{
|
aInput[i].checked=true;
|
}
|
//定义如果th内的复选框被选中则表格内的全部被选中否则全部取消
|
function CheckAll(){
|
if(aInput[0].checked==true)
|
{
|
for(var i=1;i<aInput.length;i++)
|
{
|
aInput[i].checked=true;
|
}
|
}else{
|
for(var i=1;i<aInput.length;i++)
|
{
|
aInput[i].checked=false;
|
}
|
}
|
}
|
aInput[0].onclick=CheckAll;
|
});
|
}
|
|
/* var arrTh=[
|
"单体电压(V)",
|
"实际容量(AH)",
|
"剩余容量(AH)",
|
"容量百分比(%)",
|
]; */
|
var arrTh=[
|
"<s:text name='Monomer_voltage'/>(V)",
|
"<s:text name='Actual_capacity'/>(AH)",
|
"<s:text name='Residual_capacity'/>(AH)",
|
"<s:text name='Percent_total_capacity'/>(%)",
|
];
|
|
var checkArray; //复选框的选中数组
|
function createBattVoltable(data){
|
if(data!=undefined){
|
|
Ot_top.innerHTML="";
|
for(var i=0;i<data.length;i++){
|
|
var tr=createEle("tr");
|
var td1=createEle("td");
|
var td2=createEle("td");
|
var td3=createEle("td");
|
|
td1.innerHTML=i+1;
|
td2.innerHTML=data[i];
|
if(checkArray[i]==1){
|
td3.innerHTML='<input type="checkbox" checked="checked"/>';
|
}else{
|
td3.innerHTML='<input type="checkbox"/>';
|
}
|
|
tr.appendChild(td1);
|
tr.appendChild(td2);
|
tr.appendChild(td3);
|
|
Ot_top.appendChild(tr);
|
}
|
|
|
|
//checkArray=new Array(); //根据数组内的值判断是否显示折线1为显示
|
//根据复选框更新图表内容
|
$(document).ready(function(){
|
var myCheckbox=$("#t_top input[type='checkbox']");
|
var AllCheck=$("#charge_thr_th th input[type='checkbox']");
|
// console.log(AllCheck.length);
|
|
myCheckbox.click(function(){
|
for(var i=0;i<myCheckbox.length;i++)
|
{
|
if(myCheckbox.eq(i).is(':checked'))
|
{
|
checkArray[i]=1;
|
}else{
|
checkArray[i]=0;
|
}
|
}
|
UpdatamyLineChart(checkArray);
|
});
|
AllCheck.click(function(){
|
if(AllCheck.is(':checked'))
|
{
|
for(var i=0;i<myCheckbox.length;i++)
|
{
|
checkArray[i]=1;
|
}
|
}else{
|
for(var i=0;i<myCheckbox.length;i++)
|
{
|
checkArray[i]=0;
|
}
|
}
|
//console.info(456);
|
UpdatamyLineChart(checkArray);
|
});
|
});
|
|
var vol_max=Math.max.apply(Math,data);
|
var vol_min=Math.min.apply(Math,data);
|
var ele=$('#t_top>tr');
|
//console.info("max:"+vol_max);
|
//console.info("min:"+vol_min);
|
var maxflag=true,minflag=true;
|
for(var i=0;i<data.length;i++){
|
if(vol_max==data[i] && maxflag){
|
ele.eq(i).find("td").eq(1).css("background","green");
|
maxflag=false;
|
}else if(vol_min==data[i] &&minflag){
|
ele.eq(i).find("td").eq(1).css("background","red");
|
minflag=false;
|
}
|
}
|
|
}
|
}
|
|
//根据电压表中选中的电池组显示在右下折线图中
|
function UpdatamyLineChart(arr){
|
if(arr!=undefined){
|
var lname=new Array();
|
//var sdata=getArrByCheckBox(AllData);
|
var sdata = getArrayByCheck(batt_test_voldata);
|
var lname = getArrayByCheck(Monnum_list);
|
for(var i=0;i<arr.length;i++){
|
if(arr[i]==1){
|
lname.push(Monnum_list[i]);
|
}
|
}
|
|
|
|
if($('#bigEchartsCon').css('display')=='block' && dbname=="rbottom"){
|
var bigEchartsCon= $('#bigEchartsCon').get(0);
|
//console.info(sdata);
|
CreateLineEchart('mybigLineChart',bigEchartsCon,lname,TestTime,sdata,max,min,thrname); //生成右下折线图
|
$('#bigEchartsCon').css('background-color','#fff');
|
}else{
|
//console.info(sdata);
|
CreateLineEchart('myLineChart',oRBottom,lname,TestTime,sdata,max,min,thrname);
|
}
|
}else{
|
CreateLineEchart('myLineChart',oRBottom,[],[],[],100,50);
|
}
|
}
|
|
function findMonCount(battGroupId){
|
if(battGroupId>0){
|
for(var i=0;i<battinlist.length;i++){
|
//console.info(battinlist[i]);
|
if(battGroupId==battinlist[i].BattGroupId){
|
return battinlist[i].MonCount;
|
}
|
}
|
}
|
return -1;
|
}
|
|
window.onload = function() {
|
//findBattin();
|
|
};
|
|
//根据电池组编号和测试次数查询电导数据
|
function findbattredata(testcount){
|
loading.showLoading($('#r_echarts'));
|
//console.info(testcount);
|
if(testcount!=undefined && BattGroupId!=undefined){
|
$.post("BattresdataAction_serchByCondition","brd.BattGroupId="+BattGroupId+"&brd.test_record_count="+testcount,function(data){
|
data=data.result;
|
data=eval("("+data+")");
|
if(data.code==1 && data.data.length>0){
|
data=data.data;
|
//console.info(data);
|
getArray(data);
|
createRestab();
|
|
CreateResEchart('ResEchart',oLTop,Monnum_list,monres_list,Restitle);
|
CreateSerpercentChart('mySerpercentChart',oRTop,Monnum_list,percentage_list,Serpercenttitle);
|
CreateMonEchart('MonEchart',oLBottom,Monnum_list,mon_vol_list,Montitle);
|
CreateSerEchart('SerEchart',oRBottom,Monnum_list,monser_list,Sertitle);
|
}
|
});
|
}else{
|
loading.hideLoading($('#r_echarts'));
|
}
|
loading.hideLoading($('#r_echarts'));
|
}
|
|
//创建制定的电导记录生成表格
|
function createRestab(){
|
var tbody=$("#charge_thr_infor .t_body")[0];
|
tbody.innerHTML="";
|
for(var i=0;i<monres_list.length;i++){
|
var tr=createEle("tr");
|
|
var td1=createEle("td");
|
var td2=createEle("td");
|
var td3=createEle("td");
|
var td4=createEle("td");
|
var td5=createEle("td");
|
var td6=createEle("td");
|
var td7=createEle("td");
|
|
td1.innerHTML=i+1;
|
td2.innerHTML=mon_vol_list[i];
|
//td2.style.backgroundColor="red";
|
if(mon_vol_list[i]==Math.min.apply(Math,mon_vol_list)){
|
td2.style.backgroundColor="red";
|
}else if(mon_vol_list[i]==Math.max.apply(Math,mon_vol_list)){
|
td2.style.backgroundColor="green";
|
}
|
td3.innerHTML=montmp_list[i];
|
if(montmp_list[i]==Math.min.apply(Math,montmp_list)){
|
td3.style.backgroundColor="red";
|
}else if(montmp_list[i]==Math.max.apply(Math,montmp_list)){
|
td3.style.backgroundColor="green";
|
}
|
td4.innerHTML=monres_list[i];
|
if(monres_list[i]==Math.max.apply(Math,monres_list)){
|
td4.style.backgroundColor="red";
|
}else if(monres_list[i]==Math.min.apply(Math,monres_list)){
|
td4.style.backgroundColor="green";
|
}
|
td5.innerHTML=monser_list[i];
|
if(monser_list[i]==Math.min.apply(Math,monser_list)){
|
td5.style.backgroundColor="red";
|
}else if(monser_list[i]==Math.max.apply(Math,monser_list)){
|
td5.style.backgroundColor="green";
|
}
|
td6.innerHTML=percentage_list[i];
|
if(percentage_list[i]==Math.min.apply(Math,percentage_list)){
|
td6.style.backgroundColor="red";
|
}else if(percentage_list[i]==Math.max.apply(Math,percentage_list)){
|
td6.style.backgroundColor="green";
|
}
|
td7.innerHTML=conn_res_list[i];
|
if(conn_res_list[i]==Math.min.apply(Math,conn_res_list)){
|
td7.style.backgroundColor="red";
|
}else if(conn_res_list[i]==Math.max.apply(Math,conn_res_list)){
|
td7.style.backgroundColor="green";
|
}
|
|
tr.appendChild(td1);
|
tr.appendChild(td2);
|
tr.appendChild(td3);
|
tr.appendChild(td4);
|
tr.appendChild(td5);
|
tr.appendChild(td6);
|
tr.appendChild(td7);
|
|
tbody.appendChild(tr);
|
}
|
}
|
|
var monres_list; //电池单体电阻数组
|
var percentage_list; //电导百分比数组
|
var mon_vol_list; //电池单体电压数组
|
var monser_list; //电池单体电导数组
|
var montmp_list; //电池单体温度数组
|
var conn_res_list; //连接条数组
|
var ResTitleobj; //内阻标题对象
|
var VolTitleobj; //单体电压对象
|
var SerTitleobj; //电导标题对象
|
var SerPerTitleobj; //电导百分比对象
|
|
function getArray(list){
|
if(list!=undefined && list.length>0){
|
monres_list=new Array();
|
percentage_list=new Array();
|
mon_vol_list=new Array();
|
montmp_list=new Array();
|
monser_list=new Array();
|
conn_res_list=new Array();
|
Monnum_list=new Array();
|
ResTitleobj=new Title(); //内阻标题对象
|
VolTitleobj=new Title(); //单体电压对象
|
SerTitleobj=new Title(); //电导标题对象
|
SerPerTitleobj=new Title(); //电导百分比对象
|
|
var index;
|
var sum_ser=0,sum_res=0;sum_respercentage=0,sum_vol=0,sum_serpercent=0;
|
var batt=getBattinfById();
|
//console.info(batt);
|
for(var i=0;i<list.length;i++){
|
index = (list[i].mon_num/10).toFixed(0)-1;
|
Monnum_list[index]="#"+(index+1);
|
//percentage_list[index]=list[i].conn_res.toFixed(1);
|
monres_list[index]=list[i].mon_res.toFixed(3);
|
montmp_list[index]=list[i].mon_tmp.toFixed(1);
|
mon_vol_list[index]=list[i].mon_vol.toFixed(3);
|
conn_res_list[index]=list[i].conn_res.toFixed(3);
|
monser_list[index]=list[i].mon_ser.toFixed(0);
|
percentage_list[index]=(batt.MonSerStd==0?0:((list[i].mon_ser/batt.MonSerStd)*100)).toFixed(1);
|
|
sum_ser+=parseFloat(monser_list[index]);
|
sum_res+=parseFloat(monres_list[index]);
|
sum_respercentage+=parseFloat(percentage_list[index]),
|
sum_serpercent+=parseFloat(percentage_list[index]);
|
sum_vol+=parseFloat(mon_vol_list[index++]);
|
}
|
//console.info(Monnum_list);
|
|
ResTitleobj.setMax(Math.max.apply(Math, monres_list));
|
ResTitleobj.setMin(Math.min.apply(Math, monres_list));
|
ResTitleobj.setAvg(sum_res/monres_list.length.toFixed(3));
|
var low=getLow(3,2);
|
//console.info(batt);
|
if(low.low_method==0){
|
//根据标称值计算
|
ResTitleobj.setAlow(((2-low.low_value)*batt.MonResStd).toFixed(3));
|
low=getLow(3,3);
|
ResTitleobj.setClow(((2-low.low_value)*batt.MonResStd).toFixed(3));
|
}else{
|
//根据平均值计算
|
ResTitleobj.setAlow(((2-low.low_value)*ResTitleobj.getAvg()).toFixed(3));
|
low=getLow(3,3);
|
ResTitleobj.setClow(((2-low.low_value)*ResTitleobj.getAvg()).toFixed(3));
|
}
|
var count=0;
|
for(var i=0;i<monres_list.length;i++){
|
if(parseFloat(ResTitleobj.getAlow())<parseFloat(monres_list[i])){
|
//console.info(title.getAlow()+"<"+array[i]);
|
count++;
|
}
|
}
|
ResTitleobj.setLc(count);
|
ResTitleobj.setLp((count*100/monres_list.length).toFixed(1));
|
//设置电电阻数据的条形图title;
|
Restitle=ResTitleobj.getAllTile("Resistance");
|
//console.info(ResTitleobj);
|
|
|
SerPerTitleobj.setMax(Math.max.apply(Math, percentage_list).toFixed(1));
|
SerPerTitleobj.setMin(Math.min.apply(Math, percentage_list).toFixed(1));
|
SerPerTitleobj.setAvg((sum_respercentage/percentage_list.length).toFixed(1));
|
var low=getLow(3,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
SerPerTitleobj.setAlow((low.low_value*batt.monSerStd).toFixed(0));
|
low=getLow(3,3);
|
SerPerTitleobj.setClow((low.low_value*batt.monSerStd).toFixed(0));
|
}else{
|
//根据平均值计算
|
SerPerTitleobj.setAlow((low.low_value*SerPerTitleobj.getAvg()).toFixed(0));
|
low=getLow(3,3);
|
SerPerTitleobj.setClow((low.low_value*SerPerTitleobj.getAvg()).toFixed(0));
|
}
|
getLpLc(percentage_list,SerPerTitleobj);
|
//console.info(SerPerTitleobj);
|
//设置电电导百分比数据的条形图title;
|
Serpercenttitle=SerPerTitleobj.getAllTile("Serpercent");
|
//console.info(Serpercenttitle);
|
//Serpercenttitle="MonSerPercent:MAX="+tmax+"%;MIN="+tmin+"%;AVG="+tavg+"%;Low=;LC=;LP=";
|
|
VolTitleobj.setMax(Math.max.apply(Math, mon_vol_list));
|
VolTitleobj.setMin(Math.min.apply(Math, mon_vol_list));
|
VolTitleobj.setAvg(sum_vol/mon_vol_list.length.toFixed(3));
|
var low=getLow(1,1);
|
if(low.low_method==0){
|
//根据标称值计算
|
VolTitleobj.setAlow((low.low_value*batt.monVolStd).toFixed(3));
|
low=getLow(1,0);
|
VolTitleobj.setClow((low.low_value*batt.monVolStd).toFixed(3));
|
}else{
|
//根据平均值计算
|
VolTitleobj.setAlow((low.low_value*VolTitleobj.getAvg()).toFixed(3));
|
low=getLow(1,0);
|
VolTitleobj.setClow((low.low_value*VolTitleobj.getAvg()).toFixed(3));
|
}
|
getLpLc(mon_vol_list,VolTitleobj);
|
//设置电电压数据的条形图title;
|
Montitle=VolTitleobj.getAllTile("Voltage");
|
|
SerTitleobj.setMax(Math.max.apply(Math, monser_list));
|
SerTitleobj.setMin(Math.min.apply(Math, monser_list));
|
SerTitleobj.setAvg((sum_ser/monser_list.length).toFixed(0));
|
var low=getLow(3,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
SerTitleobj.setAlow((low.low_value*batt.monSerStd).toFixed(0));
|
low=getLow(3,3);
|
SerTitleobj.setClow((low.low_value*batt.monSerStd).toFixed(0));
|
}else{
|
//根据平均值计算
|
SerTitleobj.setAlow((low.low_value*SerTitleobj.getAvg()).toFixed(0));
|
low=getLow(3,3);
|
SerTitleobj.setClow((low.low_value*SerTitleobj.getAvg()).toFixed(0));
|
}
|
getLpLc(monser_list,SerTitleobj);
|
//console.info(SerTitleobj);
|
//设置电电导数据的条形图title;
|
Sertitle=SerTitleobj.getAllTile("Conductance");
|
|
}
|
}
|
|
//根据title对象和数组获取Lplc的
|
function getLpLc(array,titleobj){
|
var count=0;
|
for(var i=0;i<array.length;i++){
|
//console.info(titleobj.getAlow()+"+++"+array[i]);
|
if(parseFloat(titleobj.getAlow())>=parseFloat(array[i])){
|
count++;
|
}
|
}
|
titleobj.setLc(count);
|
titleobj.setLp((count*100/array.length).toFixed(1));
|
}
|
|
//根据当前选中的电池组id查询当前电池组的基本信息
|
function getBattinfById(){
|
if(battinlist!=undefined && BattGroupId!=undefined){
|
for(var i=0;i<battinlist.length;i++){
|
for(var k=0;k<battinlist[i].length;k++){
|
if(BattGroupId==battinlist[i][k].BattGroupId){
|
return battinlist[i][k];
|
}
|
}
|
}
|
}
|
return undefined;
|
}
|
|
function clearfourPicture(){
|
|
var checkvalue=$("#charge_select_type option:selected").val();
|
//alert(123);
|
if(checkvalue=='Resistance-conductivity'){
|
//alert(123);
|
monres_list=[];
|
percentage_list=[];
|
Monvol_list=[];
|
monser_list=[];
|
CreateResEchart('ResEchart',oLTop,[],[],'');
|
CreateSerpercentChart("mySerpercentChart",oRTop,[],[],'');
|
CreateMonEchart('MonEchart',oLBottom,[],[],'');
|
CreateSerEchart('SerEchart',oRBottom,[],[],'');
|
|
}else{
|
//alert("不是电导");
|
//CreateResEchart(oLTop,Voltage,[],[],100,0);
|
allMonVol=[];
|
BattGroupVol=[];
|
BattGroupCurr=[];
|
AllBataDate=[];
|
Monvol_list=[];
|
CreateEchart(oLBottom,Voltage,[],[],""); //生成条形图
|
CreateLineEchartTop('myLineChartTop',oLTop,[], [], [[],[]],100,50); //生成左上折线图
|
CreateRightLineEchart('myRightLineChart',rtop, batt_curr, [], [], 100,0); //生成右上折线图
|
CreateLineEchart('myLineChart',oRBottom,[],[],[],100,50);
|
|
}
|
}
|
|
var RL_max; //右下最大值
|
var RL_min; //右下最小值
|
var AllData;
|
|
var batt_test_data = new Array(); //左下条形图中的所有数组
|
var batt_test_voldata = new Array(); //右下折线图中的所有数组
|
var batt_test_evary_record = new Array(); //记录当前测试记录的每笔的组端测试值
|
|
//格式化从数据库中查询出来的数据
|
function formatAlldata(){
|
BattData=new Array(); //右下折线图中的所有数组
|
TestTime=new Array(); //横坐标轴
|
BattGroupVol=new Array(); //组端电压
|
BattOnlineVol = new Array(); //在线电压
|
BattGroupCurr=new Array(); //测试电流
|
Battimeinfo=new Array();
|
AllBataDate=new Array();
|
|
batt_test_data = new Array(); //左下条形图中的所有数组
|
batt_test_voldata = new Array(); //右下折线图中的所有数组
|
batt_test_evary_record = new Array(); //记录当前测试记录的每笔的组端测试值
|
//console.info(data);
|
|
if(AllTestData!=undefined){
|
if(Monnum_list != undefined && Monnum_list.length>0){
|
AllData=new Array();
|
for(var i=0;i<Monnum_list.length;i++){
|
batt_test_voldata[i] = new Array();
|
}
|
max=Number.NEGATIVE_INFINITY; //无穷小值
|
min=Number.POSITIVE_INFINITY; //无穷大值
|
var test_record_num = 0;
|
//console.info(AllTestData.length);
|
var batt_index = -1;
|
|
//console.info("***************");
|
BattGroupVol[0] = new Array();
|
BattGroupVol[1] = new Array();
|
for(var i=0;i<AllTestData.length;i++){
|
if(AllTestData[i].record_num != test_record_num){
|
//console.info(AllTestData[i]);
|
BattGroupVol[0].push(AllTestData[i].group_vol.toFixed(1)); //组端电压
|
BattGroupVol[1].push(AllTestData[i].online_vol.toFixed(1)); //在线电压
|
BattGroupCurr.push(AllTestData[i].test_curr.toFixed(1)); //组端电流
|
TestTime.push(formatSeconds(AllTestData[i].test_timelong));
|
batt_test_evary_record.push(AllTestData[i]);
|
|
batt_test_data[++batt_index] = new Array();
|
test_record_num = AllTestData[i].record_num;
|
if(test_record_num > 1){
|
batt_test_data[batt_index]=batt_test_data[batt_index-1].slice(0);
|
setArrayvalue(batt_test_voldata,batt_index);
|
}
|
}
|
if(max<AllTestData[i].mon_vol){
|
max = AllTestData[i].mon_vol;
|
}
|
if(min>AllTestData[i].mon_vol){
|
min = AllTestData[i].mon_vol;
|
}
|
//console.info(AllTestData[i]);
|
batt_test_data[batt_index][AllTestData[i].mon_num-1] = AllTestData[i].mon_vol;
|
batt_test_voldata[AllTestData[i].mon_num-1][batt_index] = AllTestData[i].mon_vol;
|
}
|
//console.info(BattGroupVol);
|
}
|
|
|
slide_index=batt_test_data.length-1;
|
Monvol_list = batt_test_data[batt_test_data.length-1];
|
|
thrname="PXA "+TestTime[TestTime.length-1];
|
var title=getTitle(Monvol_list,"Voltage");
|
reflushBattStatus(AllTestData[AllTestData.length-1]);
|
|
var batt = getBattinfById();
|
console.info(batt);
|
var tempmin = Math.floor(getMinFromArr(Monvol_list)*0.9);
|
//var tempmax = (batt.MonVolStd*1.25).toFixed(3);
|
var tempmax = Math.ceil(Math.max(getMaxFromArr(Monvol_list),batt.MonVolStd)*1.15);
|
//console.info(Math.max(tempmax,(batt.MonVolStd*1.25).toFixed(1)));
|
//console.info("tempmax:"+tempmax+"\tempmin:"+tempmin);
|
CreateEchart(oLBottom,Voltage,Monnum_list,Monvol_list,title,tempmax,tempmin);
|
|
//生成左下条形图
|
CreateLineEchartTop('myLineChartTop',oLTop,group_vol, TestTime, BattGroupVol,getMaxFromArr(BattGroupVol),getMinFromArr(BattGroupVol),thrname); //生成左上折线图
|
CreateRightLineEchart('myRightLineChart',rtop, batt_curr, TestTime, BattGroupCurr, (Math.max.apply(null, BattGroupCurr)).toFixed(2),(Math.min.apply(null, BattGroupCurr)).toFixed(2),thrname); //生成右上折线图
|
CreateLineEchart('myLineChart',oRBottom,Monnum_list,TestTime,batt_test_voldata,max,min,thrname); //生成右下折线图
|
echarts.connect('group1');
|
}else{
|
clearfourPicture();
|
}
|
|
setCapList();
|
//removeWait($('#main'));
|
loading.hideLoading($('#r_echarts'));
|
}
|
|
var batt_actionCap_list = new Array(); //实际容量 数组
|
var batt_restCap_list = new Array(); //剩余容量数组
|
var batt_CapPercent_list = new Array(); //容量百分比数组
|
function setCapList(){
|
if(batt_test_data!=undefined && batt_test_evary_record!=undefined){
|
var batt = getBattinfById(BattGroupId);
|
for(var i=0;i<batt_test_data.length;i++){
|
batt_actionCap_list[i] = new Array(); //实际容量 数组
|
batt_restCap_list[i] = new Array(); //剩余容量数组
|
batt_CapPercent_list[i] = new Array(); //容量百分比数组
|
var vol_list = batt_test_data[i];
|
var max_vol = Math.max.apply(null, vol_list);
|
for(var j=0;j<vol_list.length;j++){
|
var actionvalue = GetMonomerCap(batt.MonCapStd,GetHourRate(batt.MonCapStd,batt_test_evary_record[i].test_curr),batt_test_evary_record[i].test_cap,max_vol,vol_list[j],batt.MonVolStd,CapType_Real);
|
var restvalue = GetMonomerCap(batt.MonCapStd,GetHourRate(batt.MonCapStd,batt_test_evary_record[i].test_curr),batt_test_evary_record[i].test_cap,max_vol,vol_list[j],batt.MonVolStd,CapType_Rest);
|
//console.info(vol_list);
|
batt_actionCap_list[i].push(actionvalue.toFixed(0)); //实际容量 数组
|
batt_restCap_list[i].push(restvalue.toFixed(0)); //剩余容量数组
|
batt_CapPercent_list[i].push((actionvalue*100/batt.MonCapStd).toFixed(0)); //容量百分比
|
}
|
}
|
}
|
//console.info(batt_CapPercent_list);
|
}
|
|
//设置数组index处的值和上一个值
|
function setArrayvalue(list,index){
|
if(list!=undefined && index > 0){
|
for(var i=0;i<list.length;i++){
|
list[i][index] = list[i][index-1];
|
}
|
}
|
}
|
|
//获取上下左右的图表的位置
|
var oLTop=document.getElementById("ltop");
|
var oRTop=document.getElementById("rtop");
|
var oLBottom=document.getElementById("lbottom");
|
var oRBottom=document.getElementById("rbottom");
|
|
|
|
|
//使测试内容和图表的高度一致
|
$(document).ready(function(){
|
var rHeight=$('#r_echarts').height();
|
$('#charge_thr_infor').css('height',rHeight-270+'px');
|
});
|
|
var oall_picture=document.getElementById("all_picture");
|
var oltop_echart=document.getElementById("ltop_echart");
|
var ortop_echart=document.getElementById("rtop_echart");
|
var olbottom_echart=document.getElementById("lbottom_echart");
|
var orbottom_echart=document.getElementById("rbottom_echart");
|
//导出电池组电压折线图
|
function ExportLtop(){
|
//if(confirm($("#echarts_menu li a").eq(0).text()+"?")){
|
//oltop_echart.value=myLineChartTop.getDataURL("png");
|
$('#big_pic').get(0).value=$("#ltop canvas")[0].toDataURL("image/png");
|
$('#Big_picture').get(0).submit();
|
//}
|
};
|
|
//导出右上折线图
|
function ExportRtop(){
|
//if(confirm($("#echarts_menu li a").eq(0).text()+"?")){
|
//ortop_echart.value=myRightLineChart.getDataURL("png");
|
$('#big_pic').get(0).value=$("#rtop canvas")[0].toDataURL("image/png");
|
$('#Big_picture').get(0).submit();
|
//}
|
};
|
|
//导出左下条形图
|
function ExportLbottom(){
|
//if(confirm($("#echarts_menu li a").eq(0).text()+"?")){
|
//olbottom_echart.value=myChart.getDataURL("png");
|
$('#big_pic').get(0).value=$("#lbottom canvas")[0].toDataURL("image/png");
|
$('#Big_picture').get(0).submit();
|
//}
|
};
|
|
//导出右下折线图
|
function ExportRbottom(){
|
//if(confirm($("#echarts_menu li a").eq(0).text()+"?")){
|
//orbottom_echart.value=myLineChart.getDataURL("png");
|
$('#big_pic').get(0).value=$("#rbottom canvas")[0].toDataURL("image/png");
|
$('#Big_picture').get(0).submit();
|
//}
|
};
|
|
//导出所有图
|
function ExportAll(){
|
if(isCanExport){
|
ExportTbl();
|
}else{
|
alert("请先选择一组测试记录");
|
}
|
};
|
|
|
//导出报表
|
function ExportTbl() {
|
var lastarray = new Array();
|
lastarray.push(Monnum_list);
|
|
|
//组端电压折线图
|
createGraphByOpt(allGraph, myLineChartTop.getOption());
|
var oltop = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
//console.info(oltop);
|
|
// 电池电流折线图
|
createGraphByOpt(allGraph, myRightLineChart.getOption());
|
var ortop = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
|
// 单体电压折线图
|
createGraphByOpt(allGraph, myLineChart.getOption());
|
var olbottom = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
|
var temp = Titleobj;
|
|
lastarray.push(getListByindex(batt_test_data,0)); //获取起始单体电压
|
|
//单体电压柱状图
|
var arr1=getArrByIndex(slide_index,0);
|
var title=getTitle(arr1,"Voltage");
|
lastarray.push(arr1); //获取单体截止电压
|
|
var lowObj = Titleobj; //落后单体电压信息
|
|
var opt1 = getGraphOpt(Voltage,Monnum_list,arr1,title); //生成左下条形图
|
createGraphByOpt(allGraph, opt1);
|
var orbottom1 = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
|
//单体实际容量
|
var arr2=getArrByIndex(slide_index,1);
|
lastarray.push(arr2);
|
var title=getTitle(arr2,"Actual_capacity");
|
var opt2 = getGraphOpt(Actual_capacity,Monnum_list,arr2,title); //生成左下条形图
|
createGraphByOpt(allGraph, opt2);
|
var orbottom2 = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
|
//单体剩余容量
|
var arr3=getArrByIndex(slide_index,2);
|
lastarray.push(arr3);
|
var title=getTitle(arr3,"Residual_capacity");
|
var opt3 = getGraphOpt(Residual_capacity,Monnum_list,arr3,title); //生成左下条形图
|
createGraphByOpt(allGraph, opt3);
|
var orbottom3 = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
|
//单体容量百分比
|
var arr4=getArrByIndex(slide_index,3);
|
lastarray.push(arr4);
|
var title=getTitle(arr4,"Percent_total_capacity");
|
var opt4 = getGraphOpt(Percent_total_capacity,Monnum_list,arr4,title); //生成左下条形图
|
createGraphByOpt(allGraph, opt4);
|
var orbottom4 = allGraph.getDataURL({
|
pixelRatio: 1,
|
backgroundColor: '#fff'
|
});
|
Titleobj = temp;
|
|
var batt=getBattinfById();
|
var testdata = AllTestData[AllTestData.length-1];
|
|
oltop_echart.value = oltop; // 组端电压折线图
|
ortop_echart.value = ortop; // 电池电流折线图
|
olbottom_echart.value = olbottom; // 单体电压折线图
|
orbottom_echart.value = orbottom1; //单体电压柱状图
|
$('#actucap_echart').val(orbottom2); //单体实际容量
|
$('#restcap_echart').val(orbottom3); //单体剩余容量
|
$('#capperc_echart').val(orbottom4); //单体容量百分比
|
|
//console.info("*********");
|
$('#obj-bmd').val(JSON.stringify({
|
binf:batt,
|
sdata:testdata
|
}));
|
|
$('#obj-title').val(JSON.stringify(lowObj));
|
$('#arr-data').val(JSON.stringify(lastarray));
|
|
//console.info(batt);
|
//console.info(testdata);
|
//console.info(lowObj);
|
//console.info(lastarray);
|
//console.info("*********");
|
oall_picture.submit();
|
}
|
|
//从list集合中获取指定位置的数组
|
function getListByindex(list,index){
|
var arr = new Array();
|
if(list != undefined && list.length > index){
|
arr = list[index];
|
}
|
return arr;
|
}
|
|
function ExportBigpic(){
|
document.getElementById("big_pic").value=$("#bigEchartsCon canvas")[0].toDataURL("image/png");
|
document.getElementById("Big_picture").submit();
|
}
|
|
//当选中折线条形图是显示右键菜单
|
$('#table_echarts div').mousedown(function(e){
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3){
|
var disX=(e||event).clientX+10; //得到鼠标点击X的位置
|
var disY=(e||event).clientY+10; //得到鼠标点击Y的位置
|
var scrollY=$(document).scrollTop(); //获取浏览器滚动的高度
|
var rHeight=disY+scrollY;
|
//console.info(disX+" "+rHeight);
|
$('#echarts_menu').css('top',rHeight+'px');
|
$('#echarts_menu').css('left',disX+'px');
|
var checkvalue=$("#charge_select_type option:selected").val();
|
if(this.id=="ltop"){
|
$("#echarts_menu ul.export-ul").hide();
|
if(checkvalue=='Resistance-conductivity'){
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+Resistance+Bar_graph);
|
}else{
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+Voltage+Line_graph);
|
}
|
$("#echarts_menu li a.export-a").eq(0).click(ExportLtop);
|
}else if(this.id=="rtop"){
|
$("#echarts_menu ul.export-ul").hide();
|
if(checkvalue=='Resistance-conductivity'){
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+Conductivity_percentage+Line_graph);
|
}else{
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+batt_curr+Line_graph);
|
}
|
$("#echarts_menu li a").eq(0).click(ExportRtop);
|
}else if(this.id=="lbottom"){
|
if(checkvalue=='Resistance-conductivity'){
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+Voltage+Bar_graph);
|
}else{
|
$("#echarts_menu ul.export-ul").show();
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Bar_graph);
|
}
|
$("#echarts_menu li a.export-a").eq(0).click(ExportLbottom);
|
}else if(this.id=="rbottom"){
|
$("#echarts_menu ul.export-ul").hide();
|
if(checkvalue=='Resistance-conductivity'){
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt_group+Conductance+Bar_graph);
|
}else{
|
$("#echarts_menu li a.export-a").eq(0).text(Export+Batt+Voltage+Line_graph);
|
}
|
$("#echarts_menu li a.export-a").eq(0).click(ExportRbottom);
|
}
|
$("#echarts_menu").show();
|
setPosition($("#echarts_menu"),disX, disY);
|
}
|
});
|
|
$('#bigEchartsCon').mousedown(function(e){
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3){
|
var disX=(e||event).clientX+10; //得到鼠标点击X的位置
|
var disY=(e||event).clientY+10; //得到鼠标点击Y的位置
|
var scrollY=$(document).scrollTop(); //获取浏览器滚动的高度
|
var rHeight=disY+scrollY;
|
//console.info($('#big_echarts').css('display'));
|
if($('#bigEchartsCon').css('display') != 'none'){
|
$('#bigecharts_menu').css('top',rHeight+'px');
|
$('#bigecharts_menu').css('left',disX+'px');
|
$('#bigecharts_menu').show();
|
//console.info("设置菜单位置");
|
}
|
}
|
});
|
|
var obig_echarts_container=document.getElementById("big_echarts_container");
|
$('#table_echarts .graph>div').dblclick(function(){
|
var $bigEcharts=$('#bigEchartsCon').get(0);
|
var graph = $(this).parent();
|
var _n=0; //用于记录当前放大的是哪个图
|
var checkvalue=$("#charge_select_type option:selected").val();
|
//console.info(this.id);
|
if(this.id=="ltop"){
|
//双击的是左上折线图
|
dbname="ltop";
|
if(checkvalue=='Resistance-conductivity'){
|
if(Monnum_list!=undefined && monres_list!=undefined && monres_list.length>0){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
CreateResEchart('BigResEchart',$bigEcharts,Monnum_list,monres_list,Restitle);
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, BigResEchart);
|
_n=1;
|
}
|
}else{
|
if(TestTime!=undefined && BattGroupVol!=undefined && BattGroupVol.length>0){
|
//console.info($("#ltop canvas")[0].toDataURL("image/png"));
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
|
CreateLineEchartTop('mybigLineChartTop',$bigEcharts,group_vol, TestTime, BattGroupVol,getMaxFromArr(BattGroupVol),getMinFromArr(BattGroupVol),thrname); //生成左上折线图
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, myLineChartTop);
|
_n=2;
|
}
|
}
|
}else if(this.id=="rtop"){
|
//双击的是右上折线图
|
dbname="rtop";
|
if(checkvalue=='Resistance-conductivity'){
|
if(Monnum_list!=undefined && percentage_list!=undefined && percentage_list.length>0){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
CreateSerpercentChart('mybigSerpercentChart',$bigEcharts,Monnum_list,percentage_list,Serpercenttitle);
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, mybigSerpercentChart);
|
_n=3;
|
}
|
}else{
|
if(TestTime!=undefined && BattGroupCurr!=undefined && BattGroupCurr.length>0){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
CreateRightLineEchart('mybigRightLineChart',$bigEcharts, batt_curr, TestTime, BattGroupCurr, (Math.max.apply(null, BattGroupCurr)).toFixed(2),(Math.min.apply(null, BattGroupCurr)).toFixed(2),thrname); //生成右上折线图
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, myRightLineChart);
|
_n=4;
|
}
|
}
|
}else if(this.id=="lbottom"){
|
dbname="lbottom";
|
//双击的是左下条形图
|
if(checkvalue=='Resistance-conductivity'){
|
if(Monnum_list!=undefined && mon_vol_list!=undefined && mon_vol_list.length>0){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
CreateMonEchart('BigMonEchart',$bigEcharts,Monnum_list,mon_vol_list,Montitle);
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, BigMonEchart);
|
_n=5;
|
}
|
}else{
|
if(Monnum_list!=undefined && Monvol_list!=undefined && Monvol_list.length>0){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
var arr=getArrByIndex(slide_index, li_index);
|
console.info(arr);
|
var title = "";
|
var text = "";
|
|
switch(li_index){
|
case 0:{
|
text = Voltage;
|
title = Titleobj.getAllTile("Voltage");
|
|
}break;
|
case 1:{
|
text = Actual_capacity;
|
title = Titleobj.getAllTile("Actual_capacity");
|
}break;
|
case 2:{
|
text = Residual_capacity;
|
title = Titleobj.getAllTile("Residual_capacity");
|
}break;
|
case 3:{
|
text = Percent_total_capacity;
|
title = Titleobj.getAllTile("Percent_total_capacity");
|
}break;
|
}
|
|
CreateBigEchart($bigEcharts,text,Monnum_list,arr,title); //生成左下条形图
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
maxflag=true;
|
minflag=true;
|
toggleGraph(graph, myChart);
|
_n=6;
|
}
|
}
|
}else if(this.id=="rbottom"){
|
//双击的是右下折线图
|
dbname="rbottom";
|
if(checkvalue=='Resistance-conductivity'){
|
if(Monnum_list!=undefined && mon_vol_list!=undefined){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
CreateSerEchart('BigSerEchart',$bigEcharts,Monnum_list,monser_list,Sertitle);
|
$('#bigEchartsCon').css('background-color','#fff'); */
|
toggleGraph(graph, BigSerEchart);
|
_n=7;
|
}
|
}else{
|
if(Monnum_list!=undefined && TestTime!=undefined){
|
/* $('#bigEchartsCon').show();
|
var scrollY=$(document).scrollTop();
|
$('#bigEchartsCon').css('top',scrollY+'px');
|
$('body').css('overflow-y','hidden');
|
//CreateLineEchart(obig_echarts_container,Monnum_list,TestTime, BattData,max,min,thrname); //生成右下折线图
|
|
UpdatamyLineChart(checkArray); */
|
toggleGraph(graph, myLineChart);
|
_n=8;
|
}
|
}
|
}else{
|
dbname=undefined;
|
}
|
|
/* //双击隐藏放大的图表
|
$('#bigEchartsCon').dblclick(function(){
|
switch(_n){
|
case 0:;break;
|
case 1:BigResEchart.clear();break;
|
case 2:mybigLineChartTop.clear();break;
|
case 3:mybigSerpercentChart.clear();break;
|
case 4:mybigRightLineChart.clear();break;
|
case 5:BigMonEchart.clear();break;
|
case 6:myBigChart.clear();break;
|
case 7:BigSerEchart.clear();break;
|
case 8:mybigLineChart.clear();break;
|
}
|
$('#bigEchartsCon').hide();
|
$('body').css('overflow-y', 'scroll');
|
//createallpicture();
|
}); */
|
});
|
|
//查询电池组电导的测试记录
|
function findBattresdata_infActiondata(){
|
//alert(BattGroupId);
|
if(BattGroupId!=undefined){
|
$.post("Battresdata_infAction_serchByCondition","brdi.BattGroupId="+BattGroupId,function(data){
|
//alert(data.result);
|
data=data.result;
|
data=eval("("+data+")");
|
if(data.code==1 && data.data.length>0){
|
data=data.data;
|
Ocharge_sec_infor.innerHTML="";
|
var ul=createEle("ul");
|
|
for(var i=0;i<data.length;i++){
|
var li=createEle("li");
|
li.innerHTML=i+1+":"+Conductance+"-"+data[i].test_starttime;
|
li.setAttribute("value", data[i].test_record_count);
|
li.setAttribute("class", data[i].test_type==3?"discharge":"charge");
|
ul.appendChild(li);
|
}
|
Ocharge_sec_infor.appendChild(ul);
|
}
|
//setbackground();
|
});
|
}
|
}
|
|
//下拉选择框选中事件
|
$('#charge_select_type').change(function(){
|
isCanExport = false;
|
var checkvalue=$("#charge_select_type option:selected").val();
|
clearfourPicture();
|
changeBattInfo(checkvalue);
|
document.getElementById("charge_sec_infor").innerHTML="";
|
if(checkvalue=='Resistance-conductivity'){
|
//选中电阻电导数据
|
findBattinfObj();
|
reflushBattStatus(BattinfObj);
|
$('#charge_thr_th').css('visibility','hidden');
|
$('#charge_thr_infor .res').css('display','block');
|
findBattresdata_infActiondata();
|
$('#charge_bottom').hide();
|
|
}else{
|
reflushBattStatus(undefined);
|
$('#charge_thr_th').css('visibility','visible');
|
$('#charge_thr_th #t_top').text('');
|
$('#charge_thr_infor .res').css('display','none');
|
findBatttestdata_infByBattGroupId();
|
$('#charge_bottom').show();
|
}
|
});
|
|
|
|
//根据下拉框改变页面上端的电池基本信息
|
function changeBattInfo(checkval){
|
if(checkval=='Resistance-conductivity'){
|
$("#content td span").eq(0).text("<s:text name='Monomer_All' />"); /* 单体数量 */
|
$("#content td span").eq(1).text("<s:text name='Monomer_voltage' />"); /* 单体电压 */
|
$("#content td span").eq(2).text("");
|
$("#content td span").eq(3).text("<s:text name='Nominal_capacity' />"); /* 标称容量 */
|
$("#content td span").eq(4).text("<s:text name='Nominal_resistance' />"); /* 标称内阻 */
|
$("#content td span").eq(5).text("<s:text name='Nominal_conductance' />"); /* 标称电导 */
|
$("#content td span").eq(6).text("<s:text name='Battery_brand' />"); /* 电池品牌 */
|
$("#content td span").eq(7).text("<s:text name='Installation_date' />"); /* 安装日期 */
|
$("#content td span").eq(8).text("<s:text name='Maintenance_advice' />"); /*维护建议 */
|
}else{
|
$("#content td span").eq(0).text("<s:text name='Batte_state' />"); /* 电池状态 */
|
$("#content td span").eq(1).text("<s:text name='Terminal_vol' />");
|
$("#content td span").eq(2).text("&n");
|
$("#content td span").eq(3).text("<s:text name='Batt_current' />"); /* 电池电流 */
|
$("#content td span").eq(4).text("<s:text name='Test_date' />"); /* 测试日期 */
|
$("#content td span").eq(5).text("<s:text name='Test_timeL' />"); /* 测试时长 */
|
$("#content td span").eq(6).text("<s:text name='Test_capacity' />"); /* 测试容量 */
|
$("#content td span").eq(7).text("<s:text name='Residual_capacity' />"); /* 剩余容量 */
|
$("#content td span").eq(8).text("<s:text name='Endurance' /><s:text name='Time'/>"); /* 续航时间 */
|
}
|
}
|
|
|
//格式化右下折线图的数组
|
function getAlldata(list){
|
max=0;
|
min=1000;
|
if(list!=undefined && list.length>0){
|
for(var i=0;i<list.length;i++){
|
for(var j=0;j<list[i].length;j++){
|
//console.info(list[i][j]);
|
if(list[i][j]==undefined || list[i][j]==''){
|
list[i][j]=list[i][j-1];
|
}
|
if(max<list[i][j]){
|
max=list[i][j];
|
}
|
if(min>list[i][j]){
|
min=list[i][j];
|
}
|
}
|
}
|
}
|
return list;
|
}
|
|
//格式化左下条形图中数组的电压
|
function getAllVol(list){
|
if(list!=undefined && list.length>0){
|
for(var i=0;i<list.length;i++){
|
for(var j=0;j<list[0].length;j++){
|
if(list[i][j]==undefined){
|
list[i][j]=list[i-1][j];
|
}
|
}
|
}
|
}
|
return list;
|
}
|
|
//格式化单个数组
|
function getAllBattGroupVol(list){
|
if(list!=undefined && list.length>0){
|
for(var i=0;i<list.length;i++){
|
if(list[i]==undefined || list[i]==''){
|
list[i]=list[i-1];
|
}
|
}
|
}
|
return list;
|
}
|
|
var Titleobj;
|
//获取左下条形图中的数组
|
function getTitle(array,units){
|
var title="";
|
//a=new Title();
|
//alert(Titleobj);
|
Titleobj = new Title();
|
var sum=0;
|
if(array != undefined && array.length>0){
|
Titleobj.setMax(Math.max.apply(null,array));
|
Titleobj.setMin(Math.min.apply(null,array));
|
for(var i=0;i<array.length;i++){
|
sum+=parseFloat(array[i]);
|
}
|
var batt=getBattinfById();
|
//console.info(batt);
|
if("Resistance"==units){
|
Titleobj.setAvg((sum/array.length).toFixed(3));
|
var low=getLow(3,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow(((2-low.low_value)*batt.MonResStd).toFixed(3));
|
low=getLow(3,3);
|
Titleobj.setClow(((2-low.low_value)*batt.MonResStd).toFixed(3));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow(((2-low.low_value)*title.getAvg()).toFixed(3));
|
low=getLow(3,3);
|
Titleobj.setClow(((2-low.low_value)*title.getAvg()).toFixed(3));
|
}
|
var count=0;
|
for(var i=0;i<array.length;i++){
|
if(parseFloat(Titleobj.getAlow())<parseFloat(array[i])){
|
//console.info(title.getAlow()+"<"+array[i]);
|
count++;
|
}
|
}
|
Titleobj.setLc(count);
|
Titleobj.setLp((count*100/array.length).toFixed(1));
|
//console.info(title);
|
}else{
|
if("Voltage"==units){
|
Titleobj.setAvg((sum/array.length).toFixed(3));
|
var low=getLow(1,1);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*batt.MonVolStd).toFixed(3));
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*batt.MonVolStd).toFixed(3));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(3));
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(3));
|
}
|
}else if("Temperature"==units){
|
Titleobj.setAvg((sum/array.length).toFixed(1));
|
var low=getLow(1,1);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*batt.MonTmpStd).toFixed(1));
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*batt.MonTmpStd).toFixed(1));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(1));
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(1));
|
}
|
}else if("Conductance"==units){
|
Titleobj.setAvg((sum/array.length).toFixed(0));
|
var low=getLow(3,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*batt.MonSerStd).toFixed(0));
|
low=getLow(3,3);
|
Titleobj.setClow((low.low_value*batt.MonSerStd).toFixed(0));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
low=getLow(3,3);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
}
|
}else if("Actual_capacity"==units){
|
Titleobj.setAvg((sum/array.length).toFixed(0));
|
var low=getLow(2,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*batt.MonCapStd).toFixed(0));
|
//console.info(batt);
|
low=getLow(2,3);
|
Titleobj.setClow((low.low_value*batt.MonCapStd).toFixed(0));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
low=getLow(2,3);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
}
|
}else if("Residual_capacity" == units){
|
Titleobj.setAvg((sum/array.length).toFixed(0));
|
var low=getLow(1,1);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
//console.info(batt);
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
//console.info(batt);
|
low=getLow(1,0);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(0));
|
}
|
|
}else if("Percent_total_capacity" == units){
|
Titleobj.setAvg((sum/array.length).toFixed(2));
|
var low=getLow(2,2);
|
if(low.low_method==0){
|
//根据标称值计算
|
Titleobj.setAlow((low.low_value*batt.MonCapStd).toFixed(2));
|
//console.info(batt);
|
low=getLow(2,3);
|
Titleobj.setClow((low.low_value*batt.MonCapStd).toFixed(2));
|
}else{
|
//根据平均值计算
|
Titleobj.setAlow((low.low_value*Titleobj.getAvg()).toFixed(2));
|
low=getLow(2,3);
|
Titleobj.setClow((low.low_value*Titleobj.getAvg()).toFixed(2));
|
}
|
}
|
var count=0;
|
for(var i=0;i<array.length;i++){
|
if(parseFloat(Titleobj.getAlow())>parseFloat(array[i])){
|
count++;
|
}
|
}
|
Titleobj.setLc(count);
|
Titleobj.setLp((count*100/array.length).toFixed(1));
|
}
|
|
//console.info(Title);
|
title=Titleobj.getAllTile(units);
|
}
|
return title;
|
}
|
|
|
//查询对于国际化中所需要的值
|
var charging; //充电
|
var discharging; //放电
|
var Conductance; //电导
|
|
var Voltage; //电压
|
var Export; //导出
|
var Bar_graph; //条形图
|
var Line_graph; //折线图
|
var Batt_group; //电池组
|
var Batt; //电池
|
var Voltage; //电压
|
var Current; //电流
|
var Resistance; //电阻
|
var Conductivity_percentage; //电导百分比
|
|
|
$(document).ready(function(){
|
$.post("I18nAction_findValue","key=Conductance",function(data){
|
Conductance=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Resistance",function(data){
|
Resistance=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Charging",function(data){
|
charging=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Discharging",function(data){
|
discharging=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Voltage",function(data){
|
Voltage=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Export",function(data){
|
Export=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Bar_graph",function(data){
|
Bar_graph=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Line_graph",function(data){
|
Line_graph=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Batt_group",function(data){
|
Batt_group=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Batt",function(data){
|
Batt=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Voltage",function(data){
|
Voltage=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Current",function(data){
|
Current=data.value;
|
});
|
|
$.post("I18nAction_findValue","key=Conductivity_percentage",function(data){
|
Conductivity_percentage=data.value;
|
});
|
});
|
|
var low_list; //所有的阀值数组
|
//查询所有的阀值
|
function searchAll_lowAction(){
|
$.post("Batt_param_lowAction_searchAll",null,function(data){
|
model=eval("("+data.result+")");
|
if(model.code==1 && model.data.length>0){
|
low_list=model.data;
|
}else{
|
low_list=undefined;
|
}
|
//console.info(low_list);
|
});
|
}
|
|
//根据low_type,low_nametype获取阀值
|
function getLow(lowtype,lownametype){
|
if(lowtype!=undefined && low_list!=undefined && lownametype!=undefined){
|
for(var i=0;i<low_list.length;i++){
|
if(lowtype==low_list[i].low_type && lownametype==low_list[i].low_nametype){
|
return low_list[i];
|
}
|
}
|
}
|
}
|
|
//
|
function getArrByCheckBox(arr){
|
var temp=new Array();
|
if(arr != undefined && checkArray != undefined){
|
for(var i = 0; i < arr.length ;i++){
|
for(var j = 0;j<arr[i].length;j++){
|
if(checkArray[j]==1){
|
if(temp[j] == undefined){
|
temp[j] = new Array();
|
}
|
temp[j].push(arr[i][j].mon_vol.toFixed(3));
|
}
|
}
|
}
|
}
|
return temp;
|
}
|
|
function getArrayByCheck(list){
|
var temp = new Array();
|
if(list!=undefined && checkArray != undefined){
|
for(var i = 0;i<checkArray.length;i++){
|
if(checkArray[i]==1){
|
temp.push(list[i]);
|
}
|
}
|
}
|
return temp;
|
}
|
|
//从AllArr中取出指定位置的数组
|
function getArrByIndex(index,li_index){
|
switch(li_index){
|
case 0:return batt_test_data[index];break; //获取指定位置的电压值
|
case 1:return batt_actionCap_list[index];break;
|
case 2:return batt_restCap_list[index];break;
|
case 3:return batt_CapPercent_list[index];break;
|
}
|
return arr;
|
}
|
|
//当切换单体电压/实际容量/剩余容量/容量百分比菜单时
|
$('#echarts_menu').on('click','ul.export-ul li',function(){
|
var tmp = $(this).index();
|
if(tmp != li_index){
|
li_index=tmp;
|
//console.info(slide_index);
|
createEchartBar(AllData,slide_index,li_index);
|
}
|
});
|
|
//根据当前选中情况生成左下条形图
|
function createEchartBar(AllData,slide_index,li_index){
|
var arr=getArrByIndex(slide_index,li_index);
|
//console.info(arr);
|
var max = getMaxFromArr(arr);
|
var min = getMinFromArr(arr);
|
switch(li_index){
|
case 0:{
|
Monvol_list=arr;
|
var title=getTitle(Monvol_list,"Voltage");
|
var batt = getBattinfById();
|
//console.info(batt);
|
max = Math.ceil(Math.max(batt.MonVolStd,max)*1.15);
|
min = Math.floor(min*0.9);
|
console.info("max:"+max+" min:"+min);
|
CreateEchart(oLBottom,Voltage,Monnum_list,Monvol_list,title,max,min); //生成左下条形图
|
updataSecCol($('#charge_thr_th'), arrTh[li_index], Monvol_list);
|
console.info(Monvol_list);
|
};break;
|
case 1:{
|
var title=getTitle(arr,"Actual_capacity");
|
CreateEchart(oLBottom,Actual_capacity,Monnum_list,arr,title,(max*1.15).toFixed(3),(min*0.9).toFixed(3)); //生成左下条形图
|
updataSecCol($('#charge_thr_th'), arrTh[li_index], arr);
|
};break;
|
case 2:{
|
//console.info(arr);
|
//console.info("max:"+max+" min:"+min);
|
var title=getTitle(arr,"Residual_capacity");
|
CreateEchart(oLBottom,Residual_capacity,Monnum_list,arr,title,(max*1.15).toFixed(3),(min*0.9).toFixed(3)); //生成左下条形图
|
updataSecCol($('#charge_thr_th'), arrTh[li_index], arr);
|
};break;
|
case 3:{
|
var title=getTitle(arr,"Percent_total_capacity");
|
CreateEchart(oLBottom,Percent_total_capacity,Monnum_list,arr,title,(max*1.115).toFixed(3),(min*0.9).toFixed(3)); //生成左下条形图
|
updataSecCol($('#charge_thr_th'), arrTh[li_index], arr);
|
};break;
|
}
|
}
|
|
var maxText = '<s:text name="Maxvalue" />'; //最大值 //最大值
|
var minText = '<s:text name="Minvalue" />'; //最小值
|
var avgText = '<s:text name="Average" />'; //平均值
|
var lowText = '<s:text name="Lowvalue" />'; //落后值
|
var lcText = '<s:text name="Lcvalue" />'; //落后数量
|
var lpText = '<s:text name="Lpvalue" />'; //落后数量比
|
var Residual_capacity = '<s:text name="Residual_capacity" />'; //剩余容量
|
var Actual_capacity = '<s:text name="Actual_capacity" />'; //实际容量
|
var Percent_total_capacity = '<s:text name="Percent_total_capacity" />'; //容量百分比
|
var group_vol = ['<s:text name="Group_voltage"/>','<s:text name="On-line_voltage"/>'];
|
var batt_curr = '<s:text name="Batt_current"/>';
|
|
// 更新表格第二列
|
function updataSecCol(tbl, thTxt, tdData) {
|
tbl.find('tr th').eq(1).text(thTxt);
|
tbl.find('tbody tr').each(function(i) {
|
//console.info(i+"=="+tdData[i]);
|
$(this).find('td').eq(1).text(tdData[i]);
|
});
|
}
|
|
/**
|
设置滑块的提示框
|
@param object ele jquery对象
|
@param string val 字符串日期格式
|
@param num left 滑块的left值
|
*/
|
function setSlideLabel(ele, val, left) {
|
var winWidth = $(window).width();
|
var label = ele.find('.label'); //
|
var slider = ele.width(); // 容器的宽度
|
label.text(val); // 给label添加值
|
|
var labelWidth = label.width(); // 获取label的长度
|
var marginLeft = slider*left/100 - labelWidth/2;
|
label.css('left', marginLeft).show();
|
var labelLeft = label.offset().left; // 获取label这屏幕中的位置
|
var shiftWidth = winWidth - labelLeft; // 获取label距离屏幕右侧的距离
|
|
if(shiftWidth < labelWidth) { // 判断label是否超出屏幕的右侧
|
label.offset(function(n, c) {
|
var newPos = new Object();
|
newPos.top = c.top; // 距离顶部的距离不变
|
newPos.left = winWidth - labelWidth-10; // 距离屏幕右侧的距离
|
return newPos; // 返回最新的位置
|
});
|
}
|
}
|
|
// 实时-历史切换定位到具体电池组
|
$(function() {
|
$('body').on('click', '#nav a[href="control.jsp"]', function() {
|
var batt = getBattinfById();
|
//console.info(batt.StationId);
|
$(this).attr('href', 'control.jsp?battgroupId='+BattGroupId+'&stationId='+batt.StationId);
|
});
|
});
|
|
// 图表
|
function createGraphByOpt (eChart, opt) {
|
eChart.clear();
|
opt.animation = false;
|
eChart.setOption(opt);
|
}
|
// 获取opt
|
function getGraphOpt(lname, xdata, sdata, tname) {
|
maxBigflag = true;
|
minBigflag = true;
|
var option={
|
tooltip:{
|
trigger: 'axis',
|
axisPointer : { // 坐标轴指示器,坐标轴触发有效
|
type : 'line', // 默认为直线,可选为:'line' | 'shadow'
|
color:"white"
|
}
|
},
|
title : {
|
text: tname,
|
x: "center", //标题水平方向位置
|
textStyle: {
|
fontSize:11
|
}
|
},
|
xAxis:{
|
data:xdata
|
},
|
grid: {
|
left: '1%',
|
right: '5%',
|
bottom: '2%',
|
containLabel: true
|
},
|
yAxis:[{
|
name:"y",
|
type:'value',
|
min:(Math.min.apply( Math, sdata )*0.99).toFixed(3),
|
max:(Math.max.apply( Math, sdata )*1.01).toFixed(3),
|
// max:Math.ceil(ymax),
|
// min:Math.floor(ymin-1.0),
|
axisLabel:{
|
formatter:function(value){
|
//解决原点处带符号问题
|
if(value==0)
|
{
|
return value;
|
}else{
|
return value;
|
}
|
}
|
}
|
}],
|
series:[{
|
type:'bar',
|
name:lname,
|
data:sdata,
|
//显示柱状的数值
|
itemStyle:{
|
width:0.5,
|
emphasis:{
|
color:'#54d3e6'
|
},
|
|
normal:{
|
label:{
|
show:false
|
},
|
color: function(value) {
|
var max=Math.max.apply( Math, sdata );
|
var min=Math.min.apply( Math, sdata );
|
if(maxBigflag==true && value.value==max)
|
{
|
maxBigflag=false;
|
return 'green';
|
}
|
else if(minBigflag==true && value.value==min)
|
{
|
minBigflag=false;
|
return 'red';
|
}else
|
{
|
var clow=Titleobj.getClow();
|
var alow=Titleobj.getAlow();
|
if(parseFloat(value.value)<parseFloat(clow)){
|
return "#BFA0D1"; //设置更换颜色
|
}else if(parseFloat(value.value)<parseFloat(alow)){
|
return "#ffff00"; //设置告警颜色
|
}
|
//console.info(title.getClow());
|
return '#b4d3fa'; //设置为普通的颜色
|
}
|
max=0;
|
min=0;
|
}
|
}
|
},
|
//显示平均值
|
markLine:{
|
data:[
|
{
|
type:'average',
|
name:avg_string,
|
itemStyle:{
|
normal:{
|
color:'#54d3e6'
|
}
|
}
|
},
|
sdata!=undefined && sdata.length>0?[
|
{name: alarm_string, value: Titleobj.getAlow(),xAxis:xdata[0], yAxis:Titleobj.getAlow(),itemStyle:{ normal:{color:'#ffff00'} }},
|
{name: alarm_string,value: Titleobj.getAlow(),xAxis:xdata[xdata.length-1], yAxis: Titleobj.getAlow()}
|
]:[
|
{name: '', value:''},
|
{name: '', value:''}
|
],
|
sdata!=undefined && sdata.length>0?[
|
{name: change_string, value:Titleobj.getClow(),xAxis:xdata[0], yAxis: Titleobj.getClow(),itemStyle:{ normal:{color:'#ff66cc'} }},
|
{name: change_string, value:Titleobj.getClow(),xAxis:xdata[xdata.length-1], yAxis: Titleobj.getClow()}
|
]:[
|
{name: '', value:''},
|
{name: '', value:''}
|
]
|
]
|
}
|
}]
|
};
|
return option;
|
}
|
|
// 改变列表宽度
|
$(function() {
|
$('#ele_content').resizable({
|
minWidth: 240,
|
maxWidth: 600,
|
handles: 'e',
|
edge: 10,
|
start: function() {
|
maxflag = true;
|
minflag = true;
|
$('.graph>div').text('');
|
},
|
stop: function() {
|
var checkvalue=$("#charge_select_type option:selected").val();
|
//alert(123);
|
if(checkvalue=='Resistance-conductivity'){
|
ResEchart = setCanvas(ResEchart);
|
mySerpercentChart = setCanvas(mySerpercentChart);
|
MonEchart = setCanvas(MonEchart);
|
SerEchart = setCanvas(SerEchart);
|
}else {
|
myChart = setCanvas(myChart);
|
myLineChartTop = setCanvas(myLineChartTop);
|
myRightLineChart = setCanvas(myRightLineChart);
|
myLineChart = setCanvas(myLineChart);
|
myLineChartTop.group = 'group1';
|
myRightLineChart.group = 'group1';
|
myLineChart.group = 'group1';
|
echarts.connect('group1');
|
}
|
}
|
});
|
var lastslide = 0;
|
// 滑块定位
|
$('#slider').slider({
|
value: 100,
|
start: function(event, ui) {
|
//setSlideLabel($('#slider'), '2012-12-22 00:00:00', ui.value);
|
},
|
slide: function(event, ui) {
|
if(batt_test_evary_record!=undefined && batt_test_evary_record.length>0){
|
slide_index = Math.floor((batt_test_evary_record.length-1)*ui.value/100);
|
//console.info(slide_index+" === "+batt_test_evary_record.length);
|
setSlideLabel($('#slider'), formatSeconds(batt_test_evary_record[slide_index].test_timelong),ui.value);
|
}else{
|
setSlideLabel($('#slider'), '00:00:00',ui.value);
|
}
|
if(slide_index != lastslide){
|
//console.info(slide_index);
|
updateEchartAndTable();
|
lastslide = slide_index;
|
}
|
},
|
stop: function(event, ui) {
|
//console.info(ui.value);
|
upadateEchartsTitle();
|
$('#slider .label').hide();
|
}
|
});
|
});
|
|
|
//根据滑块更新数据
|
function UpdatedataBySlide(percentage){
|
if(batt_test_evary_record!=undefined && batt_test_evary_record.length>0){
|
slide_index = Math.floor(batt_test_evary_record.length*percentage);
|
//console.info(slide_index+"=="+batt_test_evary_record.length);
|
setSlideLabel($('#slide'), formatSeconds(batt_test_evary_record[slide_index].test_timelong));
|
//console.info(li_index);
|
}else{
|
setSlideLabel($('#slide'), '00:00:00');
|
}
|
}
|
|
function upadateEchartsTitle(){
|
if(batt_test_evary_record!=undefined && batt_test_evary_record.length>0){
|
thrname="PXA "+formatSeconds(batt_test_evary_record[slide_index].test_timelong);
|
reflushltop(thrname); //更新左上折线图中的title
|
reflushlrtop(thrname); //更新右上折线图的title
|
reflushlrLine(thrname); //更新右下折线图的title
|
}
|
}
|
|
function updateEchartAndTable(){
|
if(batt_test_data!=undefined && batt_test_data.length>0){
|
list = getArrByIndex(slide_index,li_index);
|
//console.info(index);
|
if(list!=undefined && list.length>0){
|
//console.info(slide_index+"###");
|
tname=getTitle(list, li_index==0?"Voltage":li_index==1?"Actual_capacity":li_index==2?"Residual_capacity":"Percent_total_capacity");
|
//var d1 = new Date();
|
var max = getMaxFromArr(list);
|
var min = (getMinFromArr(list)*0.9).toFixed(3);
|
if(li_index == 0){
|
var batt = getBattinfById();
|
max = Math.ceil(Math.max(batt.MonVolStd,max)*1.15);
|
min = Math.floor(min);
|
}else{
|
max = (max*1.15).toFixed(3);
|
}
|
|
reflush(list,tname,max,min); //更新条形图
|
|
createBattVoltable(list);
|
//更新电池状态
|
reflushBattStatus(batt_test_evary_record[slide_index]);
|
if(dbname=="lbottom" && $('#big_echarts').css("display")=='block'){
|
reflushBig(list,tname);
|
}
|
}
|
}
|
}
|
|
// 设置已经生成的canvas
|
function setCanvas(graph) {
|
var opts = graph.getOption();
|
graph.group = 'group1';
|
graph = echarts.init(graph._dom);
|
graph.setOption(opts);
|
return graph;
|
}
|
|
// 放大和恢复echarts图表
|
function toggleGraph(ele, echarts) {
|
if(ele.hasClass('big')) {
|
ele.removeClass('big');
|
}else {
|
ele.addClass('big');
|
}
|
echarts.resize();
|
|
}
|
|
$(function(){
|
//启动查询电池充放电状态的线程
|
searchBattState();
|
window.setInterval(function(){
|
searchBattState();
|
}, 6000);
|
});
|
function searchBattState(){
|
$.ajax({
|
type: "post",
|
url: "Batt_rtstateAction!serchDisOrChargr",
|
async:true,
|
dataType:'text',
|
data:null,
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
//console.info("************");
|
//console.info(model);
|
//console.info("************");
|
var arr = new Array();
|
if(model.code == 1){
|
console.info(model.data);
|
for(var i = 0;i<model.data.length;i++){
|
if(model.data[i].batt_test_type == 3){
|
arr.push({
|
note: model.data[i].note,
|
val:model.data[i].BattGroupId,
|
isCharge:0
|
});
|
}else if(model.data[i].batt_test_type == 2){
|
arr.push({
|
note: model.data[i].note,
|
val:model.data[i].BattGroupId,
|
isCharge:1
|
});
|
}
|
}
|
}
|
//console.info(arr);
|
var batt_list = $('#ele_content .batt-listen .batt-list');
|
createBattListen(batt_list, arr);
|
},
|
error:function(a){
|
|
}
|
});
|
}
|
|
// 生成充放电监测模块内容
|
function createBattListen(ele, list) {
|
console.info(list);
|
ele.text("");
|
var discharge_num = 0;
|
var charge_num = 0;
|
var ul = $('<ul></ul>');
|
for(var i = 0; i < list.length; i++) {
|
var li = "";
|
if(list[i].isCharge) {
|
li = $('<li><a href="javascript:;" class="batt-charge" value="'+list[i].val+'" note="'+list[i].note+'">'+list[i].val+'电池组充电测试!</a></li>');
|
charge_num++;
|
}else {
|
li = $('<li><a href="javascript:;" class="batt-discharge" value="'+list[i].val+'" note="'+list[i].note+'">'+list[i].val+'电池组放电测试!</a></li>');
|
discharge_num++;
|
}
|
ul.append(li);
|
}
|
$('#ele_content .batt-listen .count-num').find('span').eq(0).text(discharge_num);
|
$('#ele_content .batt-listen .count-num').find('span').eq(1).text(charge_num);
|
ele.append(ul);
|
}
|
// 点击电池充放电监测列表触发事件
|
$(function() {
|
var batt_list = $('#ele_content .batt-listen .batt-list');
|
batt_list.on('click', 'a', function(){
|
batt_list.find('a').removeClass('active');
|
$(this).addClass('active');
|
locationBattPos($(this).attr('note'), $(this).attr('value'));
|
});
|
});
|
|
function BattlocationById(battid){
|
if(battid!=undefined){
|
BattGroupId = battid;
|
$('#lside a').css({'background-color':'#fff'});
|
//获得一级菜单并展示二级菜单
|
var secTag =$('#'+battid).parent().parent().siblings().first().parent().parent().siblings().first().next();
|
var secTagA = $('#'+battid).parent().parent().siblings().first();
|
//console.info(secTagA.text()+'******');
|
if(secTagA.text().trim().length == 0) {
|
secTagA.hide();
|
}
|
secTag.show();
|
//$('#'+thr_id).parent().parent().siblings().first().parent().parent().siblings().first().next().show();
|
//获得二级菜单并展示三级菜单
|
$('#'+battid).parent().parent().siblings().first().next().show();
|
$('#'+battid).css('background-color','#9bbaf3');
|
//一级菜单展开样式
|
$('#'+battid).parent().parent().siblings().first().parent().parent().siblings().first().children('.arrow').removeClass("down");
|
$('#'+battid).parent().parent().siblings().first().parent().parent().siblings().first().children('.arrow').addClass("up");
|
$('#'+battid).parent().parent().siblings().first().children('.mark').text('-');
|
$('#'+battid).parent().parent().siblings().first().children('.mark').addClass('black');
|
//alert($('#'+thr_id).parent().parent().siblings().first().text());
|
location.hash="#"+battid;
|
$('#'+battid).click();
|
}
|
}
|
|
//跳转到指定的电池组统计分析查询
|
function targetBattReport(){
|
var batt = getBattinfById();
|
console.info(batt);
|
window.open("eleAnalyse.jsp?battgroupId="+BattGroupId+"&stationId="+batt.StationId);
|
}
|
|
// 使用jquery实现左导航的显示和隐藏
|
$(document).ready(function(){
|
//二级左菜单的显示和隐藏
|
$('#lside').on('click','.fir', function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
$(this).css('background-color','#9bbaf3');
|
$(this).css('color','black');
|
// alert($(this).next().children().eq(0).children().eq(0).text());
|
if ($(this).next().length == 0) {
|
searchkBattByStationid($(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() {
|
//console.info($(this));
|
changeFirImg($(this));
|
});
|
}
|
});
|
//三级左菜单的显示和隐藏
|
$('#lside').on('click', '.sec', function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
// alert($(this).parent().parent().siblings().get(0).tagName);
|
$(this).css('background-color','#9bbaf3');
|
$(this).next().slideToggle();
|
});
|
// 三级菜单背景色改变
|
$('#lside').on('click', '.thr', function(){
|
$('.thr').css('background-color','');
|
$('.fir').css('background-color','');
|
$('.sec').css('background-color','');
|
$(this).css('background-color','#9bbaf3');
|
//显示电池的详细信息
|
$('#address_infor').text($(this).parent().parent().parent().parent().siblings().first().text()+"-"+$(this).parent().parent().siblings().first().text()+"-"+$(this).text());
|
|
BattGroupId=$(this).attr("id");
|
findBattinfObj();
|
AllBataDate=new Array();
|
clearfourPicture();
|
findBatttestdata_infByBattGroupId();
|
searchAll_lowAction(); //获取阀值
|
});
|
});
|
|
|
$(function() {
|
//全部展开
|
$('#all_show').click(function(){
|
$('#lside .fir').each(function() {
|
var nextLength = $(this).next('ul').length;
|
if(nextLength == 0) {
|
searchkBattByStationid($(this).attr('name'));
|
}else {
|
$(this).children('.arrow').removeClass('down').addClass('up');
|
$(this).next().slideDown();
|
}
|
|
});
|
});
|
//全部收缩
|
$('#all_hide').click(function(){
|
$('.fir').next().slideUp();
|
//$('.sec').next().slideUp();
|
$("#lside").scrollTop(0);
|
$(".arrow").removeClass("up");
|
$(".arrow").addClass("down");
|
$(".mark").text("+");
|
$(".mark").removeClass("black");
|
});
|
});
|
searchAll_lowAction(); //获取阀值
|
seachAllStation();
|
//查询所有机房
|
function seachAllStation(){
|
$.ajax({
|
type: "post",
|
url: "BattInfAction!serchAllStation",
|
async:false,
|
dataType:'text',
|
data:null,
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
console.info(model);
|
if(model.code == 1){
|
console.info("查询成功");
|
createLsideFir($('#lside'), model.data); // 生成一级导航
|
searchAll_lowAction();
|
var stationId=getQueryString("stationId"); // 获取机房的ID
|
if(stationId != undefined && stationId>0) {
|
isFirLoadPage = 0;
|
searchkBattByStationid(stationId);
|
}else {
|
searchkBattByStationid(model.data[0].StationId);
|
}
|
|
}
|
},
|
error:function(){
|
|
}
|
});
|
}
|
|
//根据机房id查询电池组
|
function searchkBattByStationid(stationid){
|
|
$.ajax({
|
type: "post",
|
url: "BattInfAction!serchBattByStation",
|
async:false,
|
dataType:'text',
|
data:"json = "+JSON.stringify({
|
StationId:stationid
|
}),
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
|
if(model.code == 1){
|
createLsideSec(model.data);
|
battinlist.push(model.data);
|
}
|
},
|
error:function(){
|
|
}
|
});
|
}
|
|
/**
|
* 生成左侧一级导航
|
* @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:;" id="'+mList[i].StationName+'" class="fir" name="'+mList[i].StationId+'"><strong class="arrow down"></strong><span></span>'+mList[i].StationName+'</a>');
|
_li.append(_a);
|
_ul.append(_li);
|
}
|
|
contain.append(_ul);
|
loading.hideLoading(contain);
|
}
|
/**
|
* 生成左侧二级导航
|
* @param array mList 一级导航的数据机房名称,机房ID
|
* [{StationName:string,StationId:string,BattGroupId:string,BattGroupName:string}...]
|
*/
|
function createLsideSec(mList, batterId){
|
var _stationId = mList[0].StationId;
|
//console.info(_stationId);
|
// 根据_stationId的值确定要生成二级导航的位置
|
var _fir = $('#lside .fir');
|
|
_fir.each(function() {
|
if($(this).attr('name') == _stationId) {
|
$(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].StationId+'" 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].BattGroupId+'">'+mList[_i].BattGroupName+'</a></li>';
|
|
}
|
var __li = $(tagStr);
|
__ul.append(__li);
|
_li.append(__ul);
|
_ul.append(_li);
|
$(this).after(_ul);
|
var battId = getQueryString('battgroupId');
|
if(isFirLoadPage) {
|
isFirLoadPage = 0;
|
//console.info(123);
|
var firTag = $('#lside .fir').eq(0).next().find('.thr').eq(0);
|
var firId = firTag.attr('id');
|
firTag.css('background-color', '#9bbaf3');
|
BattGroupId = firId;
|
}else if(battId != undefined && arguments.length == 1){
|
|
$(this).next().find('.thr').each(function() {
|
if($(this).attr('id') == battId) {
|
$(this).css('background-color', '#9bbaf3');
|
BattGroupId = battId;
|
location.hash = '#'+battId;
|
}
|
});
|
}else{
|
$(this).next().find('.thr').each(function() {
|
if($(this).attr('id') == batterId) {
|
$('#lside .thr').css('background-color', "");
|
$(this).css('background-color', '#9bbaf3');
|
BattGroupId = batterId;
|
location.hash = '#'+batterId;
|
}
|
});
|
}
|
|
findBattinfObj();
|
AllBataDate=new Array();
|
findBatttestdata_infByBattGroupId();
|
}
|
});
|
}
|
|
// 根据左导航的状态确定一级菜单的图表
|
function changeFirImg(ele) {
|
var _status = ele.get(0).style.display;
|
if(_status == 'block') {
|
ele.siblings('a').children('.arrow').removeClass('down').addClass('up');
|
}else {
|
ele.siblings('a').children('.arrow').removeClass('up').addClass('down');
|
}
|
}
|
|
// 根据机房id和电池组id定位
|
function locationBattPos(stationid, battId) {
|
var _firTag = $('#lside .fir[name="'+stationid+'"]');
|
console.info(_firTag.attr('name'));
|
if(_firTag.next('ul').length == 0) {
|
$.ajax({
|
type: "post",
|
url: "BattInfAction!serchBattByStation",
|
async:false,
|
dataType:'text',
|
data:"json = "+JSON.stringify({
|
StationId:stationid
|
}),
|
success: function(data){
|
data = eval('('+data+')');
|
var model = eval('('+data.result+')');
|
|
if(model.code == 1){
|
createLsideSec(model.data, battId);
|
battinlist.push(model.data);
|
}
|
},
|
error:function(){
|
|
}
|
});
|
}else {
|
var _ul = _firTag.next();
|
_ul.slideDown();
|
_ul.find('.thr').each(function() {
|
$('#lside a').css('background-color', "");
|
$(this).css('background-color', '#9bbaf3');
|
BattGroupId = battId;
|
location.hash = '#'+battId;
|
});
|
|
findBattinfObj();
|
AllBataDate=new Array();
|
findBatttestdata_infByBattGroupId();
|
}
|
}
|
</script>
|
<script type="text/javascript" src="js/charge.js"></script>
|
</html>
|