Browse Source

审批人选择问题

MaiXinRong 5 năm trước cách đây
mục cha
commit
733dbac651
2 tập tin đã thay đổi với 7 bổ sung12 xóa
  1. 4 9
      app/controller/report_controller.js
  2. 3 3
      app/public/report/js/rpt_custom.js

+ 4 - 9
app/controller/report_controller.js

@@ -166,6 +166,7 @@ module.exports = app => {
             rptTpl = JSON.parse(rptTpl[0].rpt_content);
             // console.log('get the template!');
             const customSelect = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id);
+            console.log(customSelect);
             const pageRst = await getAllPagesCommon(ctx, rptTpl, params, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, this.app.baseDir, customSelect);
             // console.log(pageRst);
             // const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
@@ -556,16 +557,13 @@ 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.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);
+        printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect);
         // console.log(JSON.stringify(rptTpl));
         const maxPages = printCom.totalPages;
         let pageRst = null;
         if (maxPages > 0) {
-            pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customDefine);
+            pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
         } else {
             pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
         }
@@ -658,11 +656,8 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             const maxPages = printCom.totalPages;
             let pageRst = null;
             // console.log(maxPages);
-            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);
+                pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
             } else {
                 pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
             }

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

@@ -17,7 +17,7 @@ const rptCustomObj = (function () {
         const html = [];
         html.push('<select style="width: 80%">');
         for (const sf of stageFlow) {
-            html.push('<option' + (sf.order === select.order ? ' selected' : '') + '>' + sf.name + '-' + sf.role +'</option>');
+            html.push('<option' + (select && sf.order === select.order ? ' selected' : '') + '>' + sf.name + '-' + sf.role +'</option>');
         }
         html.push('</select>');
         return html.join('');
@@ -38,9 +38,9 @@ const rptCustomObj = (function () {
 
     const init = function (cDefine, sfData, cSelect) {
         stageFlow = sfData;
-        if (cDefine && cDefine.enable && cDefine[sAuditSelect] && cDefine[sAuditSelect] !== '') {
+        if (cDefine && cDefine[sAuditSelect] && cDefine[sAuditSelect].enable && cDefine[sAuditSelect].setting) {
             $('#pnl_audit_select').show();
-            initAuditSelect(cDefine[sAuditSelect].setting, cSelect.audit_select);
+            initAuditSelect(cDefine[sAuditSelect].setting, cSelect ? cSelect.audit_select : []);
         } else {
             $('#pnl_audit_select').hide();
         }