MaiXinRong пре 5 година
родитељ
комит
4c969dae28

+ 15 - 7
app/controller/report_controller.js

@@ -217,7 +217,9 @@ module.exports = app => {
                 // await encodeSignatureDataUri(roleRel, this.app.baseDir);
                 // await encodeDummySignatureDataUri(pageRst, this.app.baseDir);
                 // const stageFlow = await ctx.service.stageAudit.getAuditGroupByListWithOwner(params.stage_id, params.stage_times);
-                // const customSelect = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id);
+                // const customSelect = await ctx.service.rptCustomDefine.getDataByCondition({
+                //     tid: params.tender_id, sid: params.stage_id, rid: params.rpt_tpl_id
+                // });
                 //
                 // // console.log('encodeSignatureDataUri!');
                 // ctx.body = {
@@ -422,7 +424,7 @@ async function checkStg(ctx, params) {
         }
     }
 }
-async function getReportData(ctx, params, filters, memFieldKeys) {
+/*async function getReportData(ctx, params, filters, memFieldKeys) {
     const rst = {};
     const runnableRst = [];
     const runnableKey = []; // 这个配合runnableRst用,未来考虑并行查询优化
@@ -523,14 +525,14 @@ async function getReportData(ctx, params, filters, memFieldKeys) {
         }
     }
     return rst;
-}
+}*/
 
 async function getAllPagesCommon(ctx, rptTpl, params, option, outputType, baseDir) {
     const rptDataUtil = new rptDataExtractor();
     rptDataUtil.initialize(rptTpl);
     const filter = rptDataUtil.getDataRequestFilter();
     // console.log(filter.tables);
-    const rawDataObj = await ctx.service.report.getReportData(params, filter.tables, filter.memFieldKeys);
+    const rawDataObj = await ctx.service.report.getReportData(params, filter.tables, filter.memFieldKeys, rptTpl);
     // console.log(rawDataObj);
     try {
         const printCom = JpcEx.createNew();
@@ -554,7 +556,9 @@ async function getAllPagesCommon(ctx, rptTpl, params, option, outputType, baseDi
         }
         const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
         printCom.initialize(rptTpl);
-        const customDefine = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id);
+        const customDefine = await ctx.service.rptCustomDefine.getDataByCondition({
+            tid: params.tender_id, sid: params.stage_id, rid: params.rpt_tpl_id
+        });
         // ctx.helper
         printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customDefine);
         // console.log(JSON.stringify(rptTpl));
@@ -645,13 +649,17 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
 
             printCom.initialize(rptTpl);
-            const customDefine = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id);
+            const customDefine = await ctx.service.rptCustomDefine.getDataByCondition({
+                tid: params.tender_id, sid: params.stage_id, rid: params.rpt_tpl_id
+            });
             // console.log(rptTpl);
             printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customDefine);
             const maxPages = printCom.totalPages;
             let pageRst = null;
             // console.log(maxPages);
-            const customDefine = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id);
+            const customDefine = await ctx.service.rptCustomDefine.getDataByCondition({
+                tid: params.tender_id, sid: params.stage_id, rid: params.rpt_tpl_id
+            });
             if (maxPages > 0) {
                 pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customDefine);
             } else {

+ 2 - 2
app/public/report/js/rpt_custom.js

@@ -24,7 +24,7 @@ const rptCustomObj = (function () {
     };
 
     const initAuditSelect = function (asSetting, asSelect) {
-        const setting = JSON.parse(asSetting), select = JSON.parse(asSelect);
+        const setting = JSON.parse(asSetting), select = asSelect;
         $('#audit-select-title').html(setting.title);
         const html = [];
         for (const [i, s] of setting.select.entries()) {
@@ -38,7 +38,7 @@ const rptCustomObj = (function () {
 
     const init = function (cDefine, sfData, cSelect) {
         stageFlow = sfData;
-        if (cDefine && cDefine[sAuditSelect]) {
+        if (cDefine && cDefine.enable && cDefine[sAuditSelect] && cDefine[sAuditSelect] !== '') {
             $('#pnl_audit_select').show();
             initAuditSelect(cDefine[sAuditSelect].setting, cSelect.audit_select);
         } else {

+ 0 - 13
app/service/report.js

@@ -155,16 +155,3 @@ module.exports = app => {
 
     return Report;
 };
-
-async function checkStg(ctx, params) {
-    if (ctx.stage === null || ctx.stage === undefined || parseInt(ctx.stage.id) !== parseInt(params.stage_id)) {
-        await ctx.service.stage.checkStage(params.stage_id);
-        if (ctx.stage) {
-            // params.stage_order = ctx.stage.curOrder;
-            // console.log('ctx.stage.curOrder: ' + ctx.stage.curOrder);
-            // console.log('ctx.stage.order: ' + ctx.stage.order);
-            params.stage_order = ctx.stage.order; // 经过check stage后,取新的order
-            params.stage_times = ctx.stage.times; // 经过check stage后,取新的times
-        }
-    }
-}

+ 1 - 0
app/service/rpt_custom_define.js

@@ -26,6 +26,7 @@ module.exports = app => {
             if (data && data.audit_select) {
                 data.audit_select = JSON.parse(data.audit_select);
             }
+            return data;
         }
     }