var url = null; var dateTime; var heightList = null; var data = { "interfaceId": "5206", "tokenAuth": "", "outId": "10206", "reqDateTime": new Date(), "data": { "deptId": "", "dataTime": "" } }; function init() { var user = JSON.parse(localStorage.getItem('user')); var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); data.tokenAuth = user.tokenAuth; data.data.deptId = selectDeptId; url = user.url + "/api/phone/v1/gateway"; //获取警告记录 getHeightList(); } //获取警告记录 function getHeightList() { warnData = null; //赋值参数的日期 //请求 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") { heightList = result.data; renderHeight(); } else { renderHeight(); mui.toast(result.msg); console.log(JSON.stringify(result)) } }, error: function() { mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div") } }) } //渲染页面 function renderHeight() { var html = ''; if (heightList && heightList.length > 0) { console.log(JSON.stringify(heightList)) $.each(heightList, function(index, item) { html += '
  • 库区名称: '+item.deptName+'
    '; html += '
    '+item.depotData.name+'
    仓房名称
    '; html += '
    '+item.depotData.foodVarietyName+'
    粮食品种
    '; html += '
    '+item.height+' 米
    高度
    '; html += '
    计算储量: '+item.weight+' KG
    '; html += '
    检测时间: '+item.receiveDate+'
  • '; }) } else { html += '
  • 库区名称: --
    '; html += '
    --
    仓房名称
    '; html += '
    --
    粮食品种
    '; html += '
    -- 米
    高度
    '; html += '
    计算储量: -- KG
    '; html += '
    检测时间: --
  • '; } $("#recordList").html(html); } //滑动 mui('.mui-scroll-wrapper').scroll({ indicators: true, //是否显示滚动条 deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏 bounce: false, //是否启用回弹 deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006 });