|
|
@@ -43,6 +43,7 @@ module.exports = app => {
|
|
|
const allAuditInspections = await ctx.service.qualityInspectionAudit.getAuditInspection(ctx.session.sessionUser.accountId);
|
|
|
const allAuditSafeInspections = await ctx.service.safeInspectionAudit.getAuditInspection(ctx.session.sessionUser.accountId);
|
|
|
const allAuditSafeStage = await ctx.service.safeStageAudit.getAuditStage(ctx.session.sessionUser.accountId);
|
|
|
+ const allAuditPhasePay = await ctx.service.phasePayAudit.getAuditStage(ctx.session.sessionUser.accountId);
|
|
|
const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
|
|
|
const auditShenpiTenders = await ctx.service.ledgerAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
const auditShenpiStages = await ctx.service.stageAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
@@ -58,6 +59,7 @@ module.exports = app => {
|
|
|
const auditShenpiInspection = await ctx.service.qualityInspectionAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
const auditShenpiSafeInspection = await ctx.service.safeInspectionAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
const auditShenpiSafeStage = await ctx.service.safeStageAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
+ const auditShenpiPhasePay = await ctx.service.phasePayAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
const dashboardStatus = {
|
|
|
all: 0,
|
|
|
dashboard: 0,
|
|
|
@@ -78,6 +80,7 @@ module.exports = app => {
|
|
|
inspection: 0,
|
|
|
safeInspection: 0,
|
|
|
safeStage: 0,
|
|
|
+ phasePay: 0,
|
|
|
},
|
|
|
};
|
|
|
let noticeList = [];
|
|
|
@@ -113,6 +116,8 @@ module.exports = app => {
|
|
|
noticeList.push(...ctx.helper.addKeyValue4ObjArray(spSafeInspection, 'shenpi_type', 'safeInspection'));
|
|
|
const spSafeStage = subProject.page_show.safeInspection ? ctx.helper._.filter(auditShenpiSafeStage, { spid: subProject.id }) : [];
|
|
|
noticeList.push(...ctx.helper.addKeyValue4ObjArray(spSafeStage, 'shenpi_type', 'safeStage'));
|
|
|
+ const spPhasePay = subProject.page_show.phasePay ? ctx.helper._.filter(auditShenpiPhasePay, { spid: subProject.id }) : [];
|
|
|
+ noticeList.push(...ctx.helper.addKeyValue4ObjArray(spPhasePay, 'shenpi_type', 'phasePay'));
|
|
|
}
|
|
|
const noticeDayList = [];
|
|
|
noticeList = ctx.helper._.orderBy(noticeList, ['shenpi_time'], ['desc']);
|
|
|
@@ -152,6 +157,8 @@ module.exports = app => {
|
|
|
dashboardShenpis.push(...auditSafeInspections);
|
|
|
const auditSafeStage = await this.auditSet(ctx, allAuditSafeStage, subProjects, dashboardStatus, 'safeStage');
|
|
|
dashboardShenpis.push(...auditSafeStage);
|
|
|
+ const auditPhasePay = await this.auditSet(ctx, allAuditPhasePay, subProjects, dashboardStatus, 'phasePay');
|
|
|
+ dashboardShenpis.push(...auditPhasePay);
|
|
|
// console.log(ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']));
|
|
|
const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
|
|
|
// 获取销售人员数据
|
|
|
@@ -184,6 +191,7 @@ module.exports = app => {
|
|
|
acFinancial: auditConst.financial,
|
|
|
acInspection: auditConst.inspection,
|
|
|
acSafeStage: auditConst.safeStage,
|
|
|
+ acPhasePay: auditConst.phasePay,
|
|
|
noticeList,
|
|
|
noticeDayList,
|
|
|
pushType: auditConst.pushType,
|
|
|
@@ -298,6 +306,10 @@ module.exports = app => {
|
|
|
if (!sp.page_show.safePayment) closeType = true;
|
|
|
calcTime = t.create_time;
|
|
|
break;
|
|
|
+ case 'safeStage':
|
|
|
+ if (!sp.page_show.phasePay) closeType = true;
|
|
|
+ calcTime = t.create_time;
|
|
|
+ break;
|
|
|
default:
|
|
|
closeType = true;
|
|
|
}
|
|
|
@@ -346,6 +358,7 @@ module.exports = app => {
|
|
|
const auditInspections = ctx.subProject.page_show.qualityInspection ? await ctx.service.qualityInspectionAudit.getAuditInspection(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
const auditSafeInspections = ctx.subProject.page_show.safeInspection ? await ctx.service.safeInspectionAudit.getAuditInspection(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
const auditSafeStage = ctx.subProject.page_show.safePayment ? await ctx.service.safeStageAudit.getAuditStage(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
+ const auditPhasePay = ctx.subProject.page_show.phasePay ? await ctx.service.phasePayAudit.getAuditStage(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
|
|
|
const noticeList = await ctx.service.noticePush.getNotice(ctx.session.sessionProject.id, pa.id, ctx.subProject.id);
|
|
|
const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
|
|
|
@@ -378,6 +391,7 @@ module.exports = app => {
|
|
|
if (ctx.subProject.page_show.qualityInspection) shenpi_count.push({ count: await ctx.service.qualityInspectionAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '质量巡检' });
|
|
|
if (ctx.subProject.page_show.safeInspection) shenpi_count.push({ count: await ctx.service.safeInspectionAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '安全巡检' });
|
|
|
if (ctx.subProject.page_show.safePayment) shenpi_count.push({ count: await ctx.service.safeStageAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '安全计量' });
|
|
|
+ if (ctx.subProject.page_show.phasePay) shenpi_count.push({ count: await ctx.service.phasePayAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '合同支付' });
|
|
|
// shenpi_count.push({ count: await ctx.service.advanceAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '预付款' });
|
|
|
const total_count = ctx.app._.sumBy(shenpi_count, 'count');
|
|
|
const shenpi_lastime = [
|
|
|
@@ -394,6 +408,7 @@ module.exports = app => {
|
|
|
ctx.subProject.page_show.qualityInspection ? await ctx.service.qualityInspectionAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
ctx.subProject.page_show.safeInspection ? await ctx.service.safeInspectionAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
ctx.subProject.page_show.safeInspection ? await ctx.service.safeStageAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
+ ctx.subProject.page_show.phasePay ? await ctx.service.phasePayAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
];
|
|
|
const last_time = ctx.app._.max(shenpi_lastime);
|
|
|
// console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
|
|
|
@@ -413,6 +428,7 @@ module.exports = app => {
|
|
|
auditInspections,
|
|
|
auditSafeInspections,
|
|
|
auditSafeStage,
|
|
|
+ auditPhasePay,
|
|
|
shenpi_count,
|
|
|
total_count,
|
|
|
last_day: ctx.helper.calcDayNum(last_time),
|
|
|
@@ -430,6 +446,7 @@ module.exports = app => {
|
|
|
acFinancial: auditConst.financial,
|
|
|
acInspection: auditConst.inspection,
|
|
|
acSafeStage: auditConst.safeStage,
|
|
|
+ acPhasePay: auditConst.phasePay,
|
|
|
noticeList,
|
|
|
pushType: auditConst.pushType,
|
|
|
projectData,
|