|
|
@@ -326,7 +326,7 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
|
|
|
} else {
|
|
|
cb('No report template was found!', null);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function getMultiRptsCommon(user_id, prj_id, rpt_ids, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
@@ -403,6 +403,44 @@ function getMultiRptsCommon(user_id, prj_id, rpt_ids, pageSize, orientation, cus
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function getSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
+ let rptTpl = null;
|
|
|
+ rptTplDataFacade.getBudgetSummayDatas(prjIds).then(function(summaryRawDataRst) {
|
|
|
+ rptTplFacade.getRptTemplate(rpt_id).then(function(rptTpl) {
|
|
|
+ let rptDataUtil = new rptDataExtractor();
|
|
|
+ rptDataUtil.initialize((rptTpl._doc)?rptTpl._doc:rptTpl);
|
|
|
+ try {
|
|
|
+ let tplData = rptDataUtil.assembleData(summaryRawDataRst);
|
|
|
+ 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) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
module.exports = {
|
|
|
getReportAllPages: function (req, res) {
|
|
|
@@ -473,6 +511,20 @@ module.exports = {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ getSummaryReportPages: function (req, res) {
|
|
|
+ let params = JSON.parse(req.body.params),
|
|
|
+ rpt_id = params.rpt_tpl_id,
|
|
|
+ prjIds = params.prjIds,
|
|
|
+ pageSize = params.pageSize,
|
|
|
+ orientation = params.orientation,
|
|
|
+ customizeCfg = params.custCfg
|
|
|
+ ;
|
|
|
+ let user_id = req.session.sessionUser.id;
|
|
|
+ getSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, function (err, pageRst) {
|
|
|
+ callback(req, res, err, pageRst);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
getReportAllPagesSvg: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
rpt_id = params.rpt_tpl_id,
|