<!DOCTYPE html>
|
<html lang="zh-CN">
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="renderer" content="webkit">
|
<title>智能机房管理平台-电池组</title>
|
<link rel="stylesheet" type="text/css" href="./plugins/layui/css/layui.css"/>
|
<link rel="stylesheet" type="text/css" href="css/page/detail-dcz.css"/>
|
<style>
|
#deviceNum ul li{
|
float: left;
|
margin-right: 10px;
|
display: none;
|
}
|
</style>
|
</head>
|
|
<body class="pdgxq-body">
|
<div class="i-container">
|
<div class="jmkt-main">
|
<div class="layui-fluid">
|
<div class="pdgxq-m1 layui-row layui-col-space20">
|
<div class="layui-col-lg6 layui-col-md6">
|
<div class="pdgxq-m1-left pdgxq-m1-box" style="height: 730px">
|
<div class="pdgxq-H">
|
<h3><i></i>实时监控</h3>
|
</div>
|
|
<div class="pdgxq-group clearfix">
|
<div class="pdgxq-group-item jmkt-chuli">
|
<span id="warnState">无</span>警告状态
|
</div>
|
<div class="pdgxq-group-item jmkt-yichuli">
|
<span id="conState">正常</span>通讯状态
|
</div>
|
<div class="pdgxq-group-item" style="width: 200px;">
|
<select lay-ignore="" class="layui-input" id="sort-value">
|
<option value="all" selected>默认排序</option>
|
<option value="u1">按电压升序</option>
|
<option value="u2">按电压降序</option>
|
<option value="res1">按内阻升序</option>
|
<option value="res2">按内阻降序</option>
|
<!-- <option value="t1">按温度升序</option>-->
|
<!-- <option value="t2">按温度降序</option>-->
|
</select>
|
<button class="layui-btn layui-btn-normal"
|
onclick="javaScript:querySort(); return false;">执行
|
</button>
|
</div>
|
</div>
|
|
<div class="pdgxq-table jmkt-table-wrap">
|
<div class="table-thead">
|
<table class="layui-table pdgxq-table1 poptable" lay-skin="nob">
|
<colgroup>
|
<col width="33%">
|
<col width="33%">
|
<col width="33%">
|
</colgroup>
|
<thead>
|
<tr>
|
<th>监控属性</th>
|
<th>监 控 值</th>
|
<th>更新时间</th>
|
</tr>
|
</thead>
|
</table>
|
</div>
|
<div class="table-tbody">
|
<table class="layui-table pdgxq-table1 poptable" lay-skin="nob">
|
<colgroup>
|
<col width="33%">
|
<col width="33%">
|
<col width="33%">
|
</colgroup>
|
<tbody id="deviceData">
|
<tr>
|
<td>通讯状态</td>
|
<td>正常</td>
|
<td>2020-04-26 12:30</td>
|
</tr>
|
<tr>
|
<td>警告状态</td>
|
<td>无</td>
|
<td>2020-04-26 12:30</td>
|
</tr>
|
</tbody>
|
</table>
|
</div>
|
<div style="height: 15px;border-top: 1px solid #444d58;"></div>
|
</div><!--pdgxq-table end-->
|
|
</div>
|
|
</div><!--pdgxq-m1-left end-->
|
|
<div class="layui-col-lg6 layui-col-md6">
|
<div class="pdgxq-m1-right pdgxq-m1-box">
|
<div class="pdgxq-H">
|
<h3><i></i>监控信息</h3>
|
<div id="deviceNum" class="jmkt-tit-more">
|
<ul>
|
<li class="info1">
|
<img src="./images/icon-dl@32.png"/>
|
总电流:<span id="i01">##</span>
|
</li>
|
<li class="info2">
|
<img src="./images/icon-dy@32.png"/>
|
总电压:<span id="u01">##</span>
|
</li>
|
<li class="info3">
|
<img src="./images/icon-sj@32.png"/>
|
电池后备时间:<span id="dm01">##</span>
|
</li>
|
<li class="info4">
|
总电池个数:<span id="sumNum">##</span>
|
</li>
|
</ul>
|
</div>
|
</div>
|
<div class="lsyg-jkxx-box">
|
<div id="deviceCommon" class="layui-row scroll">
|
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
<div class="layui-col-lg3 layui-col-md3">
|
<div class="battery">
|
<img src="./images/icon-battery2.png"/>
|
<div class="battery-info">
|
<p class="battery-text">序号:9</p>
|
<p class="battery-text">电压:##.##V</p>
|
<p class="battery-text">内阻:##.##Ω</p>
|
<p class="battery-text">温度:##.##℃</p>
|
</div>
|
</div>
|
</div>
|
|
|
</div>
|
|
</div><!--lsyg-jkxx-box end-->
|
</div>
|
|
<!-- 基本信息 -->
|
<div style="padding-top: 20px">
|
<div class="pdgxq-m2-right pdgxq-m2-box">
|
<h3>设备基本信息</h3>
|
<p>设备名称:<span id="deviceName">电池组#1</span></p>
|
<p>设备状态:<span id="deviceVld">激活</span></p>
|
<p style="display: none;">运维厂商:<span id="opVendor"></span></p>
|
|
<div class="pdgxq-phone" style="display: none;">
|
<h4>运维电话</h4>
|
<p id="opPhone"></p>
|
</div>
|
</div>
|
</div>
|
|
</div><!--pdgxq-m1-left end-->
|
|
</div><!--pdgxq-m1 end-->
|
|
</div>
|
|
</div><!--jmkt-main end-->
|
|
</div> <!--i-container end-->
|
<script src="./js/jquery.min.js"></script>
|
<script type="text/javascript">
|
var time = "";
|
var tag = "all";
|
var asc = false;
|
var dataList = null;
|
|
// ffff();
|
// function ffff() {
|
// var deviceData = test();
|
// //时间格式处理
|
// time = deviceData.time.substring(0,4) + "-" +
|
// deviceData.time.substring(4,6) + "-" +
|
// deviceData.time.substring(6,8) + " " +
|
// deviceData.time.substring(8,10) + ":" +
|
// deviceData.time.substring(10,12);
|
// var tag = "all";
|
// var asc = false;
|
// //监控属性渲染
|
// dataList = deviceData.value;
|
// // renderData(list);
|
// paix(tag,asc,dataList)
|
// }
|
|
function querySort() {
|
var s = $("#sort-value").val();
|
if(s == "all"){
|
tag = "all";
|
asc = true;
|
}
|
if(s == "u1"){
|
tag = "u";
|
asc = true;
|
}
|
if(s == "u2"){
|
tag = "u";
|
asc = false;
|
}
|
if(s == "res1"){
|
tag = "res";
|
asc = true;
|
}
|
if(s == "res2"){
|
tag = "res";
|
asc = false;
|
}
|
if(s == "t1"){
|
tag = "t";
|
asc = true;
|
}
|
if(s == "t2"){
|
tag = "t";
|
asc = false;
|
}
|
paix(tag,asc,dataList);
|
}
|
|
|
//开始渲染
|
function renderInfo(deviceData, device) {
|
deviceData = deviceData;
|
//设备基本信息
|
$("#deviceName").html(device.name);
|
$("#deviceVld").html(device.vld==0?'激活':'停用');
|
$("#opVendor").html(window.parent.SYS_SET.opVendor);
|
$("#opPhone").html(window.parent.SYS_SET.opPhone);
|
|
//时间格式处理
|
time = deviceData.time.substring(0,4) + "-" +
|
deviceData.time.substring(4,6) + "-" +
|
deviceData.time.substring(6,8) + " " +
|
deviceData.time.substring(8,10) + ":" +
|
deviceData.time.substring(10,12);
|
var s = $("#sort-value").val();
|
if(s == "all"){
|
tag = "all";
|
asc = true;
|
}
|
if(s == "u1"){
|
tag = "u";
|
asc = true;
|
}
|
if(s == "u2"){
|
tag = "u";
|
asc = false;
|
}
|
if(s == "res1"){
|
tag = "res";
|
asc = true;
|
}
|
if(s == "res2"){
|
tag = "res";
|
asc = false;
|
}
|
if(s == "t1"){
|
tag = "t";
|
asc = true;
|
}
|
if(s == "t2"){
|
tag = "t";
|
asc = false;
|
}
|
|
//监控属性渲染
|
dataList = deviceData.value;
|
// renderData(list);
|
paix(tag,asc,dataList)
|
}
|
|
function paix(tag,asc,list) {
|
//用于存放电池组内的电池信息
|
var batteryList = new Array();
|
if(list !=null && list.length>0){
|
$.each(list,function(index,item){
|
var temp = item.value;
|
if(item.passcode >=4 && item.passcode <=67){ //电池电压
|
if(batteryList[item.passcode-4] == null){
|
var obj1 = {};
|
obj1.num = item.passcode-3;
|
obj1.u01 = temp;
|
obj1.u01Unit = "";
|
if(item.unit && item.unit.length > 0){
|
obj1.u01Unit = item.unit;
|
}
|
batteryList[item.passcode-4] = obj1;
|
}else {
|
batteryList[item.passcode-4].u01 = temp;
|
}
|
|
}
|
if(item.passcode >=68 && item.passcode <=131){ //电池内阻
|
if(batteryList[item.passcode-68] == null){
|
var obj2 = {};
|
obj2.num = item.passcode-67;
|
obj2.res01 = temp;
|
obj2.res01Unit = "";
|
if(item.unit && item.unit.length > 0){
|
obj2.res01Unit = item.unit;
|
}
|
batteryList[item.passcode-68] = obj2;
|
}else {
|
batteryList[item.passcode-68].res01 = temp;
|
}
|
}
|
if(item.passcode >=132 && item.passcode <=195){ //电池温度
|
if(batteryList[item.passcode-132] == null){
|
var obj3 = {};
|
obj3.num = item.passcode-131;
|
obj3.t01 = temp;
|
obj3.t01Unit = "";
|
if(item.unit && item.unit.length > 0){
|
obj3.t01Unit = item.unit;
|
}
|
batteryList[item.passcode-132] = obj3;
|
}else {
|
batteryList[item.passcode-132].t01 = temp;
|
}
|
}
|
});
|
|
if(tag != "all"){
|
batteryList.sort(function (a,b) {
|
if(tag == "u"){
|
if(asc){
|
//按照电压升序排序
|
return a.u01 - b.u01;
|
}else{
|
//按照电压降序排序
|
return b.u01 - a.u01;
|
}
|
}
|
if(tag == "res"){
|
if(asc){
|
//按照电压升序排序
|
return a.res01 - b.res01;
|
}else{
|
//按照电压降序排序
|
return b.res01 - a.res01;
|
}
|
}
|
if(tag == "t"){
|
if(asc){
|
//按照电压升序排序
|
return a.t01 - b.t01;
|
}else{
|
//按照电压降序排序
|
return b.t01 - a.t01;
|
}
|
}
|
});
|
}
|
|
}
|
// console.log(tag);
|
// console.log(batteryList);
|
renderData(list,batteryList,tag);
|
}
|
|
function renderData(list,batteryList,tag) {
|
|
|
|
var html1=''; //实时属性
|
var html2=''; //监控设备
|
|
// //用于存放电池组内的电池信息
|
// var batteryList = new Array();
|
|
if(list !=null && list.length>0){
|
$.each(list,function(index,item){
|
var s1 = "";
|
s1 += '<tr>';
|
s1 += '<td>' + item.name + '</td>';
|
var s2 = "";
|
s2 += '<td>' + time + '</td>';
|
s2 += '</tr>';
|
|
if(item.passcode == 1 || item.passcode == 2
|
|| item.passcode == 3 || item.passcode == 196
|
|| item.passcode == 197 || item.passcode == 198){
|
var str = "";
|
if(item.note && item.note.length > 0){
|
str += item.note;
|
}else{
|
str += item.value;
|
}
|
if(item.unit && item.unit.length > 0){
|
str += " " + item.unit;
|
}
|
html1 += s1;
|
html1 += '<td>';
|
html1 += str;
|
html1 += '</td>';
|
html1 += s1;
|
}
|
|
if (item.passcode == 1) { //通讯状态
|
if (item.value != "0") { //正常
|
$("#conState").html("异常");
|
}
|
}else if(item.passcode == 2){ //报警状态
|
if (item.value != "0") { //正常
|
$("#warnState").html("报警");
|
}
|
}else if(item.passcode == 3){
|
//电池总个数
|
var temp = "";
|
if(item.note && item.note.length > 0){
|
temp += item.note;
|
}else{
|
temp += item.value;
|
}
|
if(item.unit && item.unit.length > 0){
|
temp += " " + item.unit;
|
}
|
$("#sumNum").text(temp);
|
$(".info4").show();
|
}else if(item.passcode == 196){
|
//总电流
|
var temp = "";
|
if(item.note && item.note.length > 0){
|
temp += item.note;
|
}else{
|
temp += item.value;
|
}
|
if(item.unit && item.unit.length > 0){
|
temp += " " + item.unit;
|
}
|
$("#i01").text(temp);
|
$(".info1").show();
|
}else if(item.passcode == 197){
|
var temp = "";
|
if(item.note && item.note.length > 0){
|
temp += item.note;
|
}else{
|
temp += item.value;
|
}
|
if(item.unit && item.unit.length > 0){
|
temp += " " + item.unit;
|
}
|
$("#u01").html(temp);
|
$(".info2").show();
|
}else if(item.passcode == 198){
|
//电池续航时间
|
var temp = "";
|
if(item.note && item.note.length > 0){
|
temp += item.note;
|
}else{
|
temp += item.value;
|
}
|
if(item.unit && item.unit.length > 0){
|
temp += " " + item.unit;
|
}
|
$("#dm01").text(temp);
|
$(".info3").show();
|
}
|
|
});
|
|
|
$.each(batteryList,function(index,item){
|
if(item.u01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池电压</td>';
|
html1 += '<td>' + item.u01 + ' '+item.u01Unit+'</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
$.each(batteryList,function(index,item){
|
if(item.res01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池内阻</td>';
|
html1 += '<td>' + item.res01 + ' '+item.res01Unit+'</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
$.each(batteryList,function(index,item){
|
if(item.t01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池温度</td>';
|
html1 += '<td>' + item.t01 + ' '+item.t01Unit+ '</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
|
// console.log(batteryList);
|
|
//渲染右侧电池信息
|
if(batteryList !=null && batteryList.length>0){
|
$.each(batteryList,function(index,item){
|
if(item != null){
|
if(screen.width==1920 && screen.height==1080){
|
html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
}else if(screen.width==1280){
|
html2 += '<div class="layui-col-lg4 layui-col-md4">';
|
}else{
|
html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
}
|
// html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
html2 += '<div class="battery">';
|
html2 += '<img src="./images/icon-battery2.png"/>';
|
html2 += '<div class="battery-info">';
|
html2 += '<p class="battery-text">序号:' + item.num + '</p>';
|
if(item.u01){
|
html2 += '<p class="battery-text">电压:' + item.u01 + ' '+item.u01Unit+ '</p>';
|
}
|
if(item.res01){
|
html2 += '<p class="battery-text">内阻:' + item.res01 + ' '+item.res01Unit+ '</p>';
|
}
|
if(item.t01){
|
html2 += '<p class="battery-text">温度:' + item.t01 + ' '+item.t01Unit+ '</p>';
|
}
|
html2 += '</div></div></div>';
|
|
}
|
});
|
}
|
}else {
|
html1 += "<tr><td colspan='3'>暂无数据</td></tr>";
|
$("#deviceName").html("");
|
}
|
$("#deviceData").html(html1);
|
$("#deviceCommon").html(html2);
|
}
|
|
function renderData2(list,batteryList,tag) {
|
|
|
|
var html1=''; //实时属性
|
var html2=''; //监控设备
|
|
// //用于存放电池组内的电池信息
|
// var batteryList = new Array();
|
|
if(list !=null && list.length>0){
|
$.each(list,function(index,item){
|
var s1 = "";
|
s1 += '<tr>';
|
s1 += '<td>' + item.name + '</td>';
|
var s2 = "";
|
s2 += '<td>' + time + '</td>';
|
s2 += '</tr>';
|
if (item.passcode == 1) { //通讯状态
|
html1 += s1;
|
if (item.value == "0") { //正常
|
html1 += '<td>正常</td>';
|
}else {
|
html1 += '<td>异常</td>';
|
$("#conState").html("异常");
|
}
|
html1 += s2;
|
}else if(item.passcode == 2){ //报警状态
|
html1 += s1;
|
if (item.value == "0") { //正常
|
html1 += '<td>正常</td>';
|
}else {
|
html1 += '<td>报警</td>';
|
$("#warnState").html("报警");
|
}
|
html1 += s2;
|
}else if(item.passcode == 3){
|
html1 += s1;
|
//电池总个数
|
var temp = item.value;
|
$("#sumNum").text(temp);
|
$(".info4").show();
|
html1 += '<td>' + temp + '</td>';
|
html1 += s2;
|
}else if(item.passcode == 196){
|
html1 += s1;
|
//总电流
|
var temp = item.value;
|
temp += " A";
|
$("#i01").text(temp);
|
$(".info1").show();
|
html1 += '<td>' + temp + '</td>';
|
html1 += s2;
|
}else if(item.passcode == 197){
|
html1 += s1;
|
//总电压
|
var temp = item.value;
|
temp += " V";
|
$("#u01").html(temp);
|
$(".info2").show();
|
html1 += '<td>' + temp + '</td>';
|
html1 += s2;
|
}else if(item.passcode == 198){
|
html1 += s1;
|
//电池续航时间
|
var temp = item.value;
|
temp += " min";
|
$("#dm01").text(temp);
|
$(".info3").show();
|
html1 += '<td>' + temp + '</td>';
|
html1 += s2;
|
}
|
|
});
|
|
|
$.each(batteryList,function(index,item){
|
if(item.u01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池电压</td>';
|
html1 += '<td>' + item.u01 + 'V</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
$.each(batteryList,function(index,item){
|
if(item.res01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池内阻</td>';
|
html1 += '<td>' + item.res01 + 'mΩ</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
$.each(batteryList,function(index,item){
|
if(item.t01){
|
html1 += '<tr>';
|
html1 += '<td>' + item.num + '号电池温度</td>';
|
html1 += '<td>' + item.t01 + '℃</td>';
|
html1 += '<td>' + time + '</td>';
|
html1 += '</tr>';
|
}
|
});
|
|
// console.log(batteryList);
|
|
//渲染右侧电池信息
|
if(batteryList !=null && batteryList.length>0){
|
$.each(batteryList,function(index,item){
|
if(item != null){
|
if(screen.width==1920 && screen.height==1080){
|
html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
}else if(screen.width==1280){
|
html2 += '<div class="layui-col-lg4 layui-col-md4">';
|
}else{
|
html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
}
|
// html2 += '<div class="layui-col-lg3 layui-col-md3">';
|
html2 += '<div class="battery">';
|
html2 += '<img src="./images/icon-battery2.png"/>';
|
html2 += '<div class="battery-info">';
|
html2 += '<p class="battery-text">序号:' + item.num + '</p>';
|
if(item.u01){
|
html2 += '<p class="battery-text">电压:' + item.u01 + '</p>';
|
}
|
if(item.res01){
|
html2 += '<p class="battery-text">内阻:' + item.res01 + '</p>';
|
}
|
if(item.t01){
|
html2 += '<p class="battery-text">温度:' + item.t01 + '</p>';
|
}
|
html2 += '</div></div></div>';
|
|
}
|
});
|
}
|
}else {
|
html1 += "<tr><td colspan='3'>暂无数据</td></tr>";
|
$("#deviceName").html("");
|
}
|
$("#deviceData").html(html1);
|
$("#deviceCommon").html(html2);
|
}
|
|
function test() {
|
var res = {};
|
var arr = [];
|
var time = "20240905121516";
|
var num = 48;
|
for(var i=1;i<=198;i++){
|
var it = {};
|
it.passcode = i;
|
it.name = "属性"+i;
|
if(i == 1 || i == 2){
|
it.value = 0;
|
}
|
else if(i == 3){
|
it.name = "电池个数";
|
it.value = num;
|
}
|
else if(i == 196){
|
it.name = "总电流";
|
it.value = 111.0;
|
}
|
else if(i == 197){
|
it.name = "总电压";
|
it.value = 222.0;
|
}
|
else if(i == 198){
|
it.name = "电池续航时间";
|
it.value = 1315.0;
|
}
|
else{
|
if(i>=4 && i<= 67){
|
if(i-3 <= num){
|
it.name = (i-3) + "号电池电压";
|
it.value = getRandomFloat(3, 30);
|
}else{
|
continue;
|
}
|
}
|
if(i>=68 && i<= 131){
|
if(i-67 <= num){
|
it.name = (i-67) + "号电池内阻";
|
it.value = getRandomFloat(1, 5);
|
}else{
|
continue;
|
}
|
}
|
if(i>=132 && i<= 195){
|
if(i-131 <= num){
|
it.name = (i-131) + "号电池温度";
|
it.value = getRandomFloat(5, 20);
|
it.value = null;
|
}else{
|
continue;
|
}
|
}
|
}
|
arr.push(it);
|
}
|
res.value = arr;
|
res.time = time;
|
|
return res;
|
}
|
|
// 生成一个介于min和max之间的随机浮点数
|
function getRandomFloat(min, max) {
|
var res = Math.random() * (max - min) + min;
|
res = res.toFixed(1);
|
return res;
|
}
|
</script>
|
|
<script src="./js/page/detail.js"></script>
|
|
</body>
|
</html>
|