|
@@ -12,6 +12,8 @@ let rptTplDataFacade = require("../facade/rpt_tpl_data_facade");
|
|
let fsUtil = require("../../../public/fsUtil");
|
|
let fsUtil = require("../../../public/fsUtil");
|
|
let pm_facade = require('../../../modules/pm/facade/pm_facade');
|
|
let pm_facade = require('../../../modules/pm/facade/pm_facade');
|
|
let bill_facade = require('../../../modules/main/facade/bill_facade');
|
|
let bill_facade = require('../../../modules/main/facade/bill_facade');
|
|
|
|
+let equipment_facade = require('../../../modules/equipment_purchase/facade/equipment_purchase_facade');
|
|
|
|
+let calcProgramFacade = require('../../../modules/main/facade/calc_program_facade');
|
|
|
|
|
|
const rptTplFacade = require("../facade/rpt_template_facade");
|
|
const rptTplFacade = require("../facade/rpt_template_facade");
|
|
const demoTemplateFacade = require("../facade/rpt_tpl_data_demo_facade");
|
|
const demoTemplateFacade = require("../facade/rpt_tpl_data_demo_facade");
|
|
@@ -215,6 +217,12 @@ async function getAllPagesCommon(construct_id, user_id, prj_id, prj_ids, rpt_id,
|
|
if (summaryRst.indexOf(`Construct`) >= 0 || summaryRst.indexOf(`ConstructDetail`) >= 0) {
|
|
if (summaryRst.indexOf(`Construct`) >= 0 || summaryRst.indexOf(`ConstructDetail`) >= 0) {
|
|
promiseArr[0] = pm_facade.getSummaryInfoByTender(prj_id, pm_facade.projectType.project);
|
|
promiseArr[0] = pm_facade.getSummaryInfoByTender(prj_id, pm_facade.projectType.project);
|
|
}
|
|
}
|
|
|
|
+ if (summaryRst.indexOf(`BudgetEquipmentDetail`) >= 0) {
|
|
|
|
+ promiseArr[0] = equipment_facade.getEquipmentSummary(prj_ids);
|
|
|
|
+ }
|
|
|
|
+ if (summaryRst.indexOf(`BudgetCalcType`) >= 0 || summaryRst.indexOf(`BudgetCalcTypeDetail`) >= 0) {
|
|
|
|
+ promiseArr[1] = calcProgramFacade.getGatherFees(prj_ids); //与其他汇总类的请求互斥,不能同时出现!
|
|
|
|
+ }
|
|
if (summaryRst.indexOf(`Segment`) >= 0 || summaryRst.indexOf(`SegmentDetail`) >= 0) {
|
|
if (summaryRst.indexOf(`Segment`) >= 0 || summaryRst.indexOf(`SegmentDetail`) >= 0) {
|
|
promiseArr[1] = pm_facade.getSummaryInfoByTender(prj_id, pm_facade.projectType.engineering);
|
|
promiseArr[1] = pm_facade.getSummaryInfoByTender(prj_id, pm_facade.projectType.engineering);
|
|
}
|
|
}
|
|
@@ -266,7 +274,7 @@ async function getAllPagesCommon(construct_id, user_id, prj_id, prj_ids, rpt_id,
|
|
cb('Exception occurs while on going...', null);
|
|
cb('Exception occurs while on going...', null);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- if (flag !== undefined && flag !== null && (flag.constructSumType === 'constructSum' || flag.auditType === 'audit_compare')) {
|
|
|
|
|
|
+ if (flag !== undefined && flag !== null && (flag.constructSumType === 'constructSum' || flag.auditType === 'audit_compare' || flag.budgetSumType === 'budget_single')) {
|
|
//备注:原先这个功能是为了合并建设项目下所有的单位工程的数据,
|
|
//备注:原先这个功能是为了合并建设项目下所有的单位工程的数据,
|
|
// 现在发现就是通用型,审核对比也可以用这个逻辑把数据合并在一起再处理(审核对比的处理逻辑放在模板计算式里)
|
|
// 现在发现就是通用型,审核对比也可以用这个逻辑把数据合并在一起再处理(审核对比的处理逻辑放在模板计算式里)
|
|
try {
|
|
try {
|
|
@@ -333,13 +341,36 @@ async function getAllPagesCommon(construct_id, user_id, prj_id, prj_ids, rpt_id,
|
|
rawDataObj.Construct = rst.parent;
|
|
rawDataObj.Construct = rst.parent;
|
|
rawDataObj.ConstructDetail = rst.subList;
|
|
rawDataObj.ConstructDetail = rst.subList;
|
|
} else {
|
|
} else {
|
|
- rawDataObj.Budget = [];
|
|
|
|
- rawDataObj.BudgetDetail = rst;
|
|
|
|
|
|
+ if (rst instanceof Array) {
|
|
|
|
+ if (rst.length > 0) {
|
|
|
|
+ if (rst[0].hasOwnProperty('equipSummaryType')) {
|
|
|
|
+ rawDataObj.BudgetEquipmentDetail = rst;
|
|
|
|
+ } else {
|
|
|
|
+ rawDataObj.Budget = [];
|
|
|
|
+ rawDataObj.BudgetDetail = rst;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ rawDataObj.Budget = [];
|
|
|
|
+ rawDataObj.BudgetDetail = rst;
|
|
|
|
+ rawDataObj.BudgetEquipmentDetail = rst;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (promiseArr[1] !== null) {
|
|
if (promiseArr[1] !== null) {
|
|
promiseArr[1].then(function (rst2) {
|
|
promiseArr[1].then(function (rst2) {
|
|
- rawDataObj.Segment = rst2.parent;
|
|
|
|
- rawDataObj.SegmentDetail = rst2.subList;
|
|
|
|
|
|
+ if (rst2.hasOwnProperty('parent')) {
|
|
|
|
+ rawDataObj.Segment = rst2.parent;
|
|
|
|
+ rawDataObj.SegmentDetail = rst2.subList;
|
|
|
|
+ } else {
|
|
|
|
+ rawDataObj.BudgetCalcType = [];
|
|
|
|
+ rawDataObj.BudgetCalcTypeDetail = [];
|
|
|
|
+ for (let doc of rst2) {
|
|
|
|
+ for (let calc of doc.calcPrograms) {
|
|
|
|
+ rawDataObj.BudgetCalcType.push({projectID: doc.projectID, name: calc.name, totalFee: calc.totalFee});
|
|
|
|
+ rawDataObj.BudgetCalcTypeDetail.push(calc.calcItems);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
@@ -348,8 +379,19 @@ async function getAllPagesCommon(construct_id, user_id, prj_id, prj_ids, rpt_id,
|
|
});
|
|
});
|
|
} else if (promiseArr[1] !== null) {
|
|
} else if (promiseArr[1] !== null) {
|
|
promiseArr[1].then(function (rst) {
|
|
promiseArr[1].then(function (rst) {
|
|
- rawDataObj.Segment = rst.parent;
|
|
|
|
- rawDataObj.SegmentDetail = rst.subList;
|
|
|
|
|
|
+ if (rst.hasOwnProperty('parent')) {
|
|
|
|
+ rawDataObj.Segment = rst.parent;
|
|
|
|
+ rawDataObj.SegmentDetail = rst.subList;
|
|
|
|
+ } else {
|
|
|
|
+ rawDataObj.BudgetCalcType = [];
|
|
|
|
+ rawDataObj.BudgetCalcTypeDetail = [];
|
|
|
|
+ for (let doc of rst) {
|
|
|
|
+ for (let calc of doc.calcPrograms) {
|
|
|
|
+ rawDataObj.BudgetCalcType.push({projectID: doc.projectID, name: calc.name, totalFee: calc.totalFee});
|
|
|
|
+ rawDataObj.BudgetCalcTypeDetail.push(calc.calcItems);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
buildPageData(rawDataObj, rptDataUtil, rptTpl);
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|