|
@@ -61,14 +61,22 @@ module.exports = app => {
|
|
|
const tp = await ctx.service.change.getTp(tender.id, status);
|
|
|
if (changes !== null) {
|
|
|
for (const c of changes) {
|
|
|
- c.curAuditors = await ctx.service.changeAudit.getAuditorsByStatus(c.cid, c.status, c.times);
|
|
|
- if (c.status === audit.change.status.checkNoPre) {
|
|
|
- c.curAuditors2 = await ctx.service.stageAudit.getAuditorsByStatus(c.cid, audit.change.status.checking, c.times);
|
|
|
- }
|
|
|
- if (c.status === audit.change.status.checkNo || c.status === audit.change.status.revise) {
|
|
|
- const changeUsedData = await ctx.service.stageChange.getAllFinalUsedData(ctx.tender.id, c.cid);
|
|
|
- c.stageChangeNum = this.ctx.helper.sum(changeUsedData.map(x => { return Math.abs(x.qty); }));
|
|
|
- c.isSettle = await ctx.service.changeSettleList.isSettle(c.cid);
|
|
|
+ if (c.status !== audit.change.status.checked || !c.final_auditor_str) {
|
|
|
+ c.curAuditors = await ctx.service.changeAudit.getAuditorsByStatus(c.cid, c.status, c.times);
|
|
|
+ if (c.status === audit.change.status.checkNoPre) {
|
|
|
+ c.curAuditors2 = await ctx.service.stageAudit.getAuditorsByStatus(c.cid, audit.change.status.checking, c.times);
|
|
|
+ }
|
|
|
+ if (c.status === audit.change.status.checkNo || c.status === audit.change.status.revise) {
|
|
|
+ const changeUsedData = await ctx.service.stageChange.getAllFinalUsedData(ctx.tender.id, c.cid);
|
|
|
+ c.stageChangeNum = this.ctx.helper.sum(changeUsedData.map(x => { return Math.abs(x.qty); }));
|
|
|
+ c.isSettle = await ctx.service.changeSettleList.isSettle(c.cid);
|
|
|
+ }
|
|
|
+ if (c.status === audit.change.status.checked && c.curAuditors.length > 0) {
|
|
|
+ const final_auditor_str = c.curAuditors[0].audit_type === auditType.key.common
|
|
|
+ ? c.curAuditors[0].name + (c.curAuditors[0].role ? '-' + c.curAuditors[0].role : '')
|
|
|
+ : ctx.helper.transFormToChinese(c.curAuditors[0].audit_order) + '审';
|
|
|
+ await ctx.service.change.defaultUpdate({ final_auditor_str }, { where: { cid: c.cid } });
|
|
|
+ }
|
|
|
}
|
|
|
page_total = ctx.helper.add(page_total, c.total_price);
|
|
|
}
|