瀏覽代碼

报表,汇总表,导出Excel、pdf(批量)

MaiXinRong 5 年之前
父節點
當前提交
59215012e2

+ 19 - 0
app/const/report.js

@@ -0,0 +1,19 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+const JV = require('../reports/rpt_component/jpc_value_define.js');
+
+const rptCustomType = {};
+rptCustomType[JV.NODE_CUS_AUDIT_SELECT] = 1;
+rptCustomType[JV.NODE_CUS_GATHER_SELECT] = 2;
+rptCustomType[JV.NODE_CUS_COMPARE_SELECT] = 3;
+
+module.exports = {
+    rptCustomType,
+};

+ 80 - 17
app/controller/report_controller.js

@@ -16,6 +16,7 @@ const fsUtil = require('../public/js/fsUtil');
 const fs = require('fs');
 const rptCronJob = require('../reports/util/rpt_tmp_file_sweep');
 const RPT_DEF_PROPERTIES = require('../const/report_defined_properties');
+const reportConst = require('../const/report');
 
 module.exports = app => {
     class ReportController extends app.BaseController {
@@ -59,6 +60,21 @@ module.exports = app => {
                     }
                 }
 
+                // 获取汇总表,历史选择
+                const cid = this.ctx.helper._.map(treeNodes, 'id');
+                const customSelects = {};
+                if (ctx.stage) {
+                    customSelects.audit_select = await ctx.service.rptCustomDefine.getCustomSelectByRpt(cid,
+                        reportConst.rptCustomType[JV.NODE_CUS_AUDIT_SELECT], ctx.tender.id, ctx.stage.id);
+                    customSelects.stageFlow = await ctx.service.stageAudit.getAuditGroupByListWithOwner(
+                        params.stage_id, params.stage_times);
+                } else {
+                    customSelects.audit_select = [];
+                }
+                customSelects.gather_select = await ctx.service.rptCustomDefine.getCustomSelectByRpt(cid,
+                    reportConst.rptCustomType[JV.NODE_CUS_GATHER_SELECT], ctx.tender.id, -1);
+
+
                 // const allTpls = await ctx.service.rptTpl.getAllTplByIds(tmpRptIds);
                 // for (const tpl of allTpls) {
                 //     const fName = tpl.id + '_' + tpl.rpt_tpl_name + '.js';
@@ -131,6 +147,8 @@ module.exports = app => {
                     tenderList,
                     auditConst,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.report.main),
+                    customSelects,
+                    rptCustomType: reportConst.rptCustomType,
                 };
                 await this.layout('report/index.ejs', renderData, 'report/rpt_all_popup.ejs');
                 // await this.layout('report/index.ejs', renderData);
@@ -278,6 +296,7 @@ module.exports = app => {
         async getMultiReportsEx(ctx) {
             // 原则说明:把所有报表模板集中获取,统一filter,只读一次数据!
             const params = JSON.parse(ctx.request.body.params);
+            await this._saveCustomSelects(params);
             const pageRstArr = await getMultiRptsCommon(ctx, params, JV.OUTPUT_TYPE_NORMAL, this.app.baseDir);
             const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_ids, params.stage_id)) : [];
             // const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
@@ -295,8 +314,18 @@ module.exports = app => {
             ctx.status = 201;
         }
 
