var url; var electricList; var data = { "interfaceId": "5501", "outId": "10501", "reqDateTime": new Date(), "tokenAuth": "", "data": { "deptId": "" } }; 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; getElectric(); } function getElectric() { 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") { electricList = result.data; renderData(); } else { renderData(); mui.toast(result.msg); console.log(JSON.stringify(result)) } }, error: function() { mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div") } }) electricList = [{ "depotId": "18", "depotName": "做一几加", "ua": 97, "ub": 43, "uc": 81, "ia": 85, "ib": 76, "ic": 43, "updateTime": "1982-03-19 23:26:43" }, { "depotId": "35", "depotName": "层能比维", "ua": 71, "ub": 60, "uc": 45, "ia": 22, "ib": 42, "ic": 12, "updateTime": "1980-11-10 20:35:36" }, { "depotId": "61", "depotName": "从周阶红全", "ua": 88, "ub": 94, "uc": 77, "ia": 33, "ib": 83, "ic": 67, "updateTime": "1972-03-23 06:15:44" }, { "depotId": "31", "depotName": "火五况斯术应压", "ua": 76, "ub": 76, "uc": 68, "ia": 80, "ib": 54, "ic": 2, "updateTime": "2010-02-02 15:07:12" }, { "depotId": "20", "depotName": "话美书着具来则", "ua": 96, "ub": 5, "uc": 83, "ia": 74, "ib": 49, "ic": 37, "updateTime": "2007-11-02 05:03:29" } ] } //渲染页面 function renderData() { var html = ''; if (electricList && electricList.length > 0) { $.each(electricList, function(index, item) { html += '
  • '; if (index % 3 == 0) { html += ''; } if (index % 3 == 1) { html += '' } if (index % 3 == 2) { html += '' } html += '' + item.depotName + '
    ' + item.updateTime + '
    '; html += '
    最近一小时用能: 10.0KW-h
    '; html += '
    ' + item.ua + ' V
    A相电压
    '; html += '
    ' + item.ub + ' V
    B相电压
    '; html += '
    ' + item.uc + ' V
    B相电压
    '; html += '
    ' + item.ia + ' V
    A相电流
    '; html += '
    ' + item.ib + ' V
    B相电流
    '; html += '
    ' + item.ic + ' V
    C相电流
    '; html += '
  • ' }) } else { html += '
  • 暂无实时配电信息
  • '; } $("#recordList").html(html); } var slider = mui(".mui-slider"); slider.slider({ interval: 3000 }); mui('.mui-scroll-wrapper').scroll({ indicators: false, //是否显示滚动条 deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏 bounce: false, //是否启用回弹 deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006 });