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 |   61 +++++++++++++++++++++++-------
 1 files changed, 46 insertions(+), 15 deletions(-)

diff --git a/WebTM/layuiadmin/Scripts/webConfig.js b/WebTM/layuiadmin/Scripts/webConfig.js
index 6db8126..b826e83 100644
--- a/WebTM/layuiadmin/Scripts/webConfig.js
+++ b/WebTM/layuiadmin/Scripts/webConfig.js
@@ -5,6 +5,8 @@
     //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/";   //鏉庢灄淇婃湰鍦伴厤缃�
@@ -12,9 +14,9 @@
     //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: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
@@ -42,15 +44,15 @@
     return GetWEBURL()
 }
 
-
 layui.use(['jquery', 'layer'], function () {
     var $ = layui.jquery,
         layer = layui.layer;
-
     // 鍏ㄥ眬閰嶇疆
     layer.config({
         scrollbar: false
     });
+
+    var pendingRequests = [];
 
     // 鍏ㄥ眬閰嶇疆 榛樿涓嶆樉绀虹埗绾ф粴鍔ㄦ
     var _open = layer.open;
@@ -70,6 +72,7 @@
             if (oldSuccess) oldSuccess.call(this, layero, index);
         };
 
+
         // 鍏抽棴寮圭獥鏃�
         options.end = function () {
             if (needHideScroll) {
@@ -84,12 +87,16 @@
         return _open.call(this, options);
     };
 
+
     // 鍏ㄥ眬鎷︽埅鎵�鏈� layui ajax 璇锋眰
     $(document).ajaxSend(function (event, jqxhr, settings) {
         var token = localStorage.getItem('token');
-        if (token) {
+        pendingRequests.push(jqxhr);
+
+        if (typeof token != 'undefined') {
             // 鑷姩甯︿笂 token
             jqxhr.setRequestHeader('Authorization', 'Bearer ' + token);
+
         }
 
     });
@@ -99,25 +106,31 @@
     $(document).ajaxComplete(function (event, jqxhr, settings) {
         // HTTP 鐘舵�佺爜
         var status = jqxhr.status;
-
+        console.log(jqxhr)
         if (status === 401) {
+            abortAllPendingRequests(pendingRequests);
             // 鏈櫥褰� / token 杩囨湡
-            layer.confirm('鐧诲綍宸茶繃鏈燂紝璇烽噸鏂扮櫥褰�', { icon: 7, title: '鎻愮ず' }, function () {
+            layer.confirm(jqxhr.responseJSON.Message, { icon: 7, title: '鎻愮ず' }, function () {
                 localStorage.removeItem('token');
-                window.top.location.href = '../../views/user/login.html'; // 璺冲埌鐧诲綍椤�
+                window.top.location.href = '/views/user/login.html'; // 璺冲埌鐧诲綍椤�
 
             });
         } else if (status === 403) {
+            abortAllPendingRequests(pendingRequests);
             // 鏃犳潈闄�
-            layer.msg('鎮ㄦ病鏈夎妯″潡鐨勬搷浣滄潈闄�', { icon: 2, time: 2000 });
+            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');
-        if (token) {
+        pendingRequests2.push(jqxhr)
+
+        if (typeof token != 'undefined') {
             // 鑷姩甯︿笂 token
             jqxhr.setRequestHeader('Authorization', 'Bearer ' + token);
         }
@@ -132,14 +145,32 @@
 
         if (status === 401) {
             // 鏈櫥褰� / token 杩囨湡
-            layer.confirm('鐧诲綍宸茶繃鏈燂紝璇烽噸鏂扮櫥褰�', { icon: 7, title: '鎻愮ず' }, function () {
+            abortAllPendingRequests(pendingRequests2)
+            layer.confirm(jqxhr.responseJSON.Message, { icon: 7, title: '鎻愮ず' }, function () {
                 localStorage.removeItem('token');
-                window.top.location.href = '../../views/user/login.html'; // 璺冲埌鐧诲綍椤�
+                window.top.location.href = '/views/user/login.html'; // 璺冲埌鐧诲綍椤�
 
             });
         } else if (status === 403) {
             // 鏃犳潈闄�
-            layui.layer.msg('鎮ㄦ病鏈夎妯″潡鐨勬搷浣滄潈闄�', { icon: 2, time: 2000 });
+            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