<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>粮情历史数据</title>
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
<link href="./css/mui.min.css" rel="stylesheet" />
|
<style>
|
.mui-content {
|
margin: 0 5px;
|
}
|
|
.mui-bar-nav {
|
background: #245ca7;
|
-webkit-box-shadow: none;
|
box-shadow: none;
|
}
|
|
.mui-title {
|
color: #FFFFFF;
|
}
|
|
.mui-icon-back:before,
|
.mui-icon-left-nav:before {
|
color: #FFFFFF;
|
}
|
|
.mui-content>.mui-table-view:first-child {
|
margin-top: -1px;
|
}
|
|
.mui-table-view-chevron .mui-table-view-cell {
|
padding-right: 0px;
|
}
|
|
.mui-col-xs-10 {
|
width: 100%;
|
}
|
|
.mui-h4,
|
h4 {
|
font-size: 17px;
|
font-weight: 600;
|
}
|
|
.first {
|
color: #C7254E;
|
font-size: 15px;
|
float: right;
|
margin-right: 50px;
|
}
|
|
.mui-h5,
|
h5 {
|
font-size: 14px;
|
font-weight: 400;
|
color: #333;
|
}
|
|
.mui-table-view-cell p {
|
color: #333;
|
}
|
|
.mui-scroll-wrapper {
|
width: unset;
|
}
|
|
.mui-navigate-right:after,
|
.mui-push-right:after {
|
right: 10px;
|
top: -5px;
|
font-size: 25px;
|
|
}
|
.mui-pull-bottom-tips{
|
display: none;
|
}
|
|
.f1 {
|
width: 33.33%;
|
float: left;
|
}
|
</style>
|
</head>
|
<body>
|
<header class="mui-bar mui-bar-nav">
|
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
<h1 class="mui-title"><span id="depotName"></span>—粮情历史数据</h1>
|
</header>
|
<div class="mui-content">
|
<!--下拉刷新容器-->
|
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
|
<!--数据列表-->
|
<ul class="mui-table-view mui-table-view-chevron">
|
<!-- <li class="mui-table-view-cell">
|
<div onclick="toWarnDetail('1')" class="mui-table">
|
<div class="mui-table-cell mui-col-xs-10">
|
<h4 class="mui-ellipsis">检测时间:2021-01-01 01:01</h4>
|
<h5 class="f1">粮均温:<span>44</span></h5>
|
<h5 class="f1">粮高温:<span>44</span></h5>
|
<h5 class="f1">粮低温:<span>44</span></h5>
|
<h5 class="f1">仓内温:<span>33</span></h5>
|
<h5 class="f1"> </h5>
|
<h5 class="f1">仓内湿:<span>44</span></h5>
|
<h5 class="f1">仓外温:<span>33</span></h5>
|
<h5 class="f1"> </h5>
|
<h5 class="f1">仓外湿:<span>44</span></h5>
|
</div>
|
<div class="mui-col-xs-2"><a class="mui-navigate-right"></a></div>
|
</div>
|
</li> -->
|
</ul>
|
</div>
|
</div>
|
<script src="./js/mui.js"></script>
|
<script src="./js/jquery.min.js"></script>
|
<script src="./js/echarts.min.js"></script>
|
<script type="text/javascript" charset="utf-8">
|
var user;
|
var url;
|
var depotId;
|
var depotName;
|
var depotType;
|
var historyList;
|
var dataList = [];
|
var tagCount = 0;
|
var pageNo = 0; //页码
|
var tagStop = false;
|
var data = {
|
"interfaceId": "5310",
|
"sign": "10310",
|
"outId": "10310",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"type": "",
|
"pageSize": "10",
|
"pageNo": "",
|
"depotId": ""
|
}
|
};
|
mui.init({
|
pullRefresh: {
|
container: '#pullrefresh',
|
down: {
|
// style: 'circle',
|
// callback: pullupRefresh //下拉刷新
|
},
|
up: {
|
auto: true,
|
contentrefresh: '正在加载...',
|
callback: pullupRefresh //上滑刷新
|
},
|
preventDefaultException: {
|
className: /^mui-/
|
}
|
}
|
});
|
|
mui.plusReady(function() {
|
var curr = plus.webview.currentWebview();
|
user = JSON.parse(localStorage.getItem('user'));
|
url = user.url + "/api-phone/gateway";
|
depotId = curr.depotId
|
depotName = curr.depotName
|
depotType = curr.depotType
|
data.tokenAuth = user.tokenAuth;
|
data.data.depotId = depotId;
|
data.data.type = depotType;
|
$("#depotName").html(depotName);
|
})
|
|
//初始出加载页面数据
|
function pullupRefresh() {
|
//请求获取数据
|
getHistoryList();
|
}
|
|
function getHistoryList() {
|
//获取查询页参数
|
pageNo += 1;
|
data.data.pageNo = pageNo;
|
//请求
|
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") {
|
historyList = result.data;
|
if (historyList != null && historyList.length > 0) {
|
renderData();
|
}else{
|
tagStop = true;
|
mui.toast("没有更多数据!");
|
}
|
} else {
|
tagStop = true;
|
mui.toast("没有更多数据!");
|
}
|
},
|
error: function() {
|
mui.toast('系统繁忙,请重试!');
|
}
|
})
|
}
|
|
//渲染页面
|
function renderData() {
|
//初始化数据到页面
|
mui('#pullrefresh').pullRefresh().endPullupToRefresh((tagStop));
|
var table = document.body.querySelector('.mui-table-view');
|
$.each(historyList, function(index, item) {
|
dataList.push(item);
|
var li = document.createElement('li');
|
li.className = 'mui-table-view-cell';
|
var html = '';
|
html += '<div onclick="toDetail(\'' + tagCount + '\')" class="mui-table">';
|
html += '<div class="mui-table-cell mui-col-xs-10"><h4 class="mui-ellipsis">检测时间:' +
|
item.receiveDate + '</h4>';
|
html += '<h5 class="f1">粮均温:' + item.tempAve + '℃</h5>';
|
html += '<h5 class="f1">粮高温:' + item.tempMax + '℃</h5>';
|
html += '<h5 class="f1">粮低温:' + item.tempMin + '℃</h5>';
|
html += '<h5 class="f1">仓内温:' + item.tempIn + '℃</h5>';
|
html += '<h5 class="f1"></h5>';
|
html += '<h5 class="f1">仓内湿:' + item.humidityIn + '%</h5>';
|
html += '<h5 class="f1">仓外温:' + item.tempOut + '℃</h5>';
|
html += '<h5 class="f1"></h5>';
|
html += '<h5 class="f1">仓外湿:' + item.humidityOut + '%</h5>';
|
html += '</div><div class="mui-col-xs-2"><a class="mui-navigate-right"></a></div></div>';
|
li.innerHTML = html;
|
table.appendChild(li);
|
tagCount ++;
|
})
|
}
|
|
//查看详情页面
|
function toDetail(index) {
|
if (depotType == '01') {
|
//平房仓粮情
|
mui.openWindow({
|
url: "grain-detail-bungalow-his.html",
|
id: "grain-detail-bungalow-his",
|
extras: {
|
data: dataList[index],
|
depotName: depotName
|
}
|
})
|
} else if (depotType == '02' || depotType == '04') {
|
//圆筒仓粮情
|
mui.openWindow({
|
url: "grain-detail-drum-his.html",
|
id: "grain-detail-drum-his",
|
extras: {
|
data: dataList[index],
|
depotName: depotName
|
}
|
})
|
} else {
|
mui.alert('暂无权限!', '提示');
|
}
|
}
|
</script>
|
</body>
|
</html>
|