<!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-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;
|
}
|
|
.pest_title {
|
background: #fff;
|
border-bottom: 1px #efefef solid;
|
padding: 20px;
|
box-sizing: border-box;
|
width: 96%;
|
margin: auto;
|
}
|
|
.pest_title strong {
|
display: block;
|
text-align: center;
|
color: #245ca7;
|
font-size: 16px;
|
}
|
|
.pest_title span {
|
display: block;
|
text-align: center;
|
padding: 5px 0;
|
font-size: 14px;
|
}
|
|
.pest_table {
|
width: 96%;
|
margin: auto;
|
margin-top: 6px;
|
}
|
|
.pest_table table {
|
width: 100%;
|
background-color: #fff !important
|
}
|
|
.pest_table th {
|
border-top: 1px #efefef solid !important;
|
font-size: 15px;
|
text-align: center;
|
}
|
|
.pest_table tr {
|
font-size: 14px;
|
text-align: center;
|
line-height: 35px;
|
}
|
|
.pest_table td {
|
border-top: 1px #efefef solid !important;
|
}
|
|
.pest_table .yello {
|
color: #ffa800;
|
}
|
|
.pest_table .red {
|
color: #f00;
|
}
|
|
.pest_table .blue {
|
color: #0020c1;
|
}
|
|
.pest_table .green {
|
color: #1c7430;
|
}
|
|
|
.pest_btn {
|
display: block;
|
text-align: center;
|
}
|
|
.pest_btn button {
|
background: #668dc1;
|
color: #fff;
|
border: 0px;
|
border-radius: 3px;
|
height: 44px;
|
line-height: 44px;
|
padding: 0 20px;
|
margin: 10px 0;
|
}
|
</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 class="pest_title">
|
<strong>虫害检测记录</strong>
|
</div>
|
<div class="pest_table">
|
<table>
|
<thead>
|
<tr>
|
<th width="25%">检测时间</th>
|
<th width="25%" class="red">总检测位</th>
|
<th width="25%" class="blue">虫害数量</th>
|
<th width="25%" class="green">检测结果</th>
|
</tr>
|
</thead>
|
<tbody id="pestList">
|
<!-- <tr>
|
<td>01-01 01:01</td>
|
<td class="red">##</td>
|
<td class="blue">##</td>
|
<td class="green">##</td>
|
</tr> -->
|
</tbody>
|
</table>
|
</div>
|
<div class="pest_btn">
|
<button onclick="gatherPest()">虫害采集</button>
|
</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">
|
mui.init();
|
var url; //接口路径
|
var pestData; //集合
|
//虫害展示接口数据
|
var data1 = {
|
"interfaceId": "5308",
|
"sign": "10308",
|
"outId": "10308",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"depotId": "",
|
"type": ""
|
}
|
};
|
//虫害采集的参数
|
var data2 = {
|
"interfaceId": "5309",
|
"sign": "10309",
|
"outId": "10309",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"depotId": ""
|
}
|
};
|
|
mui.plusReady(function() {
|
//获取仓库参数,如仓库Id,仓库类型和仓库名称
|
var curr = plus.webview.currentWebview();
|
$("#depotName").html(curr.depotName);
|
//获取接口路径及tokenAuth
|
var user = JSON.parse(localStorage.getItem('user'))
|
//请求参数赋值
|
data1.tokenAuth = user.tokenAuth;
|
data1.data.depotId = curr.depotId;
|
data1.data.type = curr.depotType;
|
data2.tokenAuth = user.tokenAuth;
|
data2.data.depotId = curr.depotId;
|
url = user.url + "/api-phone/gateway";
|
//查询仓库虫害信息
|
getPestData();
|
})
|
|
//获取仓库信息
|
function getPestData() {
|
//发送请求获取仓库信息
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data1),
|
success: function(result) {
|
if (result.code == "0000") {
|
pestData = result.data;
|
if (pestData != null && pestData.length > 0) {
|
renderPestList();
|
} else {
|
mui.alert("暂无检测记录!", '提示',["确定"],function(){},"div");
|
}
|
} else {
|
mui.alert('无虫害检测记录!', '提示',["确定"],function(){},"div");
|
}
|
},
|
error: function() {
|
mui.alert('系统繁忙,请重试!', '提示',["确定"],function(){},"div");
|
}
|
})
|
}
|
|
//渲染
|
function renderPestList() {
|
var html = '';
|
$.each(pestData, function(index, item) {
|
html += '<tr><td>' + item.receiveDate + '</td>';
|
html += '<td class="red">' + item.checkNum + '</td>';
|
html += '<td class="blue">' + item.pestNum + '</td>';
|
html += '<td class="green">' + item.isPest + '</td></tr>';
|
})
|
$("#pestList").html(html);
|
}
|
//虫害采集
|
function gatherPest() {
|
//发送请求采集气体
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data2),
|
success: function(data) {
|
if (data.code == "0000") {
|
mui.alert('采集命令发送成功,请等待30秒重新打开此页面查看采集数据!', '提示',["确定"],function(){},"div");
|
} else {
|
mui.alert(data.msg, '提示',["确定"],function(){},"div");
|
}
|
},
|
error: function() {
|
mui.alert('系统繁忙,请重试!', '提示',["确定"],function(){},"div");
|
}
|
})
|
}
|
</script>
|
</body>
|
</html>
|