<!DOCTYPE html>
|
<html lang="zh-cn" xmlns:th=http://www.thymeleaf.org>
|
<head>
|
<meta charset="utf-8">
|
<title>设备警告</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<link rel="stylesheet" th:href="@{/ajax/libs/mui/css/mui.min.css}">
|
<style type="text/css">
|
.mui-content{
|
margin: 0 6px;
|
}
|
.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;
|
}
|
.first1{
|
color: #C7254E;
|
float: right;
|
margin-right: 50px;
|
font-size: 15px;
|
}
|
.first2{
|
float: right;
|
margin-right: 50px;
|
font-size: 15px;
|
}
|
.mui-h5, h5 {
|
font-size: 14px;
|
font-weight: 400;
|
color: #333;
|
margin: 10px 0;
|
}
|
.mui-table-view-cell p {
|
color: #333;
|
}
|
.mui-scroll-wrapper {
|
width: unset;
|
}
|
.head{
|
margin-top: 44px;
|
}
|
.head1{
|
margin-top: -44px;
|
}
|
</style>
|
</head>
|
|
<body>
|
<div id="head">
|
|
</div>
|
<div id="content" class="mui-content">
|
<!--下拉刷新容器-->
|
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
|
<!--数据列表-->
|
<ul class="mui-table-view mui-table-view-chevron"></ul>
|
</div>
|
</div>
|
<script th:src="@{/js/jquery.min.js}"></script>
|
<script th:src="@{/wx/wx-common.js}"></script>
|
<script th:src="@{/ajax/libs/mui/js/mui.js}"></script>
|
<script th:inline="javascript">
|
|
var loginType = [[${loginType}]]; //登录方式
|
var userName = [[${userName}]];
|
openid = [[${openid}]]; //用户的openid
|
SERVE_URL = location.href.split("/wx/")[0]; //服务域名
|
var pageSize = 10; //每页条数
|
var pageNo = 1; //页码
|
var total;
|
var pageCount; //总页码数
|
var warnList; //每页数据
|
|
mui.init({
|
pullRefresh: {
|
container: '#pullrefresh',
|
down: {
|
// style: 'circle',
|
// callback: pullupRefresh //下拉刷新
|
},
|
up: {
|
auto: true,
|
contentrefresh: '正在加载...',
|
callback: pullupRefresh //上滑刷新
|
},
|
preventDefaultException: {
|
className: /^mui-/
|
}
|
}
|
});
|
|
//初始出加载页面数据
|
function pullupRefresh() {
|
$("#pullrefresh").addClass("head1");
|
//请求获取数据
|
getWarnData();
|
}
|
|
//初始化页面数据
|
function initData() {
|
if(warnList == null || warnList.length<1){
|
mui.toast("没有更多数据了!");
|
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
return;
|
}
|
//初始化数据到页面
|
mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageNo>=pageCount));
|
var table = document.body.querySelector('.mui-table-view');
|
for (var i = 0; i < warnList.length; i++) {
|
var li = document.createElement('li');
|
li.className = 'mui-table-view-cell';
|
var html = '';
|
html += '<div onclick="toWarnDetail(\'' + warnList[i].id +'\',\'' + warnList[i].companyId + '\')" class="mui-table">';
|
html += '<div class="mui-table-cell mui-col-xs-10"><h4 class="mui-ellipsis">' + warnList[i].warnTitle;
|
// if(warnList[i].warnStatus == '10' || warnList[i].warnStatus == '20'){
|
// html += '<span class="first1">' + warnList[i].warnStatusName;
|
// }else {
|
// html += '<span class="first2">' + warnList[i].warnStatusName;
|
// }
|
html += '</span></h4><h5>所属库区:<span>' + warnList[i].deviceName;
|
html += '</span></h5><h5>警告时间:<span>' + warnList[i].warnTime;
|
html += '</span></h5><p class="mui-h6 mui-ellipsis">警告说明:' +warnList[i].warnInfo;
|
li.innerHTML = html;
|
table.appendChild(li);
|
}
|
pageNo += 1;
|
}
|
|
//请求获取警告数据
|
function getWarnData() {
|
var data = JSON.stringify({
|
"interfaceId": "app_1008",
|
"sign": "01",
|
"outId": "01-01",
|
"reqDateTime": new Date(),
|
"data": {
|
"userName": userName,
|
"loginType": loginType,
|
"openid": openid,
|
"pageSize": pageSize,
|
"pageNo": pageNo
|
}
|
});
|
$.ajax({
|
type: "POST",
|
url: "../wx/gateway",
|
dataType: "json",
|
contentType: "application/json;charset=UTF-8",
|
data: data,
|
success: function (result) {
|
if (result.code == "0000") {
|
warnList = null;
|
warnList = result.data.records;
|
pageCount = getPageCount (result.data.total,pageSize);
|
initData();
|
} else {
|
mui.toast("没有更多数据了!");
|
}
|
}
|
});
|
}
|
|
//计算总页码
|
function getPageCount (total,limit){
|
return total > 0 ? ((total < limit) ? 1 : ((total % limit) ? (parseInt(total / limit) + 1) : (total / limit))) : 0;
|
}
|
|
//查看警告详情页面
|
function toWarnDetail(warnId,companyId) {
|
location.href = SERVE_URL +
|
'/wx/view-gateway?state=warn-detail&id='+ warnId + '&companyId=' + companyId + '&loginType=' + loginType + '&userName=' + userName;
|
}
|
|
</script>
|
</body>
|
|
</html>
|