|
@@ -11,6 +11,7 @@
|
|
|
const auditConst = require('../const/audit');
|
|
|
const officeList = require('../const/cld_office').list;
|
|
|
const maintainConst = require('../const/maintain');
|
|
|
+const typeColMap = require('../const/advance').typeColMap;
|
|
|
|
|
|
module.exports = app => {
|
|
|
|
|
@@ -45,9 +46,35 @@ module.exports = app => {
|
|
|
const userPermission = pa !== undefined && pa.permission !== '' ? JSON.parse(pa.permission) : null;
|
|
|
const userMsgPermission = userPermission !== null && userPermission.project_msg !== undefined && parseInt(userPermission.project_msg) === 1;
|
|
|
// 获取系统通知
|
|
|
- const sysMsgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, 2, 0, 2);
|
|
|
+ const sysMsgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, 1, 0, 2);
|
|
|
// 获取系统维护信息
|
|
|
const maintainData = await ctx.service.maintain.getDataById(1);
|
|
|
+ // 获取各个审批的次数及最后的审批时间
|
|
|
+ const shenpi_count = [
|
|
|
+ { count: await ctx.service.ledgerAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '台账审批' },
|
|
|
+ { count: await ctx.service.reviseAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '台账修订' },
|
|
|
+ { count: await ctx.service.stageAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '计量审批' },
|
|
|
+ { count: await ctx.service.changeAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更审批' },
|
|
|
+ ];
|
|
|
+ if (ctx.session.sessionProject.page_show.openChangeProject) shenpi_count.push({ count: await ctx.service.changeProjectAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更立项' });
|
|
|
+ if (ctx.session.sessionProject.page_show.openChangeApply) shenpi_count.push({ count: await ctx.service.changeApplyAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更申请' });
|
|
|
+ if (ctx.session.sessionProject.page_show.openChangePlan) shenpi_count.push({ count: await ctx.service.changePlanAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更方案' });
|
|
|
+ shenpi_count.push({ count: await ctx.service.materialAudit.getCountByChecked(ctx.session.sessionUser.accountId), 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 = [
|
|
|
+ await ctx.service.ledgerAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ await ctx.service.reviseAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ await ctx.service.stageAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ await ctx.service.changeAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ ctx.session.sessionProject.page_show.openChangeProject ? await ctx.service.changeProjectAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
|
|
|
+ ctx.session.sessionProject.page_show.openChangeApply ? await ctx.service.changeApplyAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
|
|
|
+ ctx.session.sessionProject.page_show.openChangePlan ? await ctx.service.changePlanAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
|
|
|
+ await ctx.service.materialAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ await ctx.service.advanceAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
|
|
|
+ ];
|
|
|
+ const last_time = ctx.app._.max(shenpi_lastime);
|
|
|
+ console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
|
|
|
const renderData = {
|
|
|
auditTenders,
|
|
|
auditStages,
|
|
@@ -58,6 +85,9 @@ module.exports = app => {
|
|
|
auditChangeProject,
|
|
|
auditChangeApply,
|
|
|
auditChangePlan,
|
|
|
+ shenpi_count,
|
|
|
+ total_count,
|
|
|
+ last_day: ctx.helper.calcDayNum(last_time),
|
|
|
role: pa.role,
|
|
|
authMobile: pa.auth_mobile,
|
|
|
acLedger: auditConst.ledger,
|
|
@@ -81,6 +111,7 @@ module.exports = app => {
|
|
|
uid: ctx.session.sessionUser.accountId,
|
|
|
maintainData,
|
|
|
maintainConst,
|
|
|
+ typeColMap,
|
|
|
};
|
|
|
await this.layout('dashboard/index.ejs', renderData, 'dashboard/modal.ejs');
|
|
|
await ctx.service.projectAccount.defaultUpdate({
|