+        async _saveCustomSelects(params) {
+            for (const [i, cs] of params.customSelect.entries()) {
+                cs.tender_id = params.tender_id;
+                cs.stage_id = params.stage_id;
+                cs.rpt_tpl_id = params.rpt_ids[i];
+                await this.ctx.service.rptCustomDefine.saveCustomSelect(cs);
+            }
+        }
+
         async createExcelFilesEx(ctx) {
             const params = JSON.parse(ctx.request.body.params);
+            await this._saveCustomSelects(params);
             const baseDir = this.app.baseDir;
             function getExcelByPageData(pageRst, rpt_name, innerRoleRel) {
                 return new Promise(function(resolve, reject) {
@@ -417,20 +446,21 @@ module.exports = app => {
         async setCustomDefine(ctx) {
             try {
                 const data = JSON.parse(ctx.request.body.data);
-                const sid = data.gather_select ? -1 : data.stage_id;
-                const filter = {tid: data.tender_id, sid: sid, rid: data.rpt_tpl_id};
-                const count = await ctx.service.rptCustomDefine.count(filter);
-                const updateData = {};
-                if (data.audit_select) updateData.audit_select = JSON.stringify(data.audit_select);
-                if (data.gather_select) updateData.gather_select = JSON.stringify(data.gather_select);
-                if (count > 0) {
-                    await ctx.service.rptCustomDefine.update(updateData, filter);
-                } else {
-                    updateData.tid = data.tender_id;
-                    updateData.sid = sid;
-                    updateData.rid = data.rpt_tpl_id;
-                    await ctx.service.rptCustomDefine.db.insert(ctx.service.rptCustomDefine.tableName, updateData);
-                }
+                await this.ctx.service.rptCustomDefine.saveCustomSelect(data);
+                // const sid = data.gather_select ? -1 : data.stage_id;
+                // const filter = {tid: data.tender_id, sid: sid, rid: data.rpt_tpl_id};
+                // const count = await ctx.service.rptCustomDefine.count(filter);
+                // const updateData = {};
+                // if (data.audit_select) updateData.audit_select = JSON.stringify(data.audit_select);
+                // if (data.gather_select) updateData.gather_select = JSON.stringify(data.gather_select);
+                // if (count > 0) {
+                //     await ctx.service.rptCustomDefine.update(updateData, filter);
+                // } else {
+                //     updateData.tid = data.tender_id;
+                //     updateData.sid = sid;
+                //     updateData.rid = data.rpt_tpl_id;
+                //     await ctx.service.rptCustomDefine.db.insert(ctx.service.rptCustomDefine.tableName, updateData);
+                // }
                 const result = await this._getReport(ctx, data);
                 ctx.body = {err: 0, msg: '', data: result};
             } catch (err) {
@@ -606,6 +636,8 @@ async function getAllPagesCommon(ctx, rptTpl, params, option, outputType, baseDi
 }
 
 async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
+    const needCustomTables = ['mem_gather_stage_bills', 'mem_gather_deal_bills', 'mem_gather_stage_pay', 'mem_gather_tender_info'];
+
     for (let idx = 0; idx < params.rpt_ids.length; idx++) {
         params.rpt_ids[idx] = parseInt(params.rpt_ids[idx]); // 转换一下,以防万一
     }
@@ -635,12 +667,13 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
         const filter = rptDataUtil.getDataRequestFilter();
         // console.log(filter);
         for (const table of filter.tables) {
-            if (filterTables.indexOf(table) < 0) {
+            if (filterTables.indexOf(table) < 0 && needCustomTables.indexOf(table) < 0) {
                 filterTables.push(table);
             }
             // memFieldKeys[table] = [];
         }
         for (const tableKeyProp in filter.memFieldKeys) {
+            if (needCustomTables.indexOf(tableKeyProp) >= 0) continue;
             if (!memFieldKeys.hasOwnProperty(tableKeyProp)) {
                 memFieldKeys[tableKeyProp] = [];
             }
@@ -652,7 +685,7 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
         }
     }
 
-    const rawDataObj = await ctx.service.report.getReportData(params, filterTables, memFieldKeys);
+    const rawDataObj = await ctx.service.report.getReportData(params, filterTables, memFieldKeys, {}, {});
     try {
         const rptPageRstArray = [];
         // 1. 这里只用一份数据,根据实际应用情况,先备份
@@ -668,7 +701,9 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
         for (let tplIdx = 0; tplIdx < rptTpls.length; tplIdx++) {
             const rptTpl = (rptTpls[tplIdx]._doc) ? rptTpls[tplIdx]._doc : rptTpls[tplIdx];
             rptDataUtil.initialize(rptTpl);
-            const customSelect = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id);
+            const customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
+                ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
+                : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
 
             // 从汇总的rawDataObj中拷贝所需数据表至curRawDataObj,以供后续使用
             const curRawDataObj = {};
@@ -676,6 +711,34 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             for (const table of filter.tables) {
                 curRawDataObj[table] = ctx.helper.clone(rawDataObj[table]);
             }
+            // 如果是用户交互类型的表,则应该单独获取数据
+            if (params.customSelect && params.customSelect[tplIdx]) {
+                const cfTables = [], cmFieldKeys = [];
+                const curFilter = rptDataUtil.getDataRequestFilter();
+                for (const table of curFilter.tables) {
+                    if (needCustomTables.indexOf(table) >= 0) {
+                        cfTables.push(table);
+                    }
+                }
+                for (const tableKeyProp in filter.memFieldKeys) {
+                    if (needCustomTables.indexOf(tableKeyProp) < 0) continue;
+                    if (!cmFieldKeys.hasOwnProperty(tableKeyProp)) {
+                        cmFieldKeys[tableKeyProp] = [];
+                    }
+                    for (const mfKey of filter.memFieldKeys[tableKeyProp]) {
+                        if (cmFieldKeys[tableKeyProp].indexOf(mfKey) < 0) {
+                            cmFieldKeys[tableKeyProp].push(mfKey);
+                        }
+                    }
+                }
+                console.log(customSelect);
+                const customRawDataObj = await ctx.service.report.getReportData(params, cfTables, cmFieldKeys,
+                    rptTpl[JV.NODE_CUSTOM_DEFINE], customSelect);
+                console.log(customRawDataObj);
+                for (const prop in customRawDataObj) {
+                    curRawDataObj[prop] = customRawDataObj[prop];
+                }
+            }
 
             const tplData = rptDataUtil.assembleData(ctx, curRawDataObj, baseDir, null, customSelect);
             const printCom = JpcEx.createNew();

+ 59 - 14
app/public/report/js/rpt_custom.js

@@ -207,12 +207,12 @@ const rptCustomObj = (function () {
         }
     };
 
-    const initGatherSelect = function (gsSetting, gsSelect) {
+    const initGatherSelect = function (gsSetting, gsSelect, rptName, resolve = null) {
         gsObj.grArray = [];
         gsObj.setting = JSON.parse(gsSetting);
         gsObj.orgSelect = gsSelect;
         $('#gather-select-count').html(gsSelect ? gsSelect.tenders.length : 0);
-        $('#gather-select-title').html(gsObj.setting.title);
+        $('#gather-select-title').html(gsObj.setting.title + (rptName ? '-' + rptName : ''));
         initGrSpreadSetting(gsObj.setting);
         SpreadJsObj.initSheet(gsObj.grSheet, grSpreadSetting);
         if (gsObj.setting.type === 'month') {
@@ -235,10 +235,14 @@ const rptCustomObj = (function () {
             }
         }
         gatherSelectSpreadObj.initSelectTenders(gsSelect ? gsSelect.tenders : []);
+
         // 初始化
         $("#gather-select").modal('show');
+
+        $('#gather-select-ok').unbind('click');
+        $('#gather-select-ok').bind('click', () => {rptCustomObj.resetGatherSelect(resolve);});
     };
-    const init = function (cDefine, sfData, cSelect) {
+    const init = function (cDefine, sfData, cSelect, rptName, resolve = null) {
         stageFlow = sfData;
         if (cDefine && cDefine[sAuditSelect] && cDefine[sAuditSelect].enable && cDefine[sAuditSelect].setting) {
             $('#pnl_audit_select').show();
@@ -248,7 +252,7 @@ const rptCustomObj = (function () {
         }
         if (cDefine && cDefine[sGatherSelect] && cDefine[sGatherSelect].enable && cDefine[sGatherSelect].setting) {
             $('#pnl_gather_select').show();
-            initGatherSelect(cDefine[sGatherSelect].setting, cSelect ? cSelect[sGatherSelect] : null);
+            initGatherSelect(cDefine[sGatherSelect].setting, cSelect ? cSelect[sGatherSelect] : null, rptName, resolve);
         } else {
             $('#pnl_gather_select').hide();
         }
@@ -265,6 +269,7 @@ const rptCustomObj = (function () {
             if (current_stage_status === 3) {
                 rptSignatureHelper.mergeSignDate(pageRst, ROLE_REL_LIST);
                 rptSignatureHelper.mergeSignature(pageRst, ROLE_REL_LIST);
+                rptSignatureHelper.mergeSignAudit(pageRst, ROLE_REL_LIST, STAGE_AUDIT);
             }
         } else {
             CURRENT_ROLE_REL_ID = -1;
@@ -310,11 +315,11 @@ const rptCustomObj = (function () {
             }
         } catch(err) {
         }
+        zTreeOprObj.countChkedRptTpl();
     };
 
     const getCommonParams = function (data) {
         data.pageSize = rptControlObj.getCurrentPageSize();
-        data.orientation = rptControlObj.getCurrentOrientation();
         data.rpt_tpl_id = zTreeOprObj.currentNode.refId;
         data.custCfg = CUST_CFG;
         data.project_id = PROJECT_ID;
@@ -344,9 +349,9 @@ const rptCustomObj = (function () {
         });
     };
 
-    const resetGatherSelect = function () {
+    const resetGatherSelect = function (resolve = null) {
         const data = {}, hintObj = $('#gather-hint');
-        getCommonParams(data);
+        if (!resolve) getCommonParams(data);
         data[sGatherSelect] = {
             tenders: [],
             type: gsObj.setting.type,
@@ -389,12 +394,21 @@ const rptCustomObj = (function () {
             }
         }
         hintObj.hide();
-        postData('/report/cDefine', data, function (result) {
-            reloadReportData(result);
-            $('#gather-select-count').html(data[sGatherSelect].tenders.length);
-            $('#gather-select').modal('hide');
-        });
-
+        if (resolve) {
+            resolve(data);
+        } else {
+            postData('/report/cDefine', data, function (result) {
+                reloadReportData(result);
+                const gather_select = customSelects.gather_select.find(function (x) {
+                    return x.id === zTreeOprObj.currentNode.refId;
+                });
+                if (gather_select) {
+                    gather_select.gather_select = data[sGatherSelect];
+                }
+                $('#gather-select-count').html(data[sGatherSelect].tenders.length);
+                $('#gather-select').modal('hide');
+            });
+        }
     };
 
     const initTenderTree = function (tenders, category) {
@@ -437,5 +451,36 @@ const rptCustomObj = (function () {
         });
     };
 
-    return {init, resetAuditSelect, resetGatherSelect, initTenderTree};
+    const comfirmSelectPromise = function (rptName, gather_select) {
+        const promise = new Promise(function (resolve, reject) {
+            init(gather_select.custom_define, customSelects.stageFlow, gather_select, rptName, resolve, reject);
+        });
+        return promise;
+    };
+
+    const getCustomSelect = async function (params) {
+        if (!params.rpt_ids || params.rpt_ids.length === 0) return;
+
+        const currentRptId = zTreeOprObj.currentNode ? zTreeOprObj.currentNode.refId : -1;
+        params.customSelect = [];
+        const chkNodes = zTreeOprObj.treeObj.getCheckedNodes(true);
+        for (const rptId of params.rpt_ids) {
+            const gather_select = customSelects.gather_select.find(function (x) {
+                return x.id === rptId;
+            });
+            if (gather_select && gather_select.custom_define && gather_select.custom_define[sGatherSelect].enable) {
+                if (rptId === currentRptId) {
+                    params.customSelect.push(gather_select[sGatherSelect]);
+                } else {
+                    const chkNode = chkNodes.find(function (x) { return x.refId === rptId});
+                    params.customSelect.push(await comfirmSelectPromise(chkNode ? chkNode.name : '', gather_select));
+                }
+            } else {
+                params.customSelect.push(null);
+            }
+        }
+        $('#gather-select').modal('hide');
+    };
+
+    return {init, resetAuditSelect, resetGatherSelect, initTenderTree, getCustomSelect};
 })();

+ 17 - 4
app/public/report/js/rpt_main.js

@@ -226,6 +226,15 @@ let zTreeOprObj = {
             params.stage_order = getStageOrder();
             params.stage_times = getStageTimes();
             params.custCfg = CUST_CFG;
+
+            const gather_select = customSelects.gather_select.find(function (x) {
+                return x.id === treeNode.refId;
+            });
+            if (gather_select) {
+                rptCustomObj.init(gather_select.custom_define, customSelects.stageFlow, gather_select);
+                return;
+            }
+
             me.requestNormalReport(params);
             me.countChkedRptTpl();
         }
@@ -477,12 +486,13 @@ let rptControlObj = {
 
         return rst;
     },
-    getAllInOneBook: function () {
+    getAllInOneBook: async function () {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let me = rptControlObj;
             let refRptTplIds = [], rpt_sheet_names = [];
             rptControlObj.getTplIdsCommon(refRptTplIds, rpt_sheet_names);
             let params = rptControlObj.creatCommonExportParam(refRptTplIds);
+            await rptCustomObj.getCustomSelect(params);
             params.rpt_names = rpt_sheet_names;
             params.rptName = TENDER_NAME;
             let chkNodes = zTreeOprObj.treeObj.getCheckedNodes(true);
@@ -502,13 +512,14 @@ let rptControlObj = {
             );
         }
     },
-    getAllIndividualExcelBook: function () {
+    getAllIndividualExcelBook: async function () {
         let me = rptControlObj;
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let refRptTplIds = [];
             let rpt_names = [];
             rptControlObj.getTplIdsCommon(refRptTplIds, rpt_names);
             let params = rptControlObj.creatCommonExportParam(refRptTplIds);
+            await rptCustomObj.getCustomSelect(params);
             params.isOneSheet = true;
             params.rpt_names = rpt_names;
             params.rptName = 'All';
@@ -516,6 +527,7 @@ let rptControlObj = {
             if (chkNodes.length > 0) {
                 delete params.orientation; // 打印时有勾选的话,不需要提供方向
             }
+
             CommonAjax.postXsrfEx("/tender/report_api/createExcelFiles", params, 300000, true, getCookie('csrfToken'), function(result){
                     if (result) {
                         let uuIdUrls = [];
@@ -559,7 +571,6 @@ let rptControlObj = {
     getPDFPre: function () {
         let me = rptControlObj;
         // showWaitingView();
-        $.bootstrapLoading.start();
         if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
             me.getPDFEx();
         } else {
@@ -569,7 +580,7 @@ let rptControlObj = {
             // dynamicLoadJs('http://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', "normal", me.getPdfFontCallback('bold'));
         }
     },
-    getPDFEx: function () {
+    getPDFEx: async function () {
         let me = rptControlObj;
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let refRptTplIds = [];
@@ -578,7 +589,9 @@ let rptControlObj = {
             const signatureRelArr = [];
             if (refRptTplIds.length > 0) {
                 let params = rptControlObj.creatCommonExportParam(refRptTplIds);
+                await rptCustomObj.getCustomSelect(params);
                 delete params.orientation; // 打印时有勾选的话,不需要提供方向
+                $.bootstrapLoading.start();
                 CommonAjax.postXsrfEx("/tender/report_api/getMultiReports", params, 300000, true, getCookie('csrfToken'),
                     function(result){
                         // closeWaitingView();

+ 2 - 1
app/public/report/js/rpt_print.js

@@ -3,11 +3,12 @@
  */
 
 let rptPrintHelper = {
-    preview: function () {
+    preview: async function () {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let refRptTplIds = [];
             rptControlObj.getTplIdsCommon(refRptTplIds, null);
             let params = rptControlObj.creatCommonExportParam(refRptTplIds);
+            await rptCustomObj.getCustomSelect(params);
             let chkNodes = zTreeOprObj.treeObj.getCheckedNodes(true);
             if (chkNodes.length > 0) {
                 delete params.orientation; // 打印时有勾选的话,不需要提供方向

+ 2 - 0
app/reports/rpt_component/jpc_value_define.js

@@ -51,6 +51,8 @@ module.exports = {
 
     NODE_CUSTOM_DEFINE: '用户交互',
     NODE_CUS_AUDIT_SELECT: 'audit_select',
+    NODE_CUS_GATHER_SELECT: 'gather_select',
+    NODE_CUS_COMPARE_SELECT: 'compare_select',
 
     NODE_MAP_DATA_HANDLE_INFO: '映射数据预处理',
     PROP_DATA_KEY: '映射数据对象',

+ 66 - 0
app/service/rpt_custom_define.js

@@ -7,6 +7,7 @@
  * @date
  * @version
  */
+const JV = require('../reports/rpt_component/jpc_value_define');
 
 module.exports = app => {
     class RptCustomDefine extends app.BaseService {
@@ -50,6 +51,71 @@ module.exports = app => {
                 return true;
             }
         }
+
+        async saveCustomSelect(data) {
+            const sid = data.gather_select ? -1 : data.stage_id;
+            const filter = {tid: data.tender_id, sid: sid, rid: data.rpt_tpl_id};
+            const count = await this.count(filter);
+            const updateData = {};
+            if (data.audit_select) updateData.audit_select = JSON.stringify(data.audit_select);
+            if (data.gather_select) updateData.gather_select = JSON.stringify(data.gather_select);
+            if (count > 0) {
+                await this.update(updateData, filter);
+            } else {
+                updateData.tid = data.tender_id;
+                updateData.sid = sid;
+                updateData.rid = data.rpt_tpl_id;
+                await this.db.insert(this.tableName, updateData);
+            }
+        }
+
+        async getCustomSelectByRpt(cid, rpt_c_type, tid, sid) {
+            const result = await this.ctx.service.rptTpl.getAllDataByCondition({
+                where: {cid: cid, rpt_c_type: rpt_c_type}
+            });
+            const customSelect = await this.getAllDataByCondition({
+                where: {tid: tid, sid: sid}
+            });
+            for (const r of result) {
+                const rptObj = JSON.parse(r.rpt_content);
+                if (rptObj) r.custom_define = rptObj[JV.NODE_CUSTOM_DEFINE];
+                delete r.rpt_content;
+
+                const cs = this.ctx.helper._.find(customSelect, {rid: r.id});
+                if (!cs) continue;
+                r.tid = tid;
+                r.sid = sid;
+                if (cs.audit_select) {
+                    r.audit_select = JSON.parse(cs.audit_select);
+                }
+                if (cs.gather_select) {
+                    r.gather_select = JSON.parse(cs.gather_select);
+                }
+            }
+            // const sql = 'SELECT rt.id, rt.cid, rt.rpt_c_type, rt.rpt_content, rcd.tid, rcd.sid, rcd.audit_select, rcd.gather_select' +
+            //     '  FROM ' + this.ctx.service.rptTpl.tableName + ' rt' +
+            //     '  LEFT JOIN ' + this.tableName + ' rcd' +
+            //     '  ON rcd.rid = rt.id' +
+            //     this.ctx.helper.whereSql({cid: cid, rpt_c_type: rpt_c_type}, 'rt') + ' AND rcd.tid = ? AND rcd.sid = ?';
+            // const sqlParam = [tid, sid];
+            // console.log(this.db.format(sql, sqlParam));
+            // const result = await this.db.query(sql, sqlParam);
+            // for (const r of result) {
+            //     try {
+            //         if (r.audit_select) {
+            //             r.audit_select = JSON.parse(r.audit_select);
+            //         }
+            //         if (r.gather_select) {
+            //             r.gather_select = JSON.parse(r.gather_select);
+            //         }
+            //         const rptObj = JSON.parse(r.rpt_content);
+            //         if (rptObj) r.custom_define = rptObj[JV.NODE_CUSTOM_DEFINE];
+            //     } catch (err) {
+            //     }
+            //     delete r.rpt_content;
+            // }
+            return result;
+        }
     }
 
     return RptCustomDefine;

+ 1 - 0
app/view/report/index.ejs

@@ -244,6 +244,7 @@
     let current_stage_id = -1;
     let current_stage_times = -1;
     let current_stage_status = -1;
+    const customSelects = <%- JSON.stringify(customSelects) %>;
 
     if (STAGE_ORDER > 0) {
         current_stage_order = STAGE_ORDER;

+ 1 - 1
app/view/report/rpt_all_popup.ejs

@@ -312,7 +312,7 @@
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
-                <button class="btn btn-sm btn-primary" id="gather-select-ok" onclick="rptCustomObj.resetGatherSelect(this)">确定</button>
+                <button class="btn btn-sm btn-primary" id="gather-select-ok">确定</button>
             </div>
         </div>
     </div>