From e5731626180db73f9e98bfda4c06d9aacf554df5 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 30 三月 2026 11:50:41 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/layuiadmin/Scripts/webConfig.js |  163 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 146 insertions(+), 17 deletions(-)

diff --git a/WebTM/layuiadmin/Scripts/webConfig.js b/WebTM/layuiadmin/Scripts/webConfig.js
index cc4b0be..b826e83 100644
--- a/WebTM/layuiadmin/Scripts/webConfig.js
+++ b/WebTM/layuiadmin/Scripts/webConfig.js
@@ -1,18 +1,22 @@
 锘�
 function GetWEBURL() {
-    //var WEBURL = "http://192.168.16.80:8011/";          //鍔炲叕瀹ゆ湇鍔″櫒
-    //var WEBURL = "http://localhost:8081/SWEAPI/";       //ch鏈湴*/
+    //var WEBURL = "http://192.168.16.80:8011/";        //鍔炲叕瀹ゆ湇鍔″櫒
     //var WEBURL = "http://61.164.86.218:8099/ABAPI/";
-    /*var WEBURL = "http://localhost/API/";             //棰滄檽鍐涙湰鍦伴厤缃�*/
-    //var WEBURL = "http://localhost:8082/LuBaoAPI/";    //鏉ㄤ箰鏈湴閰嶇疆
-    // var WEBURL = "http://localhost:8082/API/";    //鏉滆春鏈湴閰嶇疆
-    //var WEBURL = "http://localhost:8082/API/";    //寮犵憺骞挎湰鍦伴厤缃�
-    var WEBURL = "http://localhost:81/API/"    //缈佹稕娑涙湰鍦伴厤缃�
-    //var WEBURL = "http://localhost:8082/LuBaoAPI/";    //鏉ㄤ箰鏈湴閰嶇疆
+    //var WEBURL = "http://localhost/API/";             //棰滄檽鍐涙湰鍦伴厤缃�
+    //var WEBURL = "http://localhost:8082/API/";        //鏉滆春鏈湴閰嶇疆
+    //var WEBURL = "http://localhost:81/API/"           //缈佹稕娑涙湰鍦伴厤缃�
+     var WEBURL = "http://localhost:8082/API/";        //寮犵憺骞挎湰鍦伴厤缃�
+    // var WEBURL = "http://localhost:81/API/";          //闄堥晲鍝叉湰鍦伴厤缃�
+    // var WEBURL = "http://localhost:8082/API/";        //寮犵憺骞挎湰鍦伴厤缃�
+    var WEBURL = "http://localhost:81/API/";          //闄堥晲鍝叉湰鍦伴厤缃�
+    //var WEBURL = "http://localhost:8082/LuBaoAPI/";   //鏉庢灄淇婃湰鍦伴厤缃�
+    //var WEBURL = "http://localhost:8080/API/";        //鐜嬩华鏈湴閰嶇疆
+    //var WEBURL = "http://localhost:8082/LuBaoAPI/";   //浣欐�濇澃鏈湴閰嶇疆
+    //var WEBURL = "http://localhost:8088/ARAPI/";      //浣欐�濇澃鏈湴閰嶇疆(瀹夌憺)
     //var WEBURL = "http://47.96.97.237/API/";          //鏅轰簯鏈嶅姟鍣�
    /* var WEBURL = "http://localhost:8082/LuBaoAPI/";  //浣欐�濇澃鏈湴閰嶇疆*/
-  /*  var WEBURL = "http://localhost:81/API/";            // 闄堥晲鍝叉湰鍦伴厤缃�*/
-    // var WEBURL = "http://localhost:8082/LuBaoAPI/";  //鏉庢灄淇婃湰鍦伴厤缃�
+    //var WEBURL = "http://localhost:81/API/";            // 闄堥晲鍝叉湰鍦伴厤缃�*/
+     //var WEBURL = "http://localhost:8082/LuBaoAPI/";  //鏉庢灄淇婃湰鍦伴厤缃�
     //var WEBURL = "http://localhost:8088/ARAPI/";      //浣欐�濇澃鏈湴閰嶇疆(瀹夌憺)
     //var WEBURL = "http://61.164.86.218:8099/ABAPI/";  //濂ラ偊
     //var WEBURL = "http://10.1.4.155/API/";            //姹熶赴瀹㈡埛NEW
@@ -28,10 +32,11 @@
     //var WEBURL = "http://192.168.1.237:9003/API";     //澶忓疂鍐呯綉
     //var WEBURL = "http://60.190.4.42:9003/API";       //澶忓疂澶栫綉
     //var WEBURL = "http://192.168.60.12/API";          //涓帶
-    //var WEBURL = "http://192.168.6.5:8082/API/";    //鑸滄垚
-    /*var WEBURL = "http://121.36.199.126:8181/API/";    //涓夊崌*/
+    //var WEBURL = "http://192.168.6.5:8082/API/";      //鑸滄垚
+    //var WEBURL = "http://121.36.199.126:8181/API/";   //涓夊崌
     //var WEBURL = "http://36.134.2.30:200/WEBS-API/";  //閲戝竻
     //var WEBURL = "http://172.16.1.85/API/";           //杩﹀崡
+    // var WEBURL = "http://61.164.64.222:8082/API_WW/"
     return WEBURL
 }
 
