|
@@ -656,18 +656,22 @@ module.exports = app => {
|
|
|
// 获取所有项目参与者
|
|
|
const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'account', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile']);
|
|
|
const payTenders = await ctx.service.financialPayTender.getAllDataByCondition({ where: { spid: ctx.subProject.id } });
|
|
|
- for (const t of tenders) {
|
|
|
- const info = await ctx.service.tenderInfo.getDataByCondition({ tid: t.id });
|
|
|
- t.pay_account = info && info.pay_account ? JSON.parse(info.pay_account).project : '';
|
|
|
- const pt = ctx.helper._.find(payTenders, { tid: t.id });
|
|
|
- t.pt = pt ? pt : { id: 0, tid: t.id, name: '', bank: '', bank_account: '', contact: '', phone: '' };
|
|
|
- if (ctx.session.sessionUser.is_admin || ctx.helper._.includes(fptReportTids, t.id)) {
|
|
|
- t.dealCode = info && info.deal_info ? JSON.parse(info.deal_info).dealCode : '';
|
|
|
- const lastPay = await ctx.service.financialPay.getAllDataByCondition({ where: { spid: ctx.subProject.id, tid: t.id }, columns: ['code'], orders: [['id', 'desc']], limit: 1 });
|
|
|
- t.startNum = 1;
|
|
|
- if (lastPay.length > 0) {
|
|
|
- const startArray = lastPay[0].code.split('-');
|
|
|
- t.startNum = parseInt(startArray[startArray.length - 1]) + 1;
|
|
|
+ if (tenders.length > 0) {
|
|
|
+ const allLastPay = await ctx.service.financialPay.getAllDataByCondition({ where: { spid: ctx.subProject.id, tid: ctx.helper._.map(tenders, 'id') }, columns: ['id', 'code'], orders: [['id', 'desc']] });
|
|
|
+ const tenderInfos = await ctx.service.tenderInfo.getAllDataByCondition({ where: { tid: ctx.helper._.map(tenders, 'id') }, columns: ['tid', 'pay_account', 'deal_info'] });
|
|
|
+ for (const t of tenders) {
|
|
|
+ const info = ctx.helper._.find(tenderInfos, { tid: t.id });
|
|
|
+ t.pay_account = info && info.pay_account ? JSON.parse(info.pay_account).project : '';
|
|
|
+ const pt = ctx.helper._.find(payTenders, { tid: t.id });
|
|
|
+ t.pt = pt ? pt : { id: 0, tid: t.id, name: '', bank: '', bank_account: '', contact: '', phone: '' };
|
|
|
+ if (ctx.session.sessionUser.is_admin || ctx.helper._.includes(fptReportTids, t.id)) {
|
|
|
+ t.dealCode = info && info.deal_info ? JSON.parse(info.deal_info).dealCode : '';
|
|
|
+ const lastPay = ctx.helper._.filter(allLastPay, { tid: t.id });
|
|
|
+ t.startNum = 1;
|
|
|
+ if (lastPay.length > 0) {
|
|
|
+ const startArray = lastPay[0].code.split('-');
|
|
|
+ t.startNum = parseInt(startArray[startArray.length - 1]) + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -689,10 +693,13 @@ module.exports = app => {
|
|
|
pay.entities = await ctx.service.financialPayContract.getEntities(pay.id);
|
|
|
}
|
|
|
}
|
|
|
- if (ctx.session.sessionUser.is_admin) {
|
|
|
+ if (ctx.session.sessionUser.is_admin && tenders.length > 0) {
|
|
|
+ const allPermissionList = await ctx.service.financialPayTenderAudit.getAllList(ctx.subProject.id, ctx.helper._.map(tenders, 'id'), accountList);
|
|
|
+ const allAuditGroupList = await ctx.service.shenpiAudit.getAllAuditGroupList(ctx.helper._.map(tenders, 'id'), shenpiConst.sp_other_type.financial, shenpiConst.sp_status.gdspl);
|
|
|
for (const t of tenders) {
|
|
|
- t.permissionList = await ctx.service.financialPayTenderAudit.getList(ctx.subProject.id, t.id, accountList);
|
|
|
- t.auditGroupList = await ctx.service.shenpiAudit.getAuditGroupList(t.id, shenpiConst.sp_other_type.financial, shenpiConst.sp_status.gdspl);
|
|
|
+ t.permissionList = ctx.helper._.filter(allPermissionList, { tid: t.id }) || [];
|
|
|
+ // t.auditGroupList = await ctx.service.shenpiAudit.getAuditGroupList(t.id, shenpiConst.sp_other_type.financial, shenpiConst.sp_status.gdspl);
|
|
|
+ t.auditGroupList = ctx.helper._.find(allAuditGroupList, { tid: t.id }) ? ctx.helper._.find(allAuditGroupList, { tid: t.id }).audits : [];
|
|
|
}
|
|
|
}
|
|
|
const renderData = {
|