|
@@ -9,7 +9,7 @@
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
-const measureType = require('../const/tender').measureType;
|
|
|
|
|
|
|
+const DashboardStats = require('../lib/dashboard_stats');
|
|
|
|
|
|
|
|
module.exports = app => {
|
|
module.exports = app => {
|
|
|
class WeappSubpController extends app.BaseController {
|
|
class WeappSubpController extends app.BaseController {
|
|
@@ -41,7 +41,7 @@ module.exports = app => {
|
|
|
ctx.body = { code: -1, msg: '子项目不存在', data: null };
|
|
ctx.body = { code: -1, msg: '子项目不存在', data: null };
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- const pageShow = subProject.page_show ? JSON.parse(subProject.page_show) : {};
|
|
|
|
|
|
|
+ const pageShow = ctx.service.subProject.getPageShow(subProject.page_show);
|
|
|
const auditList = [];
|
|
const auditList = [];
|
|
|
// 获取待审批的计量期列表
|
|
// 获取待审批的计量期列表
|
|
|
const auditStages = await ctx.service.stageAudit.getAuditStageByWap(ctx.session.sessionUser.id, subProjectId);
|
|
const auditStages = await ctx.service.stageAudit.getAuditStageByWap(ctx.session.sessionUser.id, subProjectId);
|
|
@@ -87,12 +87,28 @@ module.exports = app => {
|
|
|
// const safeInspectionList = await ctx.service.safeInspectionAudit.getAuditInspectionByWap(ctx.session.sessionUser.id, subProjectId);
|
|
// const safeInspectionList = await ctx.service.safeInspectionAudit.getAuditInspectionByWap(ctx.session.sessionUser.id, subProjectId);
|
|
|
// auditList.push(...(safeInspectionList.map(item => ({ ...item, type: 'safeInspection', subType: 'safeInspection' }))));
|
|
// auditList.push(...(safeInspectionList.map(item => ({ ...item, type: 'safeInspection', subType: 'safeInspection' }))));
|
|
|
// }
|
|
// }
|
|
|
|
|
+ // 与主页复用审批计时和预警阈值,避免前后端分别计算产生差异。
|
|
|
|
|
+ const dashboardStatus = { dashboard: 0, worry: 0, early: 0, shenpi: {} };
|
|
|
|
|
+ const pendingAudits = [];
|
|
|
|
|
+ const auditGroups = ctx.helper._.groupBy(auditList, 'subType');
|
|
|
|
|
+ for (const subType of Object.keys(auditGroups)) {
|
|
|
|
|
+ dashboardStatus.shenpi[subType] = 0;
|
|
|
|
|
+ const audits = await DashboardStats.auditSet(
|
|
|
|
|
+ ctx,
|
|
|
|
|
+ auditGroups[subType],
|
|
|
|
|
+ [{ ...subProject, page_show: pageShow }],
|
|
|
|
|
+ dashboardStatus,
|
|
|
|
|
+ subType
|
|
|
|
|
+ );
|
|
|
|
|
+ pendingAudits.push(...audits);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 获取消息列表
|
|
// 获取消息列表
|
|
|
const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, subProjectId, 1);
|
|
const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, subProjectId, 1);
|
|
|
|
|
|
|
|
ctx.body = {
|
|
ctx.body = {
|
|
|
code: 0, msg: '', data: {
|
|
code: 0, msg: '', data: {
|
|
|
- auditList: ctx.helper._.orderBy(auditList, ['begin_time'], ['desc', 'asc']),
|
|
|
|
|
|
|
+ auditList: ctx.helper._.orderBy(pendingAudits, ['start_audit', 'shenpi_time'], ['desc', 'asc']),
|
|
|
msgList,
|
|
msgList,
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|