|
|
@@ -563,7 +563,43 @@ function getSummaryComboPages(req, user_id, prjIds, billsSummaryRpt_ids, gljSumm
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function getGljSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
+async function getGljSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
+ let summaryRawDataRst = await rptTplDataFacade.getGLJSummayDatas(prjIds);
|
|
|
+ let rptTpl = await rptTplFacade.getRptTemplate(rpt_id);
|
|
|
+ let rptDataUtil = new rptDataExtractor();
|
|
|
+ rptDataUtil.initialize((rptTpl._doc)?rptTpl._doc:rptTpl);
|
|
|
+ try {
|
|
|
+ // fsUtil.writeObjToFile(summaryRawDataRst, "D:/GitHome/temp/gljSummaryRawDataRstRawData.jsp");
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getGljSummaryReportPages_oldstyle(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
let rptTpl = null;
|
|
|
rptTplDataFacade.getGLJSummayDatas(prjIds).then(function(summaryRawDataRst) {
|
|
|
rptTplFacade.getRptTemplate(rpt_id).then(function(rptTpl) {
|