|
|
@@ -42,6 +42,7 @@ module.exports = app => {
|
|
|
const allAuditFinancials = await ctx.service.financialPayAudit.getAuditFinancial(ctx.session.sessionUser.accountId);
|
|
|
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 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);
|
|
|
@@ -56,6 +57,7 @@ module.exports = app => {
|
|
|
const auditShenpiFinancial = await ctx.service.financialPayAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
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 dashboardStatus = {
|
|
|
all: 0,
|
|
|
dashboard: 0,
|
|
|
@@ -75,6 +77,7 @@ module.exports = app => {
|
|
|
financial: 0,
|
|
|
inspection: 0,
|
|
|
safeInspection: 0,
|
|
|
+ safeStage: 0,
|
|
|
},
|
|
|
};
|
|
|
let noticeList = [];
|
|
|
@@ -108,6 +111,8 @@ module.exports = app => {
|
|
|
noticeList.push(...ctx.helper.addKeyValue4ObjArray(spInspection, 'shenpi_type', 'inspection'));
|
|
|
const spSafeInspection = subProject.page_show.safeInspection ? ctx.helper._.filter(auditShenpiSafeInspection, { spid: subProject.id }) : [];
|
|
|
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 noticeDayList = [];
|
|
|
noticeList = ctx.helper._.orderBy(noticeList, ['shenpi_time'], ['desc']);
|
|
|
@@ -145,6 +150,8 @@ module.exports = app => {
|
|
|
dashboardShenpis.push(...auditInspections);
|
|
|
const auditSafeInspections = await this.auditSet(ctx, allAuditSafeInspections, subProjects, dashboardStatus, 'safeInspection');
|
|
|
dashboardShenpis.push(...auditSafeInspections);
|
|
|
+ const auditSafeStage = await this.auditSet(ctx, allAuditSafeStage, subProjects, dashboardStatus, 'safeStage');
|
|
|
+ dashboardShenpis.push(...auditSafeStage);
|
|
|
// console.log(ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']));
|
|
|
const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
|
|
|
// 获取销售人员数据
|
|
|
@@ -176,6 +183,7 @@ module.exports = app => {
|
|
|
acChangePlan: auditConst.changeApply,
|
|
|
acFinancial: auditConst.financial,
|
|
|
acInspection: auditConst.inspection,
|
|
|
+ acSafeStage: auditConst.safeStage,
|
|
|
noticeList,
|
|
|
noticeDayList,
|
|
|
pushType: auditConst.pushType,
|
|
|
@@ -286,6 +294,10 @@ module.exports = app => {
|
|
|
if (!sp.page_show.safeInspection) closeType = true;
|
|
|
calcTime = t.status !== auditConst.inspection.status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
+ case 'safeStage':
|
|
|
+ if (!sp.page_show.safePayment) closeType = true;
|
|
|
+ calcTime = t.create_time;
|
|
|
+ break;
|
|
|
default:
|
|
|
closeType = true;
|
|
|
}
|
|
|
@@ -333,6 +345,7 @@ module.exports = app => {
|
|
|
const auditFinancials = ctx.subProject.page_show.openFinancial ? await ctx.service.financialPayAudit.getAuditFinancial(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
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 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);
|
|
|
@@ -364,6 +377,7 @@ module.exports = app => {
|
|
|
if (ctx.subProject.page_show.openFinancial) shenpi_count.push({ count: await ctx.service.financialPayAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '资金支付' });
|
|
|
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: '安全计量' });
|
|
|
// 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 = [
|
|
|
@@ -379,6 +393,7 @@ module.exports = app => {
|
|
|
ctx.subProject.page_show.openFinancial ? await ctx.service.financialPayAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
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,
|
|
|
];
|
|
|
const last_time = ctx.app._.max(shenpi_lastime);
|
|
|
// console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
|
|
|
@@ -397,6 +412,7 @@ module.exports = app => {
|
|
|
auditFinancials,
|
|
|
auditInspections,
|
|
|
auditSafeInspections,
|
|
|
+ auditSafeStage,
|
|
|
shenpi_count,
|
|
|
total_count,
|
|
|
last_day: ctx.helper.calcDayNum(last_time),
|
|
|
@@ -413,6 +429,7 @@ module.exports = app => {
|
|
|
acChangePlan: auditConst.changeApply,
|
|
|
acFinancial: auditConst.financial,
|
|
|
acInspection: auditConst.inspection,
|
|
|
+ acSafeStage: auditConst.safeStage,
|
|
|
noticeList,
|
|
|
pushType: auditConst.pushType,
|
|
|
projectData,
|