|
@@ -196,7 +196,7 @@ function setupCustomizeCfg(customizeCfg, rptTpl, defProperties) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, option, outputType, flag, cb) {
|
|
|
+async function getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, option, outputType, flag, cb) {
|
|
|
let rptTpl = null;
|
|
|
rptTplFacade.getRptTemplate(rpt_id).then(function(rst) {
|
|
|
rptTpl = rst;
|
|
@@ -219,80 +219,9 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
|
|
|
// economicRst.push('ProjectFeatureFields');
|
|
|
promiseArr[2] = pm_facade.getIndexReportData(prj_id, economicRst);
|
|
|
}
|
|
|
- rptTplDataFacade.prepareProjectData(user_id, prj_id, filter, function (err, msg, rawDataObj) {
|
|
|
- if (!err) {
|
|
|
- let buildPageData = function() {
|
|
|
- try {
|
|
|
- let tplData = rptDataUtil.assembleData(rawDataObj);
|
|
|
- let printCom = JpcEx.createNew();
|
|
|
- if (pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
|
|
|
- //console.log("orientation: " + (orientation === 'null'));
|
|
|
- if (orientation && (orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = orientation;
|
|
|
- let defProperties = rptUtil.getReportDefaultCache();
|
|
|
- if (customizeCfg) setupCustomizeCfg(customizeCfg, rptTpl, defProperties);
|
|
|
- let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
- printCom.initialize(rptTpl);
|
|
|
- printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
|
|
|
- let maxPages = printCom.totalPages;
|
|
|
- let pageRst = null;
|
|
|
- if (maxPages > 0) {
|
|
|
- pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
|
|
|
- } else {
|
|
|
- pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
|
|
|
- }
|
|
|
- if (pageRst) {
|
|
|
- // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
|
|
|
- cb(null, pageRst);
|
|
|
- } else {
|
|
|
- cb('Have errors while on going...', null);
|
|
|
- }
|
|
|
- } catch (ex) {
|
|
|
- console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
|
|
|
- console.log(ex);
|
|
|
- cb('Exception occurs while on going...', null);
|
|
|
- }
|
|
|
- };
|
|
|
- //*/
|
|
|
- //取汇总数据流程
|
|
|
- if (promiseArr[0] !== null) {
|
|
|
- promiseArr[0].then(function (rst) {
|
|
|
- rawDataObj.Construct = rst.parent;
|
|
|
- rawDataObj.ConstructDetail = rst.subList;
|
|
|
- if (promiseArr[1] !== null) {
|
|
|
- promiseArr[1].then(function (rst) {
|
|
|
- rawDataObj.Segment = rst.parent;
|
|
|
- rawDataObj.SegmentDetail = rst.subList;
|
|
|
- buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
- });
|
|
|
- } else {
|
|
|
- buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
- }
|
|
|
- });
|
|
|
- } else if (promiseArr[1] !== null) {
|
|
|
- promiseArr[1].then(function (rst) {
|
|
|
- rawDataObj.Segment = rst.parent;
|
|
|
- rawDataObj.SegmentDetail = rst.subList;
|
|
|
- buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
- });
|
|
|
- } else {
|
|
|
- if (promiseArr[2] !== null) {
|
|
|
- promiseArr[2].then(function (rst) {
|
|
|
- let ecoFieldsRst = (rst._doc)?rst._doc:rst;
|
|
|
- // fsUtil.writeObjToFile(ecoFieldsRst, "D:/GitHome/ConstructionCost/tmp/testEcoFieldsResult.jsp");
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectInfoFields', data: ecoFieldsRst.ProjectInfoFields});
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectFeatureFields', data: ecoFieldsRst.ProjectFeatureFields});
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectCostFields', data: ecoFieldsRst.ProjectCostFields});
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectEcoFields', data: ecoFieldsRst.ProjectEcoFields});
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectLabMaterialFields', data: ecoFieldsRst.ProjectLabMaterialFields});
|
|
|
- rawDataObj.prjData.push({moduleName: 'ProjectQtyFields', data: ecoFieldsRst.ProjectQtyFields});
|
|
|
- buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
- });
|
|
|
- } else {
|
|
|
- buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
- }
|
|
|
- }
|
|
|
- /*/
|
|
|
- let tplData = rptDataUtil.assembleData(rawDataObj);
|
|
|
+
|
|
|
+ let _createPntPageData = function(tplData, rptTpl) {
|
|
|
+ try {
|
|
|
let printCom = JpcEx.createNew();
|
|
|
if (pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
|
|
|
//console.log("orientation: " + (orientation === 'null'));
|
|
@@ -303,18 +232,123 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
|
|
|
printCom.initialize(rptTpl);
|
|
|
printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
|
|
|
let maxPages = printCom.totalPages;
|
|
|
- let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
|
|
|
+ let pageRst = null;
|
|
|
+ if (maxPages > 0) {
|
|
|
+ pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
|
|
|
+ } else {
|
|
|
+ pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
|
|
|
+ }
|
|
|
if (pageRst) {
|
|
|
// fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
|
|
|
cb(null, pageRst);
|
|
|
} else {
|
|
|
cb('Have errors while on going...', null);
|
|
|
}
|
|
|
- //*/
|
|
|
- } else {
|
|
|
- cb('No report data were found!', null);
|
|
|
+ } catch(ex) {
|
|
|
+ console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
|
|
|
+ console.log(ex.toString());
|
|
|
+ cb('Exception occurs while on going...', null);
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
+
|
|
|
+ let buildPageData = function(rawDataObj, rptDataUtil, rptTpl) {
|
|
|
+ try {
|
|
|
+ let tplData = rptDataUtil.assembleData(rawDataObj);
|
|
|
+ _createPntPageData(tplData, rptTpl);
|
|
|
+ } catch (ex) {
|
|
|
+ console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
|
|
|
+ console.log(ex.toString());
|
|
|
+ cb('Exception occurs while on going...', null);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (flag !== undefined && flag !== null && flag.constructSumType === 'constructSum') {
|
|
|
+ //这个直接取本项目的建设项目下所有的单位工程的数据,然后合并
|
|
|
+ try {
|
|
|
+ console.log('准备取建设项目下所有单位工程数据:');
|
|
|
+ const _combineData = function(destData, srcData) {
|
|
|
+ // 备注:这里有一个前提条件,就是基于相同的报表模板
|
|
|
+ for (let idx = 0; idx < destData[JV.DATA_DISCRETE_DATA].length; idx++) {
|
|
|
+ destData[JV.DATA_DISCRETE_DATA][idx] = destData[JV.DATA_DISCRETE_DATA][idx].concat(srcData[JV.DATA_DISCRETE_DATA][idx]);
|
|
|
+ }
|
|
|
+ for (let idx = 0; idx < destData[JV.DATA_MASTER_DATA].length; idx++) {
|
|
|
+ destData[JV.DATA_MASTER_DATA][idx] = destData[JV.DATA_MASTER_DATA][idx].concat(srcData[JV.DATA_MASTER_DATA][idx]);
|
|
|
+ }
|
|
|
+ for (let idx = 0; idx < destData[JV.DATA_MASTER_DATA_EX].length; idx++) {
|
|
|
+ destData[JV.DATA_MASTER_DATA_EX][idx] = destData[JV.DATA_MASTER_DATA_EX][idx].concat(srcData[JV.DATA_MASTER_DATA_EX][idx]);
|
|
|
+ }
|
|
|
+ for (let idx = 0; idx < destData[JV.DATA_DETAIL_DATA].length; idx++) {
|
|
|
+ destData[JV.DATA_DETAIL_DATA][idx] = destData[JV.DATA_DETAIL_DATA][idx].concat(srcData[JV.DATA_DETAIL_DATA][idx]);
|
|
|
+ }
|
|
|
+ for (let idx = 0; idx < destData[JV.DATA_DETAIL_DATA_EX].length; idx++) {
|
|
|
+ destData[JV.DATA_DETAIL_DATA_EX][idx] = destData[JV.DATA_DETAIL_DATA_EX][idx].concat(srcData[JV.DATA_DETAIL_DATA_EX][idx]);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ rptTplDataFacade.prepareMultiProjectData(user_id, prj_ids, filter).then(function(multiRawData) {
|
|
|
+ //终于出来结果了 !_! (multiRawData是多个单位工程的原始数据!)
|
|
|
+ if (multiRawData.length > 0) {
|
|
|
+ //考虑到工料机的数据还需要再计算,所以还不能直接用,需要每个工程都处理一遍后,再合并
|
|
|
+ let tplData = rptDataUtil.assembleData(multiRawData[0]);
|
|
|
+ for (let idx = 1; idx < multiRawData.length; idx++) {
|
|
|
+ let tmpData = rptDataUtil.assembleData(multiRawData[idx]);
|
|
|
+ _combineData(tplData, tmpData);
|
|
|
+ }
|
|
|
+ _createPntPageData(tplData, rptTpl);
|
|
|
+ } else {
|
|
|
+ cb('Have errors while on going...', null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch(ex) {
|
|
|
+ console.log("取建设项目下所有单位工程数据异常: userId " + user_id + ", project id: " + prj_ids.toString());
|
|
|
+ console.log(ex.toString());
|
|
|
+ cb('Exception occurs while on going...', null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //原有流程
|
|
|
+ rptTplDataFacade.prepareProjectData(user_id, prj_id, filter, function (err, msg, rawDataObj) {
|
|
|
+ if (!err) {
|
|
|
+ //取汇总数据流程
|
|
|
+ if (promiseArr[0] !== null) {
|
|
|
+ promiseArr[0].then(function (rst) {
|
|
|
+ rawDataObj.Construct = rst.parent;
|
|
|
+ rawDataObj.ConstructDetail = rst.subList;
|
|
|
+ if (promiseArr[1] !== null) {
|
|
|
+ promiseArr[1].then(function (rst) {
|
|
|
+ rawDataObj.Segment = rst.parent;
|
|
|
+ rawDataObj.SegmentDetail = rst.subList;
|
|
|
+ buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (promiseArr[1] !== null) {
|
|
|
+ promiseArr[1].then(function (rst) {
|
|
|
+ rawDataObj.Segment = rst.parent;
|
|
|
+ rawDataObj.SegmentDetail = rst.subList;
|
|
|
+ buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (promiseArr[2] !== null) {
|
|
|
+ promiseArr[2].then(function (rst) {
|
|
|
+ let ecoFieldsRst = (rst._doc)?rst._doc:rst;
|
|
|
+ // fsUtil.writeObjToFile(ecoFieldsRst, "D:/GitHome/ConstructionCost/tmp/testEcoFieldsResult.jsp");
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectInfoFields', data: ecoFieldsRst.ProjectInfoFields});
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectFeatureFields', data: ecoFieldsRst.ProjectFeatureFields});
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectCostFields', data: ecoFieldsRst.ProjectCostFields});
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectEcoFields', data: ecoFieldsRst.ProjectEcoFields});
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectLabMaterialFields', data: ecoFieldsRst.ProjectLabMaterialFields});
|
|
|
+ rawDataObj.prjData.push({moduleName: 'ProjectQtyFields', data: ecoFieldsRst.ProjectQtyFields});
|
|
|
+ buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ cb('No report data were found!', null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
cb('No report template was found!', null);
|
|
|
}
|
|
@@ -350,6 +384,7 @@ module.exports = {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
rpt_id = params.rpt_tpl_id,
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
flag = params.flag;
|
|
|
pageSize = params.pageSize,
|
|
|
orientation = params.orientation,
|
|
@@ -357,7 +392,7 @@ module.exports = {
|
|
|
;
|
|
|
// req.session.sessionUser.ssoId
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, flag, function (err, pageRst) {
|
|
|
try {
|
|
|
let userModel = new UserModel();
|
|
|
// console.log('req.session.sessionUser.ssoId: ' + req.session.sessionUser.ssoId);
|
|
@@ -379,6 +414,7 @@ module.exports = {
|
|
|
getMultiReports: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_ids = params.rpt_ids.split(','),
|
|
|
flags = params.flags;
|
|
|
pageSize = params.pageSize,
|
|
@@ -388,11 +424,11 @@ module.exports = {
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
let parallelFunctions = [];
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
- for (let idx = 0; idx < rpt_ids; idx++) {
|
|
|
- let id = rpt_ids[idx], flag = flags[idx];
|
|
|
+ for (let idx = 0; idx < rpt_ids.length; idx++) {
|
|
|
+ let id = rpt_ids[idx], r_flag = flags[idx];
|
|
|
parallelFunctions.push((function (rpt_id, flag) {
|
|
|
return function (cb) {
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_NORMAL, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_NORMAL, flag, function (err, pageRst) {
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
}
|
|
@@ -401,7 +437,7 @@ module.exports = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })(parseInt(id, flag)));
|
|
|
+ })(parseInt(id), r_flag));
|
|
|
}
|
|
|
async.parallel(parallelFunctions, function (err, pageRstArray) {
|
|
|
if (err) {
|
|
@@ -429,12 +465,13 @@ module.exports = {
|
|
|
rpt_id = params.rpt_tpl_id,
|
|
|
flag = params.flag;
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
pageSize = params.pageSize,
|
|
|
orientation = params.orientation,
|
|
|
customizeCfg = params.custCfg
|
|
|
;
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_SVG, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_SVG, flag, function (err, pageRst) {
|
|
|
let svgRstStrArr = rpt_svg_util.exportSvgStr(pageRst, 0, 0);
|
|
|
callback(req, res, err, svgRstStrArr);
|
|
|
});
|
|
@@ -443,6 +480,7 @@ module.exports = {
|
|
|
createExcelFilesInOneBook: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_ids = params.rpt_ids,
|
|
|
flags = params.flags;
|
|
|
rptName = params.rptName,
|
|
@@ -454,10 +492,10 @@ module.exports = {
|
|
|
let parallelFunctions = [];
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
for (let idx = 0; idx < rpt_ids.length; idx++) {
|
|
|
- let r_id = rpt_ids[idx], flag = flags[idx];
|
|
|
- parallelFunctions.push((function (rpt_id) {
|
|
|
+ let r_id = rpt_ids[idx], r_flag = flags[idx];
|
|
|
+ parallelFunctions.push((function (rpt_id, flag) {
|
|
|
return function (cb) {
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
}
|
|
@@ -466,7 +504,7 @@ module.exports = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })(parseInt(r_id)));
|
|
|
+ })(parseInt(r_id), r_flag));
|
|
|
}
|
|
|
async.parallel(parallelFunctions, function (err, pageRstArray) {
|
|
|
if (err) {
|
|
@@ -483,6 +521,7 @@ module.exports = {
|
|
|
createExcelFiles: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_ids = params.rpt_ids,
|
|
|
flags = params.flags;
|
|
|
rpt_names = params.rpt_names,
|
|
@@ -495,11 +534,11 @@ module.exports = {
|
|
|
let parallelFunctions = [];
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
for (let idx = 0; idx < rpt_ids.length; idx++) {
|
|
|
- let r_id = rpt_ids[idx], flag = flags[idx];
|
|
|
+ let r_id = rpt_ids[idx], r_flag = flags[idx];
|
|
|
let r_name = rpt_names[idx];
|
|
|
- parallelFunctions.push((function (rpt_id, rpt_name) {
|
|
|
+ parallelFunctions.push((function (rpt_id, rpt_name, flag) {
|
|
|
return function (cb) {
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
} else {
|
|
@@ -510,7 +549,7 @@ module.exports = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })(parseInt(r_id), r_name));
|
|
|
+ })(parseInt(r_id), r_name, r_flag));
|
|
|
}
|
|
|
async.parallel(parallelFunctions, function (err, fileRstArray) {
|
|
|
if (err) {
|
|
@@ -544,6 +583,7 @@ module.exports = {
|
|
|
},
|
|
|
getExcel: function(req, res) {
|
|
|
let prj_id = req.params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_id = req.params.rpt_id,
|
|
|
flag = req.params.flag,
|
|
|
pageSize = req.params.size,
|
|
@@ -555,7 +595,7 @@ module.exports = {
|
|
|
let customizeCfg = null;
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function(err, pageRst){
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function(err, pageRst){
|
|
|
try {
|
|
|
rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, null, function(uuidName){
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
@@ -576,6 +616,7 @@ module.exports = {
|
|
|
},
|
|
|
getExcelInOneBook: function (req, res) {
|
|
|
let prj_id = req.params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_ids = req.params.rpt_ids.split(','),
|
|
|
flags = req.params.flags;
|
|
|
pageSize = req.params.size,
|
|
@@ -585,10 +626,10 @@ module.exports = {
|
|
|
let parallelFunctions = [];
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
for (let idx = 0; idx < rpt_ids.length; idx++) {
|
|
|
- let id = rpt_ids[idx], flag = flags[idx];
|
|
|
+ let id = rpt_ids[idx], r_flag = flags[idx];
|
|
|
parallelFunctions.push((function (rpt_id, flag) {
|
|
|
return function (cb) {
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, null, null, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, null, null, dftOption, JV.OUTPUT_TYPE_EXCEL, flag, function (err, pageRst) {
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
}
|
|
@@ -597,7 +638,7 @@ module.exports = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })(parseInt(id, flag)));
|
|
|
+ })(parseInt(id), r_flag));
|
|
|
}
|
|
|
async.parallel(parallelFunctions, function (err, pageRstArray) {
|
|
|
if (err) {
|
|
@@ -621,6 +662,7 @@ module.exports = {
|
|
|
createPdfFiles: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
prj_id = params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_ids = params.rpt_ids,
|
|
|
flags = params.flags,
|
|
|
rpt_names = params.rpt_names,
|
|
@@ -632,11 +674,11 @@ module.exports = {
|
|
|
let parallelFunctions = [];
|
|
|
let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
for (let idx = 0; idx < rpt_ids.length; idx++) {
|
|
|
- let r_id = rpt_ids[idx], flag = flags[idx];
|
|
|
+ let r_id = rpt_ids[idx], r_flag = flags[idx];
|
|
|
let r_name = rpt_names[idx];
|
|
|
- parallelFunctions.push((function (rpt_id, rpt_name) {
|
|
|
+ parallelFunctions.push((function (rpt_id, rpt_name, flag) {
|
|
|
return function (cb) {
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_PDF, flag, function (err, pageRst) {
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, customizeCfg, dftOption, JV.OUTPUT_TYPE_PDF, flag, function (err, pageRst) {
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
}
|
|
@@ -648,7 +690,7 @@ module.exports = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })(parseInt(r_id), r_name));
|
|
|
+ })(parseInt(r_id), r_name, r_flag));
|
|
|
}
|
|
|
async.parallel(parallelFunctions, function (err, fileRstArray) {
|
|
|
if (err) {
|
|
@@ -661,6 +703,7 @@ module.exports = {
|
|
|
},
|
|
|
getPDF:function (req, res) {
|
|
|
let prj_id = req.params.prj_id,
|
|
|
+ prj_ids = params.prj_ids,
|
|
|
rpt_id = req.params.rpt_id,
|
|
|
flag = req.params.flag;
|
|
|
pageSize = req.params.size,
|
|
@@ -668,7 +711,7 @@ module.exports = {
|
|
|
rptName = req.params.rptName
|
|
|
;
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
- getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, null, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_PDF, flag, function(err, pageRst){
|
|
|
+ getAllPagesCommon(user_id, prj_id, prj_ids, rpt_id, pageSize, orientation, null, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_PDF, flag, function(err, pageRst){
|
|
|
rpt_pdf_util.export_pdf_file(pageRst, pageSize, rptName,function (uuidName) {
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
// res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
|