@@ -39,9 +44,133 @@
     return GetWEBURL()
 }
 
+layui.use(['jquery', 'layer'], function () {
+    var $ = layui.jquery,
+        layer = layui.layer;
+    // 鍏ㄥ眬閰嶇疆
+    layer.config({
+        scrollbar: false
+    });
 
-//function GetWEBURL1() {
-//    //var WEBURL = 'http://192.168.16.80:8011/';           //鍔炲叕瀹ゆ湇鍔″櫒
-//    var WEBURL = 'http://localhost:9011/WebAPI';
-//    return WEBURL
-//}
\ No newline at end of file
+    var pendingRequests = [];
+
+    // 鍏ㄥ眬閰嶇疆 榛樿涓嶆樉绀虹埗绾ф粴鍔ㄦ
+    var _open = layer.open;
+    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');
+            }
+            if (oldSuccess) oldSuccess.call(this, layero, index);
+        };
+
+
+        // 鍏抽棴寮圭獥鏃�
+        options.end = function () {
+            if (needHideScroll) {
+                // 鍙湁鏈�鍚庝竴涓脊绐楀叧闂墠鎭㈠
+                if ($('.layui-layer:visible').length <= 1) {
+                    $('body').css('overflow', '');
+                }
+            }
+            if (oldEnd) oldEnd.call(this);
+        };
+
+        return _open.call(this, options);
+    };
+
+
+    // 鍏ㄥ眬鎷︽埅鎵�鏈� layui ajax 璇锋眰
+    $(document).ajaxSend(function (event, jqxhr, settings) {
+        var token = localStorage.getItem('token');
+        pendingRequests.push(jqxhr);
+
+        if (typeof token != 'undefined') {
+            // 鑷姩甯︿笂 token
+            jqxhr.setRequestHeader('Authorization', 'Bearer ' + token);
+
+        }
+
+    });
+
+
+    // 缁熶竴澶勭悊 鏈璇�/鏈巿鏉冭姹�
+    $(document).ajaxComplete(function (event, jqxhr, settings) {
+        // HTTP 鐘舵�佺爜
+        var status = jqxhr.status;
+        console.log(jqxhr)
+        if (status === 401) {
+            abortAllPendingRequests(pendingRequests);
+            // 鏈櫥褰� / token 杩囨湡
+            layer.confirm(jqxhr.responseJSON.Message, { icon: 7, title: '鎻愮ず' }, function () {
+                localStorage.removeItem('token');
+                window.top.location.href = '/views/user/login.html'; // 璺冲埌鐧诲綍椤�
+
+            });
+        } else if (status === 403) {
+            abortAllPendingRequests(pendingRequests);
+            // 鏃犳潈闄�
+            layer.confirm(jqxhr.responseJSON.Message, {
+                icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['纭畾']
+            });
+        }
+    });
+});
+var pendingRequests2 = []
+if (typeof $ != 'undefined') {
+    $(document).ajaxSend(function (event, jqxhr, settings) {
+        var token = localStorage.getItem('token');
+        pendingRequests2.push(jqxhr)
+
+        if (typeof token != 'undefined') {
+            // 鑷姩甯︿笂 token
+            jqxhr.setRequestHeader('Authorization', 'Bearer ' + token);
+        }
+
+    });
+
+
+    // 缁熶竴澶勭悊 鏈璇�/鏈巿鏉冭姹�
+    $(document).ajaxComplete(function (event, jqxhr, settings) {
+        // HTTP 鐘舵�佺爜
+        var status = jqxhr.status;
+
+        if (status === 401) {
+            // 鏈櫥褰� / token 杩囨湡
+            abortAllPendingRequests(pendingRequests2)
+            layer.confirm(jqxhr.responseJSON.Message, { icon: 7, title: '鎻愮ず' }, function () {
+                localStorage.removeItem('token');
+                window.top.location.href = '/views/user/login.html'; // 璺冲埌鐧诲綍椤�
+
+            });
+        } else if (status === 403) {
+            // 鏃犳潈闄�
+            abortAllPendingRequests(pendingRequests2)
+            layer.confirm(jqxhr.responseJSON.Message, {
+                icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['纭畾']
+            });
+        }
+    });
+}
+
+function abortAllPendingRequests(pendingRequests) {
+    if (pendingRequests.length === 0) return;
+
+    // 閬嶅巻鍙栨秷鎵�鏈夎姹�
+    $.each(pendingRequests, function (i, req) {
+        try {
+            req.abort(); // 涓柇璇锋眰
+        } catch (e) { }
+    });
+
+    // 娓呯┖璇锋眰姹�
+    pendingRequests = [];
+}

--
Gitblit v1.9.1