Browse Source

报表,传输计算式debug信息到浏览器,并打印输出

MaiXinRong 5 years ago
parent
commit
7d73f2b0b1

+ 1 - 1
app/controller/report_controller.js

@@ -180,7 +180,7 @@ module.exports = app => {
                 await encodeSignatureDataUri(roleRel, this.app.baseDir);
                 await encodeDummySignatureDataUri(pageRst, this.app.baseDir);
                 // console.log('encodeSignatureDataUri!');
-                ctx.body = { data: pageRst, signatureRelInfo: roleRel, stageAudit: stgAudit };
+                ctx.body = { data: pageRst, signatureRelInfo: roleRel, stageAudit: stgAudit, debugInfo: ctx.app.config.is_debug ? ctx.debugInfo : null };
                 // ctx.body = { data: { msg: 'test the network' } };
                 ctx.status = 201;
             } catch (ex) {

+ 7 - 0
app/extend/helper.js

@@ -902,5 +902,12 @@ module.exports = {
                 body: this.ctx.session.body,
             }));
         }
+    },
+
+    addDebugInfo(key, data) {
+        if (!this.ctx.debugInfo) {
+            this.ctx.debugInfo = {};
+        }
+        this.ctx.debugInfo[key] = data;
     }
 };

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

@@ -328,6 +328,9 @@ let zTreeOprObj = {
                     JpcCanvasOutput.cleanCanvas(canvas);
                     JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
                 }
+                if (is_debug) {
+                    console.log(result.debugInfo);
+                }
             }, function(err){
                 // hintBox.unWaitBox();
             }, function(ex){

+ 2 - 0
config/config.qa.js

@@ -53,5 +53,7 @@ module.exports = appInfo => {
         rolling: true, // 每次都更新session有效期
     };
 
+    config.is_debug = true;
+
     return config;
 };