|
@@ -638,11 +638,11 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
|
|
|
try {
|
|
|
const rptPageRstArray = [];
|
|
|
// 1. 这里只用一份数据,根据实际应用情况,先备份
|
|
|
- const backupData = {};
|
|
|
- for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
|
|
|
- backupData[filterTables[filterIdx]] = [];
|
|
|
- Object.assign(backupData[filterTables[filterIdx]], rawDataObj[filterTables[filterIdx]]);
|
|
|
- }
|
|
|
+ // const backupData = {};
|
|
|
+ // for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
|
|
|
+ // backupData[filterTables[filterIdx]] = [];
|
|
|
+ // Object.assign(backupData[filterTables[filterIdx]], rawDataObj[filterTables[filterIdx]]);
|
|
|
+ // }
|
|
|
// 2. 一个一个模板创建数据
|
|
|
// let defProperties = await ctx.service.rptPreDefineCfg.getCfgById('Administrator');
|
|
|
// defProperties = JSON.parse(defProperties[0].defined_content);
|
|
@@ -651,6 +651,14 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
|
|
|
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);
|
|
|
+
|
|
|
+ // 从汇总的rawDataObj中拷贝所需数据表至curRawDataObj,以供后续使用
|
|
|
+ const curRawDataObj = {};
|
|
|
+ const filter = rptDataUtil.getDataRequestFilter();
|
|
|
+ for (const table of filter.tables) {
|
|
|
+ curRawDataObj[table] = ctx.helper.clone(rawDataObj[table]);
|
|
|
+ }
|
|
|
+
|
|
|
const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, null, customSelect);
|
|
|
const printCom = JpcEx.createNew();
|
|
|
rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = params.pageSize;
|
|
@@ -673,12 +681,12 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
|
|
|
}
|
|
|
rptPageRstArray.push(pageRst);
|
|
|
// 注意:这里需要把备份数据assign回去!!!
|
|
|
- if (tplIdx < rptTpls.length - 1) {
|
|
|
- for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
|
|
|
- backupData[filterTables[filterIdx]] = [];
|
|
|
- Object.assign(rawDataObj[filterTables[filterIdx]], backupData[filterTables[filterIdx]]);
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (tplIdx < rptTpls.length - 1) {
|
|
|
+ // for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
|
|
|
+ // backupData[filterTables[filterIdx]] = [];
|
|
|
+ // Object.assign(rawDataObj[filterTables[filterIdx]], backupData[filterTables[filterIdx]]);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
return rptPageRstArray;
|
|
|
} catch (ex) {
|