var url = null;
|
var startTime;
|
var endTime = "";
|
var esDetailList;
|
var data = {
|
"interfaceId": "5503",
|
"outId": "10503",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"deptId": "",
|
"depotId": "",
|
"startTime": "",
|
"endTime": ""
|
}
|
};
|
|
function init() {
|
var user = JSON.parse(localStorage.getItem('user'));
|
var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
|
url = user.url + "/api-phone/v35/gateway";
|
data.tokenAuth = user.tokenAuth;
|
data.data.deptId = selectDeptId;
|
startTime = getDate(new Date());
|
document.getElementById("start").value = startTime;
|
getEsDetailList();
|
}
|
|
function getDate(date) {
|
var year = date.getFullYear();
|
var month, day;
|
month = date.getMonth() + 1;
|
if (month > 0 && month <= 9) {
|
month = "0" + month;
|
}
|
day = date.getDate()
|
if (day > 0 && day <= 9) {
|
day = "0" + day
|
}
|
return year + "-" + month + "-" + day
|
}
|
|
function chooseStartDate() {
|
var dtpicker = new mui.DtPicker({
|
type: "date", //设置日历初始视图模式
|
// beginDate: new Date(2015, 04, 25), //设置开始日期
|
// endDate: new Date(2016, 04, 25), //设置结束日期
|
value: startTime
|
})
|
var start = startTime;
|
dtpicker.show(function(e) {
|
startTime = e.value
|
document.getElementById("start").value = e.value
|
if (start != startTime) {
|
getEsDetailList();
|
}
|
})
|
}
|
|
function chooseEndDate() {
|
var dtpicker = new mui.DtPicker({
|
type: "date", //设置日历初始视图模式
|
// beginDate: new Date(2015, 04, 25), //设置开始日期
|
// endDate: new Date(2016, 04, 25), //设置结束日期
|
value: endTime
|
})
|
var end = endTime;
|
dtpicker.show(function(e) {
|
endTime = e.value;
|
document.getElementById("end").value = e.value
|
if (end != endTime) {
|
getEsDetailList();
|
}
|
})
|
}
|
|
function getEsDetailList() {
|
data.data.startTime = startTime
|
data.data.endTime = endTime
|
console.log(JSON.stringify(data.data))
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data),
|
success: function(result) {
|
if (result.code == "0000") {
|
esDetailList = result.data;
|
renderData();
|
} else {
|
renderData();
|
mui.toast(result.msg);
|
}
|
},
|
error: function() {
|
mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
|
}
|
})
|
esDetailList = [{
|
"depotId": "16",
|
"depotName": "值话各元",
|
"startEs": "31",
|
"endEs": "56",
|
"epSum": "13",
|
"eqSum": "37",
|
"esSum": "25"
|
},
|
{
|
"depotId": "2",
|
"depotName": "划点王数队",
|
"startEs": "55",
|
"endEs": "47",
|
"epSum": "46",
|
"eqSum": "42",
|
"esSum": "59"
|
},
|
{
|
"depotId": "34",
|
"depotName": "和多断们",
|
"startEs": "78",
|
"endEs": "24",
|
"epSum": "37",
|
"eqSum": "73",
|
"esSum": "83"
|
}
|
]
|
}
|
|
mui('.mui-content').on("tap", ".g-sobox div button", function() {
|
data.data.depotId = document.getElementById("search").value
|
getEsDetailList()
|
})
|
|
|
//渲染页面
|
function renderData() {
|
var html = '';
|
if (esDetailList && esDetailList.length > 0) {
|
$.each(esDetailList, function(index, item) {
|
html += '<div class="wp"><div class="m-ck-cont"><div class="g-titck1">' + item.depotName + '</div>'
|
html += '<div class="m-energy1"><div class="inner"><div class="con con1">'
|
html += '<div class="num"><div class="l"></div>' + item.startEs +
|
' <span>KWh</span></div><div class="desc">起始能耗</div></div></div>'
|
html += '<div class="inner"><div class="con con2">'
|
html += '<div class="num"><div class="l"></div>' + item.endEs +
|
' <span>KWh</span></div><div class="desc">截止能耗</div></div></div></div>'
|
html += '<div class="m-energy2"><div class="tit">能耗统计信息</div><ul class="ul-txtliste1">'
|
html += '<li><div class="con"><div class="num">' + item.epSum +
|
' <span>KWh</span></div><div class="desc">有功电能</div></div></li>'
|
html += '<li><div class="con"><div class="num">' + item.eqSum +
|
' <span>KWh</span></div><div class="desc">无功电能</div></div></li>'
|
html += '<li><div class="con"><div class="num">' + item.esSum +
|
' <span>KWh</span></div><div class="desc">总电能</div></div></li>'
|
html += '</ul></div></div></div>'
|
})
|
} else {
|
html +=
|
'<div class="wp"><div class="m-ck-cont"><div style="text-align: center;font-size: 20px;color:#dd524d;">暂无能耗详情信息</div></div></div>';
|
}
|
$("#recordList").html(html);
|
}
|
|
mui('.mui-scroll-wrapper').scroll({
|
indicators: false, //是否显示滚动条
|
deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
|
bounce: false, //是否启用回弹
|
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
});
|