Explorar o código

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionCost

vian %!s(int64=5) %!d(string=hai) anos
pai
achega
1409fce74a

+ 8 - 4
modules/reports/util/rpt_excel_util.js

@@ -352,19 +352,19 @@ function writeSheets(pageData, paperSize, sharedStrList, stylesObj, isSinglePage
     private_pushDftFont();
     private_buildFirstDftStyle();
     if (isSinglePage) {
-        rst.push(writeSheet(pageData, null, paperSize, sharedStrList, stylesObj, null));
+        rst.push(writeSheet(pageData, null, paperSize, sharedStrList, stylesObj, null, true));
     } else {
         for (let i = 0; i < pageData.items.length; i++) {
             let appointedMergeBand = null;
             if (custSheetMergeBands && custSheetMergeBands.length > i) {
                 appointedMergeBand = custSheetMergeBands[i];
             }
-            rst.push(writeSheet(pageData, pageData.items[i], paperSize, sharedStrList, stylesObj, appointedMergeBand));
+            rst.push(writeSheet(pageData, pageData.items[i], paperSize, sharedStrList, stylesObj, appointedMergeBand, i === 0));
         }
     }
     return rst;
 }
-function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, appointedMergeBand){
+function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, appointedMergeBand, isFirstSheet){
     let rst = [], xPos = [], yPos = [], yMultiPos = [], currentMergeBorder = null,
         headerStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     let currentPageMergePos = null; //在 JV.PAGING_OPTION_INFINITY 场合应用
@@ -807,7 +807,11 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, ap
     rst.push('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">');
     let colStr = private_getCellIdxStr(xPos.length - 3);
     rst.push('<dimension ref="A1:' + colStr + '' + yPos.length + '"/>');
-    rst.push('<sheetViews><sheetView tabSelected="1" workbookViewId="0">');
+    if (isFirstSheet) {
+        rst.push('<sheetViews><sheetView tabSelected="1" workbookViewId="0">');
+    } else {
+        rst.push('<sheetViews><sheetView workbookViewId="0">');
+    }
     //rst.push('<selection sqref="A1:' + colStr + '1"/>');
     rst.push('<selection sqref="A1:A1"/>');
     rst.push('</sheetView></sheetViews>');

+ 3 - 0
web/building_saas/report/html/rpt_main.html

@@ -33,6 +33,7 @@
                                 <!--
                                 <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.getPDF()"><i class="fa fa-file-pdf-o"></i> PDF <span class="badge badge-secondary">0</span></button>
                                 -->
+                                <button type="button" class="" id="ini_PDF_Btn" style="display: none" data-toggle="modal" data-target="#ini_PDF_cover"><i class="fa fa-file-pdf-o"></i></button>
                                 <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.getPDFPre()"><i class="fa fa-file-pdf-o"></i> PDF <span class="badge badge-secondary">0</span></button>
                             </div>
                         </div>
@@ -110,6 +111,8 @@
 <%include ./rpt_content_format.html %>
 <!--弹出导出Excel-->
 <%include ./rpt_export_excel.html %>
+<!--弹出PDF初始化-->
+<%include ./rpt_pdf_js_initialize.html %>
 <script>
     const SCREEN_DPI = [];
     function getScreenDPI() {

+ 13 - 0
web/building_saas/report/html/rpt_pdf_js_initialize.html

@@ -0,0 +1,13 @@
+<div class="modal fade" id="ini_PDF_cover" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">初始化PDF导出</h5>
+            </div>
+            <div class="modal-body">
+                <h5>正在初始化PDF导出,请稍后...<i class="fa fa-spinner fa-pulse fa-fw"></i></h5>
+                <button class="btn btn-secondary" type="button" id="ini_PDF_Btn_Cancel" style="display: none" data-dismiss="modal"></button>
+            </div>
+        </div>
+    </div>
+</div>

+ 14 - 1
web/building_saas/report/js/rpt_main.js

@@ -531,12 +531,13 @@ let rptControlObj = {
     },
     getPDFPre: function () {
         let me = rptControlObj;
-        $.bootstrapLoading.start();
         if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
+            $.bootstrapLoading.start();
             me.getPDFEx();
         } else {
             // dynamicLoadJs('/lib/jspdf/SmartSimsun-normal.js',"normal", me.getPdfFontCallback);
             // dynamicLoadJs('/lib/jspdf/SmartSimsun-bold.js',"bold", me.getPdfFontCallback);
+            $("#ini_PDF_Btn").trigger("click");
             dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', me.getPdfFontCallback);
             dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', me.getPdfFontCallback);
         }
@@ -557,6 +558,10 @@ let rptControlObj = {
             CommonAjax.postEx("report_api/getMultiReports", params, 30000, true,
                 function(result){
                     $.bootstrapLoading.end();
+                    if ($('#ini_PDF_cover').is(':visible')) {
+                        $("#ini_PDF_Btn_Cancel").trigger("click");
+                        // $("#ini_PDF_cover").remove();
+                    }
                     let pageSize = rptControlObj.getCurrentPageSize();
                     for (let idx = 0; idx < result.length; idx++) {
                         let pageData = result[idx];
@@ -565,11 +570,19 @@ let rptControlObj = {
                 },
                 function(failRst){
                     $.bootstrapLoading.end();
+                    if ($('#ini_PDF_cover').is(':visible')) {
+                        $("#ini_PDF_Btn_Cancel").trigger("click");
+                        // $("#ini_PDF_cover").remove();
+                    }
                     sessionStorage.currentPageData = null;
                     console.log(failRst);
                 },
                 function(exceptionRst){
                     $.bootstrapLoading.end();
+                    if ($('#ini_PDF_cover').is(':visible')) {
+                        $("#ini_PDF_Btn_Cancel").trigger("click");
+                        // $("#ini_PDF_cover").remove();
+                    }
                     sessionStorage.currentPageData = null;
                     console.log(exceptionRst);
                 }