浏览代码

解决打印、导出Excel PDF的问题

TonyKang 5 年之前
父节点
当前提交
207e4f5a14
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      app/controller/report_controller.js

+ 4 - 5
app/controller/report_controller.js

@@ -505,7 +505,6 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
         params.rpt_ids[idx] = parseInt(params.rpt_ids[idx]); // 转换一下,以防万一
     }
     const rptTpls = await ctx.service.rptTpl.getAllTplByIds(params.rpt_ids);
-    // console.log(rptTpls);
     for (let rtIdx = 0; rtIdx < rptTpls.length; rtIdx++) {
         rptTpls[rtIdx] = JSON.parse(rptTpls[rtIdx].rpt_content);
     }
@@ -554,8 +553,6 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
         }
         // 2. 一个一个模板创建数据
         let defProperties = await ctx.service.rptPreDefineCfg.getCfgById('Administrator');
-        // console.log('defProperties: ');
-        // console.log(defProperties[0].defined_content);
         defProperties = JSON.parse(defProperties[0].defined_content);
         for (let tplIdx = 0; tplIdx < rptTpls.length; tplIdx++) {
             const rptTpl = (rptTpls[tplIdx]._doc) ? rptTpls[tplIdx]._doc : rptTpls[tplIdx];
@@ -570,11 +567,13 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
 
             printCom.initialize(rptTpl);
-            printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
+            // console.log(rptTpl);
+            printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType);
             const maxPages = printCom.totalPages;
             let pageRst = null;
+            // console.log(maxPages);
             if (maxPages > 0) {
-                pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, params.custCfg);
+                pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg);
             } else {
                 pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
             }