| | |
| | | "tokenAuth": "", |
| | | "data": { |
| | | "deptId": "", |
| | | "dataTime": "" |
| | | "dateTime": "" |
| | | } |
| | | }; |
| | | |
| | | function init() { |
| | | var user = JSON.parse(localStorage.getItem('user')); |
| | | var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); |
| | | url = user.url + "/api-phone/v35/gateway"; |
| | | url = user.url + "/api/phone/v35/gateway"; |
| | | data.tokenAuth = user.tokenAuth; |
| | | data.data.deptId = selectDeptId; |
| | | dateTime = getDate(new Date()); |
| | |
| | | getMeterList(); |
| | | } |
| | | |
| | | //日期格式化yyyy-MM-dd |
| | | function getDate(date) { |
| | | var year = date.getFullYear(); |
| | | var month, day; |
| | |
| | | type: "date", //设置日历初始视图模式 |
| | | // beginDate: new Date(2015, 04, 25), //设置开始日期 |
| | | // endDate: new Date(2016, 04, 25), //设置结束日期 |
| | | |
| | | value:dateTime |
| | | }) |
| | | var time = dateTime; |
| | | dtpicker.show(function(e) { |
| | | dateTime = e.value; |
| | | document.getElementById("date").value = e.value |
| | | getMeterList(); |
| | | if(time != dateTime){ |
| | | getMeterList(); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //加减日期(天数) |
| | | function addAndReduceDay(tag) { |
| | | var date = new Date(dateTime); |
| | | date = date.setDate(date.getDate() + tag); |
| | |
| | | |
| | | } |
| | | |
| | | // |
| | | //渲染页面 |
| | | function getMeterList() { |
| | | // |
| | | data.data.dataTime = dateTime |
| | | //赋值参数的日期 |
| | | data.data.dateTime = dateTime |
| | | mui.ajax(url, { |
| | | type: "POST", |
| | | dataType: "json", |
| | |
| | | mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div") |
| | | } |
| | | }) |
| | | |
| | | } |
| | | //渲染页面 |
| | | function renderData() { |
| | | var html = '' |
| | | if (meterList && meterList.length > 0) { |
| | | $.each(meterList, function(index, item) { |
| | | html += '<div class="m-ck-cont"><div class="g-titck1">' + item.depotName + ' <span class="right">更新时间: ' + item.updateTime + '</span></div>'; |
| | | html += '<div class="m-ck-cont"><div class="g-titck1">' + item.depotName + |
| | | ' <span class="right">更新时间: ' + item.updateTime + '</span></div>'; |
| | | html += '<div class="m-energy2"><ul class="ul-txtliste1"><li><div class="con">'; |
| | | html += '<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>' |
| | | html += '<div class="desc">无功电能</div></div></li>'; |
| | | html += '<li><div class="con"><div class="num">' + item.esSum + ' <span>KWh</span></div>'; |
| | | html += '<div class="desc">总电能</div></div></li>' |
| | | html += '<div class="num">' + item.epSum + |
| | | '</div><div class="desc">有功电能(KWh)</div></div></li>'; |
| | | html += '<li><div class="con"><div class="num">' + item.eqSum + '</div>' |
| | | html += '<div class="desc">无功电能(KWh)</div></div></li>'; |
| | | html += '<li><div class="con"><div class="num">' + (item.esSum == null || item.esSum == "" ? "--" : item.esSum) + '</div>'; |
| | | html += '<div class="desc">总电能(KWh)</div></div></li>' |
| | | html += '</ul></div></div>'; |
| | | }) |
| | | } else { |
| | | html += |
| | | '<div class="m-ck-cont"><div style="text-align: center;font-size: 20px;color:#dd524d;">暂无远程抄表信息</div></div>'; |
| | | html += '<div class="m-ck-cont"><div class="g-titck1">暂无信息 <span class="right">更新时间: ' + dateTime + '</span></div>'; |
| | | html += '<div class="m-energy2"><ul class="ul-txtliste1"><li><div class="con">'; |
| | | html += '<div class="num">0<span> KWh</span></div><div class="desc">有功电能</div></div></li>'; |
| | | html += '<li><div class="con"><div class="num">0<span> KWh</span></div>' |
| | | html += '<div class="desc">无功电能</div></div></li>'; |
| | | html += '<li><div class="con"><div class="num">0<span> KWh</span></div>'; |
| | | html += '<div class="desc">总电能</div></div></li>' |
| | | html += '</ul></div></div>'; |
| | | |
| | | } |
| | | // $("#recordList").html(html); |
| | | $("#recordList").html(html); |
| | | } |
| | | |
| | | mui('.mui-scroll-wrapper').scroll({ |