From afa3bc1e2f39f66f59ee9b15d6af16593acdc9a4 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 02 十二月 2023 10:38:27 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/contract/contract.js |  122 ++++++++++++++++++++++++++++------------
 1 files changed, 84 insertions(+), 38 deletions(-)

diff --git a/src/main/webapp/static/js/contract/contract.js b/src/main/webapp/static/js/contract/contract.js
index 4d01e07..48362f9 100644
--- a/src/main/webapp/static/js/contract/contract.js
+++ b/src/main/webapp/static/js/contract/contract.js
@@ -1,4 +1,5 @@
 var pageCurr;
+var sign=false;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).use(['table', 'laydate', 'form', 'admin','xmSelect', 'tree', 'dropdown'], function () {
@@ -218,27 +219,52 @@
                 })
                 break;
             case 'edit':
-                showEditModel(data);
-                break;
+                if (sign){
+                    showEditModel(data);
+                    break;
+                }else {
+                    layer.msg('鎶辨瓑浣犳病鏉冮檺', {icon: 2});
+                    break
+                }
             case "del":
                 del([data.id]);
                 break;
             case "generate":
-                //鐢熸垚鍚堝悓
-                generate(data)
-                break
+                if (sign){
+                    //鐢熸垚鍚堝悓
+                    generate(data)
+                    break
+                }else {
+                    layer.msg('鎶辨瓑浣犳病鏉冮檺', {icon: 2});
+                    break
+                }
             case "sales":
-                //鍚堝悓鏄庣粏
-                sales(data);
-                break
+                if (sign){
+                    //鍚堝悓鏄庣粏
+                    sales(data);
+                    break
+                }else {
+                    layer.msg('鎶辨瓑浣犳病鏉冮檺', {icon: 2});
+                    break
+                }
             case "upload":
-                //涓婁紶鍚堝悓
-                upload(data)
-                break
+                if (sign){
+                    //涓婁紶鍚堝悓
+                    upload(data)
+                    break
+                }else {
+                    layer.msg('鎶辨瓑浣犳病鏉冮檺', {icon: 2});
+                    break
+                }
             case "download":
-                //涓嬭浇鍚堝悓
-                download(data)
-                break
+                if (sign){
+                    //涓嬭浇鍚堝悓
+                    download(data)
+                    break
+                }else {
+                    layer.msg('鎶辨瓑浣犳病鏉冮檺', {icon: 2});
+                    break
+                }
         }
     });
 
@@ -406,30 +432,28 @@
             headers: {'token': localStorage.getItem('token')},
             data: data,
             method: 'GET',
-            xhrFields: {
-                responseType: "blob" // 璁剧疆鍝嶅簲绫诲瀷涓轰簩杩涘埗鏁版嵁
-            },
             success: function (res) {
-                // 鍒涘缓涓�涓复鏃剁殑涓嬭浇閾炬帴
-                const url = window.URL.createObjectURL(res);
-                // 鍒涘缓涓�涓殣钘忕殑 <a> 鍏冪礌骞惰缃笅杞介摼鎺�
-                const a = document.createElement("a");
-                a.style.display = "none";
-                a.href = url;
-
-                let list = data.filepath.split(".")
-                let suffix = "." + list[list.length - 1]//鑾峰彇鍚庣紑鍚�
-                a.download = data.name + suffix; // 鎸囧畾涓嬭浇鐨勬枃浠跺悕
-                document.body.appendChild(a);
-
-                // 瑙﹀彂鐐瑰嚮浜嬩欢浠ュ紑濮嬩笅杞�
-                a.click();
-
-                // 娓呯悊涓存椂璧勬簮
-                setTimeout(function () {
-                    window.URL.revokeObjectURL(url);
-                    document.body.removeChild(a);
-                }, 100);
+                location.href = res.data
+                // // 鍒涘缓涓�涓复鏃剁殑涓嬭浇閾炬帴
+                // const url = window.URL.createObjectURL(res);
+                // // 鍒涘缓涓�涓殣钘忕殑 <a> 鍏冪礌骞惰缃笅杞介摼鎺�
+                // const a = document.createElement("a");
+                // a.style.display = "none";
+                // a.href = url;
+                //
+                // let list = data.filepath.split(".")
+                // let suffix = "." + list[list.length - 1]//鑾峰彇鍚庣紑鍚�
+                // a.download = data.name + suffix; // 鎸囧畾涓嬭浇鐨勬枃浠跺悕
+                // document.body.appendChild(a);
+                //
+                // // 瑙﹀彂鐐瑰嚮浜嬩欢浠ュ紑濮嬩笅杞�
+                // a.click();
+                //
+                // // 娓呯悊涓存椂璧勬簮
+                // setTimeout(function () {
+                //     window.URL.revokeObjectURL(url);
+                //     document.body.removeChild(a);
+                // }, 100);
             }
         });
     }
@@ -554,9 +578,31 @@
             },
         });
     }
-
+    f();
 });
 
+function f() {
+    let token = localStorage.getItem("token");
+    layui.jquery.ajax({
+        url: baseUrl + "/dashboard/popup/auth",
+        data:{token : token},
+        method: 'GET',
+        success: function (res) {
+            if (res.code === 200) {
+                if (res.msg === "true"){
+                    sign=true;
+                }else {
+
+                }
+                console.log(sign)
+                // showPopupGenerate(res.msg)
+                // showPopupDel(res.msg)
+                // showPopupEdit(res.msg)
+            }
+        }
+    })
+}
+
 // 鍏抽棴鍔ㄤ綔
 $(document).on('click','#data-detail-close', function () {
     parent.layer.closeAll();

--
Gitblit v1.9.1