|
@@ -110,22 +110,21 @@ module.exports = app => {
|
|
|
for (const t of tenderList) {
|
|
|
const tenderInfo = await ctx.service.tenderInfo.getTenderInfo(t.id);
|
|
|
t.contract_price = tenderInfo.deal_param.contractPrice;
|
|
|
-
|
|
|
- if (t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck) {
|
|
|
- const sum = await ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
|
|
|
- t.total_price = sum.total_price;
|
|
|
- t.deal_tp = sum.deal_tp;
|
|
|
- }
|
|
|
+ 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, true);
|
|
|
- if (t.lastStage && t.lastStage.status === auditConst.stage.status.uncheck &&
|
|
|
- t.lastStage.user_id !== ctx.session.sessionUser.accountId) {
|
|
|
- t.lastStage = await ctx.service.stage.getLastestStage(t.id);
|
|
|
- }
|
|
|
- if (t.lastStage) await ctx.service.stage.checkStageGatherData(t.lastStage);
|
|
|
+ t.lastStage = await ctx.service.stage.getLastestStage(t.id);
|
|
|
+ if (t.lastStage) await ctx.service.stage.checkStageGatherData(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.material_tp = await ctx.service.material.getSumMaterial(t.id);
|
|
|
// 获取本标段 本月计量期审批通过数目,变更令审批通过数目,台账修订通过数目,材料调差通过数目
|