|
@@ -57,6 +57,19 @@ module.exports = app => {
|
|
|
dashboard: 0,
|
|
|
worry: 0,
|
|
|
early: 0,
|
|
|
+ shenpi: {
|
|
|
+ ledger: 0,
|
|
|
+ stage: 0,
|
|
|
+ change: 0,
|
|
|
+ revise: 0,
|
|
|
+ material: 0,
|
|
|
+ advance: 0,
|
|
|
+ changeProject: 0,
|
|
|
+ changeApply: 0,
|
|
|
+ changePlan: 0,
|
|
|
+ payment: 0,
|
|
|
+ financial: 0,
|
|
|
+ },
|
|
|
};
|
|
|
let noticeList = [];
|
|
|
// 还要考虑功能关闭不展示对应类型情况
|
|
@@ -92,19 +105,33 @@ module.exports = app => {
|
|
|
const noticeDay = moment(new Date(notice.shenpi_time)).format('YYYY-MM-DD');
|
|
|
if (noticeDayList.indexOf(noticeDay) === -1) noticeDayList.push(noticeDay);
|
|
|
}
|
|
|
+ const dashboardShenpis = [];
|
|
|
// 审批时间状态提示,0:无预警,1,预警(当前时间大于创建时间常高于stageAuditEarly天时,触发提示),2,紧急(当前时间大于审批发起时常高于stageAuditWorry天时,触发提示)
|
|
|
const auditTenders = await this.auditSet(ctx, allAuditTenders, subProjects, dashboardStatus, 'ledger');
|
|
|
+ dashboardShenpis.push(...auditTenders);
|
|
|
const auditStages = await this.auditSet(ctx, allAuditStages, subProjects, dashboardStatus, 'stage');
|
|
|
+ dashboardShenpis.push(...auditStages);
|
|
|
const auditChanges = await this.auditSet(ctx, allAuditChanges, subProjects, dashboardStatus, 'change');
|
|
|
+ dashboardShenpis.push(...auditChanges);
|
|
|
const auditRevise = await this.auditSet(ctx, allAuditRevise, subProjects, dashboardStatus, 'revise');
|
|
|
+ dashboardShenpis.push(...auditRevise);
|
|
|
const auditMaterial = await this.auditSet(ctx, allAuditMaterial, subProjects, dashboardStatus, 'material');
|
|
|
+ dashboardShenpis.push(...auditMaterial);
|
|
|
const auditAdvance = await this.auditSet(ctx, allAuditAdvance, subProjects, dashboardStatus, 'advance');
|
|
|
+ dashboardShenpis.push(...auditAdvance);
|
|
|
const auditChangeProject = await this.auditSet(ctx, allAuditChangeProject, subProjects, dashboardStatus, 'changeProject');
|
|
|
+ dashboardShenpis.push(...auditChangeProject);
|
|
|
const auditChangeApply = await this.auditSet(ctx, allAuditChangeApply, subProjects, dashboardStatus, 'changeApply');
|
|
|
+ dashboardShenpis.push(...auditChangeApply);
|
|
|
const auditChangePlan = await this.auditSet(ctx, allAuditChangePlan, subProjects, dashboardStatus, 'changePlan');
|
|
|
+ dashboardShenpis.push(...auditChangePlan);
|
|
|
const auditPayments = await this.auditSet(ctx, allAuditPayments, subProjects, dashboardStatus, 'payment');
|
|
|
+ dashboardShenpis.push(...auditPayments);
|
|
|
const auditStageAss = await this.auditSet(ctx, allAuditStageAss, subProjects, dashboardStatus, 'stageAss');
|
|
|
+ dashboardShenpis.push(...auditStageAss);
|
|
|
const auditFinancials = await this.auditSet(ctx, allAuditFinancials, subProjects, dashboardStatus, 'financial');
|
|
|
+ dashboardShenpis.push(...auditFinancials);
|
|
|
+ // console.log(ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']));
|
|
|
const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
|
|
|
// 获取销售人员数据
|
|
|
const salesmanData = await ctx.service.manager.getDataById(projectData.manager_id);
|
|
@@ -118,18 +145,7 @@ module.exports = app => {
|
|
|
// 获取系统维护信息
|
|
|
const maintainData = await ctx.service.maintain.getDataById(1);
|
|
|
const renderData = {
|
|
|
- auditTenders,
|
|
|
- auditStages,
|
|
|
- auditChanges,
|
|
|
- auditRevise,
|
|
|
- auditMaterial,
|
|
|
- auditAdvance,
|
|
|
- auditChangeProject,
|
|
|
- auditChangeApply,
|
|
|
- auditChangePlan,
|
|
|
- auditPayments,
|
|
|
- auditStageAss,
|
|
|
- auditFinancials,
|
|
|
+ dashboardShenpis: ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']),
|
|
|
dashboardStatus,
|
|
|
role: pa.role,
|
|
|
authMobile: pa.auth_mobile,
|
|
@@ -200,6 +216,7 @@ module.exports = app => {
|
|
|
t.sp_name = sp.name;
|
|
|
t.start_audit = 0;
|
|
|
let calcTime;
|
|
|
+ let closeType = false;
|
|
|
switch (type) {
|
|
|
case 'ledger':
|
|
|
calcTime = t.ledger_status === auditConst[type].status.checking ? t.begin_time : t.end_time;
|
|
@@ -214,38 +231,39 @@ module.exports = app => {
|
|
|
calcTime = t.begin_time;
|
|
|
break;
|
|
|
case 'change':
|
|
|
- calcTime = t.begin_time ? t.begin_time : t.cin_time ? ctx.moment.unix(t.cin_time).format('YYYY/MM/DD HH:mm') : '';
|
|
|
+ calcTime = t.begin_time ? t.begin_time : t.cin_time ? new Date(ctx.moment.unix(t.cin_time).format('YYYY-MM-DD HH:mm:ss')) : '';
|
|
|
break;
|
|
|
case 'changeProject':
|
|
|
- if (!sp.page_show.openChangeProject) return [];
|
|
|
+ if (!sp.page_show.openChangeProject) closeType = true;
|
|
|
calcTime = t.status !== auditConst[type].status.back ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'changeApply':
|
|
|
- if (!sp.page_show.openChangeApply) return [];
|
|
|
+ if (!sp.page_show.openChangeApply) closeType = true;
|
|
|
calcTime = t.mstatus !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'changePlan':
|
|
|
- if (!sp.page_show.openChangePlan) return [];
|
|
|
+ if (!sp.page_show.openChangePlan) closeType = true;
|
|
|
calcTime = t.mstatus !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'material':
|
|
|
- if (!sp.page_show.openMaterial) return [];
|
|
|
+ if (!sp.page_show.openMaterial) closeType = true;
|
|
|
calcTime = t.mstatus !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'advance':
|
|
|
calcTime = t.mstatus !== auditConst[type].status.checkNo ? t.create_time : t.end_time;
|
|
|
break;
|
|
|
case 'payment':
|
|
|
- if (!sp.page_show.openPayment) return [];
|
|
|
+ if (!sp.page_show.openPayment) closeType = true;
|
|
|
calcTime = t.sstatus !== auditConst.stage.status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
case 'financial':
|
|
|
- if (!sp.page_show.openFinancial) return [];
|
|
|
+ if (!sp.page_show.openFinancial) closeType = true;
|
|
|
calcTime = t.fpcstatus !== auditConst[type].status.checkNo ? t.begin_time : t.end_time;
|
|
|
break;
|
|
|
default:
|
|
|
- return [];
|
|
|
+ closeType = true;
|
|
|
}
|
|
|
+ if (closeType) continue;
|
|
|
if (sp.page_show.openStageAudit) {
|
|
|
const now = new Date();
|
|
|
const calcDay = ctx.helper.calculateDaysBetween(now, calcTime);
|
|
@@ -257,6 +275,10 @@ module.exports = app => {
|
|
|
dashboardStatus.early += 1;
|
|
|
}
|
|
|
}
|
|
|
+ const calcType = type === 'stageAss' ? 'stage' : type;
|
|
|
+ dashboardStatus.shenpi[calcType] += 1;
|
|
|
+ t.shenpi_time = calcTime;
|
|
|
+ t.shenpi_type = type;
|
|
|
dashboardStatus.dashboard += 1;
|
|
|
audits.push(t);
|
|
|
}
|