var url = null; var depotList = null; var data = { "interfaceId": "5102", "sign": "10102", "outId": "10102", "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; getData(); } //获取仓库信息 function getData() { //发送请求获取仓库信息 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") { depotList = result.data; console.log(JSON.stringify(depotList)) renderDepotList(); } else { mui.alert(result.msg, '提示', ["确定"], function() {}, "div"); } }, error: function() { mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div"); } }) } //渲染 function renderDepotList() { var html = ''; if(depotList && depotList.length > 0){ $.each(depotList, function(index, item) { html += '
  • '; html += '
    仓库名称:' + (item.name == null?"--":item.name) + '
    '; html += '
    '; html += '
    '; html += (item.depotTypeName == null?"--":item.depotTypeName) + '
    仓库类型
    '; html += '
    '; html += (item.depotStatusName == null?"--":item.depotStatusName) + '
    仓库状态
    '; html += '
    '; html += (item.storageReal == null?"--":item.storageReal) + ' KG
    实际储量
    '; html += '
    粮食品种
    '; html += '
    ' + (item.foodVarietyName == null?"--":item.foodVarietyName) + '
    '; html += '
    保管员
    '; html += '
    ' + (item.storeKeeperName == null?"--":item.storeKeeperName) + '
  • '; }) }else{ html += '
  • '; html += '
    暂无仓库数据
    '; html += '
    '; html += '
    '; html += '--
    仓库类型
    '; html += '
    '; html += '--
    仓库状态
    '; html += '
    '; html += '-- KG
    实际储量
    '; html += '
    粮食品种
    '; html += '
    --
    '; html += '
    保管员
    '; html += '
    --
  • '; } $("#depotList").html(html); } //滑动 mui('.mui-scroll-wrapper').scroll({ indicators: false, //是否显示滚动条 deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏 bounce: false, //是否启用回弹 deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006 });