浏览代码

增强breakdown函数

TonyKang 3 年之前
父节点
当前提交
2c6ef9abc8

+ 19 - 0
app/public/report/js/rpt_main.js

@@ -995,6 +995,25 @@ function downloadPDFReport(pageDataArr, pageSize, rpt_names, signatureRelArr, si
             let pageData = newPageDataArr[rptControlObj.currentDownloadIdx];
             let rptName = new_rpt_rames[rptControlObj.currentDownloadIdx];
             rptControlObj.currentDownloadIdx++;
+            /*
+            // 临时代码,为大批量草图PDF下载用(强制分页)
+            const MAX_PAGES_AMT  = 100;
+            const orgItems = pageData.items;
+            let ttlSec = parseInt(orgItems.length / MAX_PAGES_AMT);
+            if (orgItems.length % MAX_PAGES_AMT > 0) {
+                ttlSec++;
+            }
+            for (let idx = 0; idx < ttlSec; idx++) {
+                let indPages = [];
+                for (let pi = idx * MAX_PAGES_AMT; pi < Math.min((idx + 1) * MAX_PAGES_AMT, orgItems.length); pi++ ) {
+                    indPages.push(orgItems[pi]);
+                }
+                pageData.items = indPages;
+                JpcJsPDFHelper.outputAsPdf(pageData, pageSize, rptName + idx, singleSignatureRelArr, STAGE_AUDIT);
+            }
+            pageData.items = orgItems;
+            //*/
+
             JpcJsPDFHelper.outputAsPdf(pageData, pageSize, rptName, singleSignatureRelArr, STAGE_AUDIT); // 精确控制签名
             if (rptControlObj.currentDownloadIdx < newPageDataArr.length) setTimeout(private_download(newPageDataArr, new_rpt_rames), 2000);
         }

+ 17 - 5
app/reports/rpt_component/jpc_ex.js

@@ -174,10 +174,10 @@ JpcExSrv.prototype.createNew = function() {
         // 1. data object
         let dataHelper = JpcData.createNew();
         // console.log(JSON.stringify(rptTpl));
-        me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_ANALYZING, rptTpl, dataObj, me, $CUSTOM_DEFINE); // 在分析前运行,主要是增加灵活性,比如:重新编排数据的主从关系
+        me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_ANALYZING, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties); // 在分析前运行,主要是增加灵活性,比如:重新编排数据的主从关系
         // console.log(JSON.stringify(rptTpl));
         if (me.crossTab) {
-            me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me, $CUSTOM_DEFINE);
+            me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties);
             dataHelper.analyzeData(rptTpl, dataObj);
             me.crossTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
         } else {
@@ -197,7 +197,7 @@ JpcExSrv.prototype.createNew = function() {
             // let dt2 = new Date();
             // alert(dt2 - dt1);
             // 3. formulas
-            me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me, $CUSTOM_DEFINE);
+            me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties);
         }
         // 4. paging
         me.paging(rptTpl, dataObj, defProperties, dftPagingOption, outputType);
@@ -226,7 +226,19 @@ JpcExSrv.prototype.createNew = function() {
             me.totalPages = me.billTab.paging(rptTpl, dataObj);
         }
     };
-    JpcResult.executeFormulas = function($CTX_HELPER, runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT, $CUSTOM_DEFINE) {
+    JpcResult.getDftRowsPerPage = function(rptTpl, defProperties) {
+        const me = this;
+        let rst = 1;
+        if (me.flowTab) {
+            rst = me.flowTab.getDftRowsPerPage(rptTpl, defProperties, me);
+        } else if (me.crossTab) {
+            // 实际业务可以暂时不提供
+        } else if (me.billTab) {
+            // 实际业务可以暂时不提供
+        }
+        return rst;
+    };
+    JpcResult.executeFormulas = function($CTX_HELPER, runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT, $CUSTOM_DEFINE, $PAGE_PROPERTIES) {
         const execFmlMe = this;
         for (let execFmlIdx = 0; execFmlIdx < execFmlMe.formulas.length; execFmlIdx++) {
             // remark: 搞这么复杂的变量名是为了防止与表达式起冲突(如循环变量i,j,k,容易造成变量冲突且不容易看出问题)
@@ -328,7 +340,7 @@ JpcExSrv.prototype.createNew = function() {
             try {
                 for (let page = startPage; page <= endPage; page++) {
                     me.runTimePageData.currentPage = page;
-                    me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_OUTPUT, rptTpl, dataObj, me, $CUSTOM_DEFINE);
+                    me.executeFormulas($CTX_HELPER, JV.RUN_TYPE_BEFORE_OUTPUT, rptTpl, dataObj, me, $CUSTOM_DEFINE, defProperties);
                     rst.items.push(me.outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, rst[JV.NODE_CONTROL_COLLECTION], customizeCfg));
                 }
                 if (bands[JV.BAND_PROP_MERGE_BAND]) {

+ 10 - 0
app/reports/rpt_component/jpc_flow_tab.js

@@ -497,6 +497,16 @@ JpcFlowTabSrv.prototype.createNew = function() {
         }
     };
 
+    JpcFlowTabResult.getDftRowsPerPage = function(rptTpl, defProperties, $CURRENT_RPT) {
+        const me = this;
+        let rst = 1;
+        const bands = JpcBand.createNew(rptTpl, defProperties);
+        const pageStatus = [true, true, true, true, true, true, true, true];
+        JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
+        rst = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl, false);
+        return rst;
+    };
+
     JpcFlowTabResult.preSetupPages = function(rptTpl, dataObj, defProperties, option, $CURRENT_RPT, followTabEx, outputType) {
         // 换一种思路来整理流水式数据
         const me = this;

+ 2 - 1
app/reports/util/rpt_excel_util.js

@@ -1290,7 +1290,8 @@ function resetDummuySignature(pageData, roleRel) {
             for (const signature of page[JV.PROP_SIGNATURE_CELLS]) {
                 if (signature.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) >= 0) {
                     // 表示这是一个其他类型的非原生电子签名图,只是借用signature的处理机制,每个图都是唯一的,所以需要重新给个唯一的新signature_name
-                    signature.signature_name = signature.signature_name + '_' + pageIdx + '_' + dummySignIdx;
+                    // signature.signature_name = signature.signature_name + '_' + pageIdx + '_' + dummySignIdx;
+                    signature.signature_name = signature.signature_name + '_' + page.page_seq + '_' + dummySignIdx; // page_seq在分页后都不会变动
                     dummySignIdx++;
                     const roleRelItem = { type: '用户', sign_path: signature.path, signature_name: signature.signature_name };
                     roleRel.push(roleRelItem);