From cfa35ff1f39c2a7b69d624d45f8e05591f3375d4 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 30 三月 2026 11:49:29 +0800
Subject: [PATCH] 调整 报工平台,添加定时刷新功能。模块添加定时器管理模块
---
WebTM/views/IpadIndex.html | 201 +++++++++++++++++++++++++++++++------------------
1 files changed, 127 insertions(+), 74 deletions(-)
diff --git a/WebTM/views/IpadIndex.html b/WebTM/views/IpadIndex.html
index d75a497..243c8aa 100644
--- a/WebTM/views/IpadIndex.html
+++ b/WebTM/views/IpadIndex.html
@@ -56,7 +56,7 @@
base: '../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
}).extend({
index: 'lib/index' //涓诲叆鍙fā鍧�
- }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+ }).use(['index', 'form', 'laydate', 'table', 'element', "timerManager"], function () {
var $ = layui.$
, admin = layui.admin
, layer = layui.layer
@@ -64,6 +64,7 @@
, form = layui.form
, laydate = layui.laydate
, element = layui.element
+ , timerManager = layui.timerManager
;
//window 鍏ㄥ眬鍙橀噺
window.mychart1 = echarts.init(document.getElementById('mychart1'));
@@ -75,9 +76,67 @@
mychart2.resize();
})
+ // 閰嶇疆 寮瑰嚭灞� 鎵撳紑/鍏抽棴澶勭悊鍑芥暟
+ InitLayerConfig()
+
TSLoad();
fetchButtonsData();
+
+ timerManager.createTimer(
+ 'Timer', // 鍞竴鏍囪瘑
+ function () {
+ TSLoad();
+ },
+ 10000, // 闂撮殧3鍒嗛挓
+ 'interval' // 寰幆绫诲瀷
+ );
+
+ $(window).on('beforeunload', function () {
+ timerManager.clearAllTimers();
+ });
});
+ function InitLayerConfig() {
+ var _open = layer.open
+ , _timerManager = layui.timerManager
+
+ layer.open = function (opts) {
+ // 鍚堝苟榛樿閰嶇疆
+ var options = $.extend({}, layer.config, opts);
+
+ var oldSuccess = options.success;
+ var oldEnd = options.end;
+ var needHideScroll = options.scrollbar === false;
+
+ // 鎵撳紑寮圭獥鏃�
+ options.success = function (layero, index) {
+ if (needHideScroll) {
+ $('body').css('overflow', 'hidden');
+ }
+ console.log("鏆傚仠瀹氭椂鍣�")
+ _timerManager.pauseTimer('Timer')
+ if (oldSuccess) oldSuccess.call(this, layero, index);
+ };
+
+
+ // 鍏抽棴寮圭獥鏃�
+ options.end = function () {
+ if (needHideScroll) {
+ // 鍙湁鏈�鍚庝竴涓脊绐楀叧闂墠鎭㈠
+ if ($('.layui-layer:visible').length <= 1) {
+ $('body').css('overflow', '');
+ }
+ }
+ if ($('.layui-layer:visible').length <= 1) {
+ console.log("鎭㈠瀹氭椂鍣�")
+ _timerManager.resumeTimer('Timer')
+ }
+ if (oldEnd) oldEnd.call(this);
+ };
+
+ return _open.call(this, options);
+ };
+ }
+
function TSLoad() {
$("#topleft").html("");
var HUserName = sessionStorage["HUserName"]; //sessionStorage["HUserName"]; //榛樿褰撳墠鐧诲綍浜哄憳
@@ -118,14 +177,14 @@
case "鐢熶骇":
html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
- case "缁翠慨杩涜涓�":
- html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border5"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
- break;
- case "缁翠慨缁撴潫":
+ case "寰呮満":
html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
- case "缁翠慨缁堟":
- html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
+ case "鏁呴殰":
+ html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border5 "></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
+ break;
+ case "缁翠慨瀹屾垚":
+ html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
default:
}
@@ -195,14 +254,14 @@
case "鐢熶骇":
html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
- case "缁翠慨杩涜涓�":
- html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border5"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
- break;
- case "缁翠慨缁撴潫":
+ case "寰呮満":
html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
- case "缁翠慨缁堟":
- html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
+ case "鏁呴殰":
+ html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border5 "></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
+ break;
+ case "缁翠慨瀹屾垚":
+ html1 += '<h1><span>褰撳墠鐘舵�侊細</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
break;
default:
}
@@ -239,6 +298,7 @@
if (sessionStorage["Organization"] == "瀹佹尝甯傚崕鑸熷寘瑁呮湁闄愬叕鍙�") {
// 鍗庤垷 浣跨敤鍒嗙粍鏍囩
+ console.log("鍒嗙粍鏍囩", LoadingTabsContact)
var divParent = document.createElement("div")
divParent.classList.add("layui-tab")
divParent.classList.add("layui-tab-card")
@@ -1531,75 +1591,68 @@
layer.alert("璇烽�夋嫨宸ュ崟鍒楄〃", { icon: 5 });
return false;
}
- //褰撳墠宸ュ崟(姹囨姤)鎸夐挳鐐瑰嚮浜嬩欢
- function CodingReport(event, obj) {
- if (wktag == 0) {
- layer.alert("璇烽�夋嫨宸ュ崟鍒楄〃", { icon: 5 });
- return false;
- }
-
- // 鍒ゆ柇鏄惁涓哄崕鑸熺粍缁�
- if (sessionStorage["Organization"] == "瀹佹尝甯傚崕鑸熷寘瑁呮湁闄愬叕鍙�") {
- // 鍗庤垷缁勭粐锛氳嫢姹囨姤鎬绘暟涓嶄负0鍒欒烦杩囩姸鎬佹鏌ワ紝鍚﹀垯鎵ц妫�鏌�
- if (parseFloat(HReportTotal) !== 0) {
- // 姹囨姤鎬绘暟涓嶄负0锛岀洿鎺ユ墦寮�锛堜笉鎵ц WorkStaus 妫�鏌ワ級
- } else {
- // 姹囨姤鎬绘暟绛変簬0锛屾墽琛屽師鏈夌殑鐘舵�佹鏌�
- if (WorkStaus(HSourceID1, workcode, HSourceInterID, "鏂帿灏旀眹鎶�")) {
- layer.alert("鍗曟嵁鐘舵�佷笉婊¤冻姹囨姤鏉′欢!", { icon: 5 });
- return false;
- }
- }
+ // 鍒ゆ柇鏄惁涓哄崕鑸熺粍缁�
+ if (sessionStorage["Organization"] == "瀹佹尝甯傚崕鑸熷寘瑁呮湁闄愬叕鍙�") {
+ // 鍗庤垷缁勭粐锛氳嫢姹囨姤鎬绘暟涓嶄负0鍒欒烦杩囩姸鎬佹鏌ワ紝鍚﹀垯鎵ц妫�鏌�
+ if (parseFloat(HReportTotal) !== 0) {
+ // 姹囨姤鎬绘暟涓嶄负0锛岀洿鎺ユ墦寮�锛堜笉鎵ц WorkStaus 妫�鏌ワ級
} else {
- // 闈炲崕鑸熺粍缁囷細淇濇寔鍘熸湁閫昏緫锛岀洿鎺ユ墽琛� WorkStaus 妫�鏌�
+ // 姹囨姤鎬绘暟绛変簬0锛屾墽琛屽師鏈夌殑鐘舵�佹鏌�
if (WorkStaus(HSourceID1, workcode, HSourceInterID, "鏂帿灏旀眹鎶�")) {
layer.alert("鍗曟嵁鐘舵�佷笉婊¤冻姹囨姤鏉′欢!", { icon: 5 });
return false;
}
}
+ } else {
+ // 闈炲崕鑸熺粍缁囷細淇濇寔鍘熸湁閫昏緫锛岀洿鎺ユ墽琛� WorkStaus 妫�鏌�
+ if (WorkStaus(HSourceID1, workcode, HSourceInterID, "鏂帿灏旀眹鎶�")) {
+ layer.alert("鍗曟嵁鐘舵�佷笉婊¤冻姹囨姤鏉′欢!", { icon: 5 });
+ return false;
+ }
+ }
+ layer.open({
+ type: 2,
+ skin: 'layui-layer-rim', //鍔犱笂杈规
+ title: '褰撳墠宸ュ崟',
+ closeBtn: 1,
+ shift: 2,
+ area: ['100%', '100%'],
+ maxmin: true,
+ scrollbar: false,
+ content: '杞﹂棿绠$悊/宸ュ簭鍑虹珯姹囨姤鍗�/Cj_StationOutBill_CurrentWork.html?OperationType=2&linterid=&HSouceBillType=',
+ end: function () {
- // 鎵撳紑 iframe 寮圭獥锛堝師鏈変唬鐮佷笉鍙橈級
- layer.open({
- type: 2,
- skin: 'layui-layer-rim', //鍔犱笂杈规
- title: '褰撳墠宸ュ崟',
- closeBtn: 1,
- shift: 2,
- area: ['100%', '100%'],
- maxmin: true,
- scrollbar: false,
- content: '杞﹂棿绠$悊/宸ュ簭鍑虹珯姹囨姤鍗�/Cj_StationOutBill_CurrentWork.html?OperationType=2&linterid=&HSouceBillType=',
- end: function () {
- // 鍙�夌殑鍏抽棴鍥炶皟
- },
- success: function (dom, index) {
- var data = [{
- "HEquipName": $("#HEquipName1").text(),
- "HEquipCode": $("#HEquipCode1").text(),
- "HICMOBillNo": workcode,
- "HICMOInterID": HICMOInterID,
- "HICMOEntryID": HICMOEntryID,
- "HSourceID": HSourceID1,
- "HSourceName": HSourceName1,
- "HEmpName": HEmpName,
- "HManagerID": HManagerID,
- "HManagerName": HManagerName,
- "HGroupName": HGroupName,
- "HGroupID": HGroupID,
- "HBillType": HBillType,
- "HSourceInterID": HSourceInterID,
- "HSourceEntryID": HSourceEntryID,
- "HSourceBillNo": HSourceBillNo,
- "HSourceBillType": HSourceBillType
- }];
+ },
+ success: function (dom, index) {
+ var data = [];
+ data.push({
+ "HEquipName": $("#HEquipName1").text(),
+ "HEquipCode": $("#HEquipCode1").text(),
+ "HICMOBillNo": workcode,
+ "HICMOInterID": HICMOInterID,
+ "HICMOEntryID": HICMOEntryID,
+ "HSourceID": HSourceID1,
+ "HSourceName": HSourceName1,
+ "HEmpName": HEmpName,
+ "HManagerID": HManagerID,
+ "HManagerName": HManagerName,
+ "HGroupName": HGroupName,
+ "HGroupID": HGroupID,
+ "HBillType": HBillType,
+ "HSourceInterID": HSourceInterID,
+ "HSourceEntryID": HSourceEntryID,
+ "HSourceBillNo": HSourceBillNo,
+ "HSourceBillType": HSourceBillType
+ });
- //閫氳繃绱㈠紩鑾峰彇鍒板綋鍓峣frame寮瑰嚭灞�
- var iframe = window['layui-layer-iframe' + index];
- //璋冪敤iframe寮瑰嚭灞傚唴鐨勬柟娉�
- iframe.edit(data);
- }
- });
- }
+ //閫氳繃绱㈠紩鑾峰彇鍒板綋鍓峣frame寮瑰嚭灞�
+ var iframe = window['layui-layer-iframe' + index];
+ //璋冪敤iframe寮瑰嚭灞傚唴鐨勬柟娉�
+ iframe.edit(data);
+ },
+
+
+ });
}
//璁惧鍚姩鐐规鎸夐挳鐐瑰嚮浜嬩欢
--
Gitblit v1.9.1