|
@@ -226,29 +226,31 @@ module.exports = app => {
|
|
|
|
|
|
const dealPay = await this.ctx.service.stagePay.getStagePays(stage);
|
|
|
await this._checkStagePayCalc(tender, stage, dealPay);
|
|
|
- this.ctx.helper.assignRelaData(billsData, [
|
|
|
- {data: dealPay, fields: ['tp'], prefix: 's_' + stage.order + '_', relaId: 'pid'}
|
|
|
+ this.ctx.helper.assignRelaData(payData, [
|
|
|
+ {data: dealPay, fields: ['tp'], prefix: 's_' + stage.order + '_', relaId: 'pid'},
|
|
|
+ {data: dealPay, fields: ['name'], prefix:'', relaId: 'pid'},
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async getStageSumPay(tid, memFieldKeys, gsDefine, gsCustom) {
|
|
|
if (!gsDefine || !gsDefine.enable) return [];
|
|
|
- if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
|
|
|
+ if (!gsCustom || !gsCustom.stages || gsCustom.stages.length === 0) return [];
|
|
|
|
|
|
await this.ctx.service.tender.checkTender(tid);
|
|
|
const payData = await this.ctx.service.pay.getAllDataByCondition({
|
|
|
- where: {tid: tid},
|
|
|
+ where: {tid: tid, valid: true},
|
|
|
order: [['order', 'ASC']],
|
|
|
});
|
|
|
|
|
|
const gsSetting = JSON.parse(gsDefine.setting);
|
|
|
for (const s of gsCustom.stages) {
|
|
|
- const stage = this.getSelectStage(gsSetting, s);
|
|
|
+ const stage = await this.db.get(this.ctx.service.stage.tableName, { tid: this.ctx.tender.id, order: s });
|
|
|
+ if (!stage) continue;
|
|
|
await this.ctx.service.stage.doCheckStage(stage);
|
|
|
await this._gatherStagePay(this.ctx.tender, stage, payData);
|
|
|
-
|
|
|
}
|
|
|
+ return payData;
|
|
|
}
|
|
|
}
|
|
|
|