<template>
|
<div data-name="history-vol" class="page">
|
<!-- Top Navbar -->
|
<div class="navbar">
|
<div class="navbar-inner">
|
<div class="left">
|
<a href="#" class="link back">
|
<i class="icon f7-icons">chevron_left</i>
|
</a>
|
</div>
|
<div class="title center">单体电压({{params.groupname}})</div>
|
<div class="right">
|
<a href="#" class="link ac"><i class="icon f7-icons">more_vertical</i></a>
|
</div>
|
</div>
|
</div>
|
<!-- Scrollable page content -->
|
<div class="page-content">
|
|
</div>
|
</div>
|
</template>
|
<style>
|
|
</style>
|
<script>
|
return {
|
data: function() {
|
var params = this.$route.params;
|
var str = getUrlStr({
|
groupid: params.groupid,
|
groupname: params.groupname,
|
count: params.count
|
});
|
var path = "/monitor/history/data/"+str;
|
var cView = app.views.current;
|
return {
|
params: params,
|
path: path,
|
cView: cView
|
}
|
},
|
methods: {
|
searchData: function() {
|
// 定义参数
|
var _this = this;
|
var params = this.params;
|
// 请求后台
|
$.ajax({
|
type: 'post',
|
async: true,
|
url: 'BatttestdataAction!findByInfo',
|
data: "btd.BattGroupId="+params.groupid+"&btd.test_record_count="+params.count,
|
dataType: 'json',
|
success: function(res) {
|
var rs = JSON.parse(res.result);
|
if(rs.code == 1) {
|
var data = rs.data;
|
var list = _this.formatData(data);
|
console.log(list);
|
}
|
}
|
});
|
},
|
formatData: function(list) {
|
var _this = this;
|
var rs = [];
|
var record = -1;
|
var index = -1;
|
var flag = false;
|
var start_record_num = list[0].record_num;
|
// 遍历结果集
|
for(var i=0;i<list.length;i++){
|
if(list[i].record_num != record){
|
rs[++index] = new Array();
|
|
if(list[i].record_num > start_record_num){
|
flag = true;
|
rs[index] = rs[index-1].slice(0);
|
}
|
record = list[i].record_num;
|
}
|
rs[index][list[i].mon_num-1] = list[i];
|
// 判断是否上一笔
|
if(flag){
|
_this.setArrayVal(list[i],rs[index]);
|
flag = false;
|
}
|
}
|
// 返回被格式化后的数组
|
return rs;
|
},
|
setArrayVal: function(obj, list) {
|
if(obj != undefined && list != undefined){
|
for(var i = 0; i<list.length;i++){
|
list[i].group_vol = obj.group_vol;
|
list[i].record_num = obj.record_num;
|
list[i].record_time = obj.record_time;
|
list[i].test_cap = obj.test_cap;
|
list[i].test_curr = obj.test_curr;
|
list[i].test_timelong = obj.test_timelong;
|
}
|
}
|
}
|
},
|
on: {
|
pageInit: function() {
|
var cView = this.cView;
|
var path = this.path;
|
// 查询数据
|
this.searchData();
|
|
// 菜单选择
|
var ac = app.actions.create({
|
convertToPopover: false,
|
buttons:[
|
{
|
text: "单体电压",
|
onClick: function() {
|
cView.router.navigate(path+"vol/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "单体实际容量",
|
onClick: function() {
|
cView.router.navigate(path+"real-cap/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "单体剩余容量",
|
onClick: function() {
|
cView.router.navigate(path+"res-cap/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "单体容量百分比",
|
onClick: function() {
|
cView.router.navigate(path+"cap-per/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "端电压折线图",
|
onClick: function() {
|
cView.router.navigate(path+"group-vol-line/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "电池电流折线图",
|
onClick: function() {
|
cView.router.navigate(path+"group-vol-line/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
{
|
text: "单体电压曲线图",
|
onClick: function() {
|
cView.router.navigate(path+"mon-vol-line/", {
|
reloadCurrent: true
|
});
|
}
|
},
|
]
|
});
|
|
// 点击ac显示选择内容
|
$$('.ac').click(function() {
|
ac.open();
|
});
|
}
|
}
|
}
|
</script>
|