|
@@ -102,30 +102,36 @@ module.exports = app => {
|
|
|
const dcTenders = await ctx.service.datacollectTender.getList(ctx.session.sessionProject.id);
|
|
|
const noTids = ctx.app._.map(dcTenders, 'tid');
|
|
|
let tenderList = await ctx.service.tender.getList('', null, 1);
|
|
|
+ // let tenderList = await this.ctx.service.tender.getBuildList('', null, 1);
|
|
|
tenderList = ctx.app._.filter(tenderList, function(item) {
|
|
|
return ctx.app._.indexOf(noTids, item.id) === -1;
|
|
|
});
|
|
|
const thisMonth = new Date();
|
|
|
const [startMonth, endMonth] = ctx.helper.getStartEndMonth(thisMonth);
|
|
|
+ // 统计方法总时长
|
|
|
+ // let sumStageByDataCollectTime = 0;
|
|
|
for (const t of tenderList) {
|
|
|
- const tenderInfo = await ctx.service.tenderInfo.getTenderInfo(t.id);
|
|
|
- t.contract_price = tenderInfo.deal_param.contractPrice;
|
|
|
- let bCalcTp = t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck;
|
|
|
- t.advance_tp = await ctx.service.advance.getSumAdvance(t.id);
|
|
|
-
|
|
|
- if (t.ledger_status === auditConst.ledger.status.checked) {
|
|
|
- t.lastStage = await ctx.service.stage.getLastestStage(t.id);
|
|
|
- if (t.lastStage) await ctx.service.stage.checkStageGatherDataByDataCollect(t.lastStage, true);
|
|
|
- t.completeStage = await ctx.service.stage.getLastestCompleteStage(t.id);
|
|
|
- if ((!bCalcTp) && t.measure_type === measureType.gcl.value) {
|
|
|
- bCalcTp = t.lastStage && t.lastStage.status !== auditConst.stage.status.checked && !t.lastStage.readOnly;
|
|
|
- }
|
|
|
- }
|
|
|
- if (bCalcTp) {
|
|
|
- const sum = await this.ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
|
|
|
- t.total_price = sum.total_price;
|
|
|
- t.deal_tp = sum.deal_tp;
|
|
|
- }
|
|
|
+ // const tenderInfo = await ctx.service.tenderInfo.getTenderInfo(t.id);
|
|
|
+ // t.contract_price = tenderInfo.deal_param.contractPrice;
|
|
|
+ // let bCalcTp = t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck;
|
|
|
+ // t.advance_tp = await ctx.service.advance.getSumAdvance(t.id);
|
|
|
+ //
|
|
|
+ // if (t.ledger_status === auditConst.ledger.status.checked) {
|
|
|
+ // t.lastStage = await ctx.service.stage.getLastestStage(t.id);
|
|
|
+ // if (t.lastStage) await ctx.service.stage.checkStageGatherDataByDataCollect(t.lastStage, true);
|
|
|
+ // t.completeStage = await ctx.service.stage.getLastestCompleteStage(t.id);
|
|
|
+ // if ((!bCalcTp) && t.measure_type === measureType.gcl.value) {
|
|
|
+ // bCalcTp = t.lastStage && t.lastStage.status !== auditConst.stage.status.checked && !t.lastStage.readOnly;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (bCalcTp) {
|
|
|
+ // const sum = await this.ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
|
|
|
+ // t.total_price = sum.total_price;
|
|
|
+ // t.deal_tp = sum.deal_tp;
|
|
|
+ // }
|
|
|
+ // 用标段管理的方法获取t数据
|
|
|
+ await this.ctx.service.tenderCache.loadTenderCache(t, '');
|
|
|
+ t.total_price = t.ledger_tp && t.ledger_tp.total_price ? t.ledger_tp.total_price : 0;
|
|
|
[t.change_tp, t.change_p_tp, t.change_n_tp] = await ctx.service.change.getChangeTp(t.id);
|
|
|
// t.material_tp = await ctx.service.material.getSumMaterial(t.id);
|
|
|
// 获取本标段 本月计量期审批通过数目,变更令审批通过数目,台账修订通过数目,材料调差通过数目
|
|
@@ -134,7 +140,9 @@ module.exports = app => {
|
|
|
t.month_revise_num = await ctx.service.reviseAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
t.month_material_num = await ctx.service.materialAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
// 获取标段计量月统计及截止月累计计量
|
|
|
- const stageList = await ctx.service.stage.getStageByDataCollect(t.id);
|
|
|
+ // 这个慢,统计下面这个方法时长
|
|
|
+ const stageList = await ctx.service.stage.getStageByDataCollect(t.id, t.stage_tp);
|
|
|
+ // const stageList = [];
|
|
|
const month_stage = [];
|
|
|
for (const s of stageList) {
|
|
|
const monthOneStage = ctx.app._.find(month_stage, { yearmonth: s.s_time });
|