From 024dc397e65ed55d7addbaf6fb153ce3f2548a6c Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期三, 15 四月 2026 11:34:25 +0800
Subject: [PATCH] 字段注入修改
---
fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html | 91 ++++++++++++++++++++++++++-------------------
1 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html b/fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html
index c844d48..f116b6e 100644
--- a/fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html
+++ b/fzzy-igdss-web/src/main/resources/templates/wx/warn-list.html
@@ -72,8 +72,8 @@
<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 deptList = [[${deptList}]];
var userName = [[${userName}]];
openid = [[${openid}]]; //鐢ㄦ埛鐨刼penid
SERVE_URL = location.href.split("/wx/")[0]; //鏈嶅姟鍩熷悕
@@ -82,6 +82,25 @@
var total;
var pageCount; //鎬婚〉鐮佹暟
var warnList; //姣忛〉鏁版嵁
+ var deptListMap = {};
+ $(function () {
+ //鎵�鏈夊簱鍖�
+ if (deptList) {
+ for (var i = 0; i < deptList.length; i++) {
+ deptListMap[deptList[i].id] = deptList[i];
+ }
+ }
+
+ // 鐩戝惉椤甸潰鏄剧ず浜嬩欢锛堝井淇� H5 鐜锛�
+ window.addEventListener('pageshow', function() {
+ if (localStorage.getItem('needRefresh') === 'true') {
+ localStorage.removeItem('needRefresh');
+ refreshData();
+ }
+ });
+
+ });
+
mui.init({
pullRefresh: {
@@ -101,12 +120,22 @@
}
});
+
//鍒濆鍑哄姞杞介〉闈㈡暟鎹�
function pullupRefresh() {
- $("#pullrefresh").addClass("head1");
+ $("#pullrefresh").addClass("head1");
//璇锋眰鑾峰彇鏁版嵁
getWarnData();
}
+
+ function refreshData() {
+ // 閲嶇疆鍒嗛〉鍙傛暟
+ pageNo = 1;
+
+ // 璋冪敤娴忚鍣ㄥ埛鏂�
+ location.reload();
+ }
+
//鍒濆鍖栭〉闈㈡暟鎹�
function initData() {
@@ -119,19 +148,16 @@
mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageNo>=pageCount));
var table = document.body.querySelector('.mui-table-view');
for (var i = 0; i < warnList.length; i++) {
+ var deptName = deptListMap[warnList[i].deptId] ? deptListMap[warnList[i].deptId].kqmc : warnList[i].deptId;
+ console.log(deptListMap);
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;
+ html += '<div class="mui-table-cell mui-col-xs-10"><h4 class="mui-ellipsis">' + warnList[i].id;
+ html += '</span></h4><h5>鎵�灞炲簱鍖猴細<span>' + deptName;
+ 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 +166,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("娌℃湁鏇村鏁版嵁浜嗭紒");
}
});
}
--
Gitblit v1.9.3