|
@@ -598,9 +598,20 @@ module.exports = app => {
|
|
|
}
|
|
|
const fptAudits = await ctx.service.financialPayTenderAudit.getAllDataByCondition({ where: { spid: ctx.subProject.id, uid: ctx.session.sessionUser.accountId } });
|
|
|
const fptAuditTids = ctx.helper._.map(fptAudits, 'tid');
|
|
|
- const tenders = await ctx.service.tender.getAllDataByCondition({ where: { spid: ctx.subProject.id, id: fptAuditTids }, columns: ['id', 'name'] });
|
|
|
- const filter = JSON.parse(JSON.stringify(auditConst.financial.filter));
|
|
|
const filterTids = tid === null ? (ctx.session.sessionUser.is_admin ? null : fptAuditTids) : [tid];
|
|
|
+ const tenderCondition = { spid: ctx.subProject.id };
|
|
|
+ let hadTender = false;
|
|
|
+ if (ctx.session.sessionUser.is_admin) {
|
|
|
+ hadTender = true;
|
|
|
+ } else if (fptAuditTids.length !== 0) {
|
|
|
+ hadTender = true;
|
|
|
+ tenderCondition.id = fptAuditTids;
|
|
|
+ } else {
|
|
|
+ hadTender = false;
|
|
|
+ tenderCondition.id = -1;
|
|
|
+ }
|
|
|
+ const tenders = hadTender ? await ctx.service.tender.getAllDataByCondition({ where: tenderCondition, columns: ['id', 'name'] }) : [];
|
|
|
+ const filter = JSON.parse(JSON.stringify(auditConst.financial.filter));
|
|
|
filter.count = [];
|
|
|
filter.count[filter.status.pending] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, filter.status.pending, filterTids, used);// await ctx.service.change.pendingDatas(tender.id, ctx.session.sessionUser.accountId);
|
|
|
filter.count[filter.status.uncheck] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, filter.status.uncheck, filterTids, used);// await ctx.service.change.checkingDatas(tender.id, ctx.session.sessionUser.accountId);
|