sgj
11 小时以前 67b2e6a3b7e4254be92e3ecbcd7b6e9f61b3aae3
fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html
@@ -72,7 +72,6 @@
<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
@@ -82,6 +81,17 @@
    var total;
    var pageCount;  //总页码数
    var warnList;  //每页数据
    $(function () {
        // 监听页面显示事件(微信 H5 环境)
        window.addEventListener('pageshow', function() {
            if (localStorage.getItem('needRefresh') === 'true') {
                localStorage.removeItem('needRefresh');
                refreshData();
            }
        });
    });
    mui.init({
        pullRefresh: {
@@ -101,12 +111,22 @@
        }
    });
    //初始出加载页面数据
    function pullupRefresh() {
            $("#pullrefresh").addClass("head1");
        $("#pullrefresh").addClass("head1");
        //请求获取数据
        getWarnData();
    }
    function refreshData() {
        // 重置分页参数
        pageNo = 1;
        // 调用浏览器刷新
        location.reload();
    }
    //初始化页面数据
    function initData() {
@@ -123,15 +143,10 @@
            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;
            html += '<div class="mui-table-cell mui-col-xs-10"><h4 class="mui-ellipsis">' + warnList[i].id;
            html += '</span></h4><h5>所属库区:<span>' + warnList[i].deptId;
            html += '</span></h5><h5>警告时间:<span>' + warnList[i].createTime;
            html += '</span></h5><p class="mui-h6 mui-ellipsis">警告说明:' +warnList[i].content;
            li.innerHTML = html;
            table.appendChild(li);
        }
@@ -140,34 +155,21 @@
    //请求获取警告数据
    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("没有更多数据了!");
                }
        var data = {
            "userName": userName,
            "loginType": loginType,
            "openid": openid,
            "pageSize": pageSize,
            "pageNo": pageNo
        };
        wxCommon.postJson("../wx/getSnapReplyPage", data,function (result) {
            if (result.code == "0000") {
                warnList = null;
                warnList = result.data.records;
                pageCount = getPageCount (result.data.total,pageSize);
                initData();
            } else {
                mui.toast("没有更多数据了!");
            }
        });
    }