|
|
@@ -41,6 +41,7 @@ module.exports = app => {
|
|
|
const allAuditStageAss = await ctx.service.stageAuditAss.getAuditStageAss(ctx.session.sessionUser.accountId);
|
|
|
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 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);
|
|
|
@@ -54,6 +55,7 @@ module.exports = app => {
|
|
|
const auditShenpiPayment = await ctx.service.paymentDetailAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
|
|
|
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 dashboardStatus = {
|
|
|
all: 0,
|
|
|
dashboard: 0,
|
|
|
@@ -72,6 +74,7 @@ module.exports = app => {
|
|
|
payment: 0,
|
|
|
financial: 0,
|
|
|
inspection: 0,
|
|
|
+ safeInspection: 0,
|
|
|
},
|
|
|
};
|
|
|
let noticeList = [];
|
|
|
@@ -101,8 +104,10 @@ module.exports = app => {
|
|
|
noticeList.push(...ctx.helper.addKeyValue4ObjArray(spPayment, 'shenpi_type', 'payment'));
|
|
|
const spFinancial = subProject.page_show.openFinancial ? ctx.helper._.filter(auditShenpiFinancial, { spid: subProject.id }) : [];
|
|
|
noticeList.push(...ctx.helper.addKeyValue4ObjArray(spFinancial, 'shenpi_type', 'financial'));
|
|
|
- const spInspection = subProject.page_show.quality ? ctx.helper._.filter(auditShenpiInspection, { spid: subProject.id }) : [];
|
|
|
+ const spInspection = subProject.page_show.qualityInspection ? ctx.helper._.filter(auditShenpiInspection, { spid: subProject.id }) : [];
|
|
|
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(spInspection, 'shenpi_type', 'safe_inspection'));
|
|
|
}
|
|
|
const noticeDayList = [];
|
|
|
noticeList = ctx.helper._.orderBy(noticeList, ['shenpi_time'], ['desc']);
|
|
|
@@ -138,6 +143,8 @@ module.exports = app => {
|
|
|
dashboardShenpis.push(...auditFinancials);
|
|
|
const auditInspections = await this.auditSet(ctx, allAuditInspections, subProjects, dashboardStatus, 'inspection');
|
|
|
dashboardShenpis.push(...auditInspections);
|
|
|
+ const auditSafeInspections = await this.auditSet(ctx, allAuditSafeInspections, subProjects, dashboardStatus, 'safeInspection');
|
|
|
+ dashboardShenpis.push(...auditSafeInspections);
|
|
|
// console.log(ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']));
|
|
|
const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
|
|
|
// 获取销售人员数据
|
|
|
@@ -272,9 +279,13 @@ module.exports = app => {
|
|
|
calcTime = t.fpcstatus !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'inspection':
|
|
|
- if (!sp.page_show.quality) closeType = true;
|
|
|
+ if (!sp.page_show.qualityInspection) closeType = true;
|
|
|
calcTime = t.status !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
+ case 'safeInspection':
|
|
|
+ if (!sp.page_show.safeInspection) closeType = true;
|
|
|
+ calcTime = t.status !== auditConst.inspection.status.checkNo ? t.begin_time : t.end_time;
|
|
|
+ break;
|
|
|
default:
|
|
|
closeType = true;
|
|
|
}
|
|
|
@@ -320,7 +331,8 @@ module.exports = app => {
|
|
|
const auditPayments = ctx.subProject.page_show.openPayment ? await ctx.service.paymentDetailAudit.getAuditPayment(ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
|
|
|
const auditStageAss = await ctx.service.stageAuditAss.getAuditStageAss(ctx.session.sessionUser.accountId, ctx.subProject.id);
|
|
|
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.quality ? await ctx.service.qualityInspectionAudit.getAuditInspection(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 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);
|
|
|
@@ -350,7 +362,8 @@ module.exports = app => {
|
|
|
if (ctx.subProject.page_show.openChangePlan) shenpi_count.push({ count: await ctx.service.changePlanAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '变更方案' });
|
|
|
if (ctx.subProject.page_show.openMaterial) shenpi_count.push({ count: await ctx.service.materialAudit.getCountByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id), name: '材料调差' });
|
|
|
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.quality) shenpi_count.push({ count: await ctx.service.qualityInspectionAudit.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: '安全巡检' });
|
|
|
// 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 = [
|
|
|
@@ -364,7 +377,8 @@ module.exports = app => {
|
|
|
ctx.subProject.page_show.openChangePlan ? await ctx.service.changePlanAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
ctx.subProject.page_show.openMaterial ? await ctx.service.materialAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
ctx.subProject.page_show.openFinancial ? await ctx.service.financialPayAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
|
|
|
- ctx.subProject.page_show.quality ? await ctx.service.qualityInspectionAudit.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,
|
|
|
];
|
|
|
const last_time = ctx.app._.max(shenpi_lastime);
|
|
|
// console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
|
|
|
@@ -382,6 +396,7 @@ module.exports = app => {
|
|
|
auditStageAss,
|
|
|
auditFinancials,
|
|
|
auditInspections,
|
|
|
+ auditSafeInspections,
|
|
|
shenpi_count,
|
|
|
total_count,
|
|
|
last_day: ctx.helper.calcDayNum(last_time),
|