Переглянути джерело

导出EXCEL增加控制,防止客户连续点击请求

TonyKang 4 роки тому
батько
коміт
96d5cbf24d
1 змінених файлів з 43 додано та 20 видалено
  1. 43 20
      app/public/report/js/rpt_main.js

+ 43 - 20
app/public/report/js/rpt_main.js

@@ -596,16 +596,28 @@ let rptControlObj = {
             if (chkNodes.length > 0) {
                 delete params.orientation; // 打印时有勾选的话,不需要提供方向
             }
+            $.bootstrapLoading.start();
             CommonAjax.postXsrfEx("/tender/report_api/createExcelFilesInOneBook", params, WAIT_TIME_EXPORT, true, getCookie('csrfToken_j'), function(result){
-                    if (result) {
-                        let uuIdUrls = [];
-                        let uuIdUrl =  "/getFileByUUID/" + result.data[0].uuid + "/" + stringUtil.replaceAll(result.data[0].reportName, "#", "_") + "/xlsx";
-                        uuIdUrls.push(uuIdUrl);
-                        downloadReport(uuIdUrls);
-                    } else {
-                        //
-                    }
-                }, null, null
+                $.bootstrapLoading.end();
+                if (result) {
+                    let uuIdUrls = [];
+                    let uuIdUrl =  "/getFileByUUID/" + result.data[0].uuid + "/" + stringUtil.replaceAll(result.data[0].reportName, "#", "_") + "/xlsx";
+                    uuIdUrls.push(uuIdUrl);
+                    downloadReport(uuIdUrls);
+                } else {
+                    //
+                }
+                },
+                function(failRst){
+                    // closeWaitingView();
+                    $.bootstrapLoading.end();
+                    console.log(failRst);
+                },
+                function(exceptionRst){
+                    // closeWaitingView();
+                    $.bootstrapLoading.end();
+                    console.log(exceptionRst);
+                }
             );
         }
     },
@@ -627,19 +639,30 @@ let rptControlObj = {
             if (chkNodes.length > 0) {
                 delete params.orientation; // 打印时有勾选的话,不需要提供方向
             }
-
+            $.bootstrapLoading.start();
             CommonAjax.postXsrfEx("/tender/report_api/createExcelFiles", params, WAIT_TIME_EXPORT, true, getCookie('csrfToken_j'), function(result){
-                    if (result) {
-                        let uuIdUrls = [];
-                        for (let uuIdObj of result.data) {
-                            let uuIdUrl =  "/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/xlsx";
-                            uuIdUrls.push(uuIdUrl);
-                        }
-                        downloadReport(uuIdUrls);
-                    } else {
-                        //
+                $.bootstrapLoading.end();
+                if (result) {
+                    let uuIdUrls = [];
+                    for (let uuIdObj of result.data) {
+                        let uuIdUrl =  "/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/xlsx";
+                        uuIdUrls.push(uuIdUrl);
                     }
-                }, null, null
+                    downloadReport(uuIdUrls);
+                } else {
+                    //
+                }
+            },
+            function(failRst){
+                // closeWaitingView();
+                $.bootstrapLoading.end();
+                console.log(failRst);
+            },
+            function(exceptionRst){
+                // closeWaitingView();
+                $.bootstrapLoading.end();
+                console.log(exceptionRst);
+            }
             );
         }
     },