|
@@ -152,19 +152,70 @@ module.exports = app => {
|
|
|
// 获取待审批的变更期
|
|
|
const auditChanges = await ctx.service.changeAudit.getAuditChangeByWap(ctx.session.sessionUser.accountId);
|
|
|
// 获取待审批的变更立项
|
|
|
- let auditChangeProjects = [];
|
|
|
- if (ctx.subProject.page_show.openChangeProject) {
|
|
|
- auditChangeProjects = await ctx.service.changeProjectAudit.getAuditChangeProjectByWap(ctx.session.sessionUser.accountId);
|
|
|
+ const auditChangeProjects = [];
|
|
|
+ const changeProjects = await ctx.service.changeProjectAudit.getAuditChangeProjectByWap(ctx.session.sessionUser.accountId);
|
|
|
+ for (const cp of changeProjects) {
|
|
|
+ let sp = null;
|
|
|
+ if (cp.spid) {
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: cp.spid }) !== -1) {
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: cp.spid });
|
|
|
+ } else {
|
|
|
+ sp = await ctx.service.subProject.getDataById(cp.spid);
|
|
|
+ subProjects.push(sp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sp) {
|
|
|
+ const pageShow = JSON.parse(sp.page_show);
|
|
|
+ if (pageShow.openChangeProject) {
|
|
|
+ auditChangeProjects.push(cp);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ auditChangeProjects.push(cp);
|
|
|
+ }
|
|
|
}
|
|
|
// 获取待审批的变更申请
|
|
|
- let auditChangeApplys = [];
|
|
|
- if (ctx.subProject.page_show.openChangeApply) {
|
|
|
- auditChangeApplys = await ctx.service.changeApplyAudit.getAuditChangeApplyByWap(ctx.session.sessionUser.accountId);
|
|
|
+ const auditChangeApplys = [];
|
|
|
+ const changeApplys = await ctx.service.changeApplyAudit.getAuditChangeApplyByWap(ctx.session.sessionUser.accountId);
|
|
|
+ for (const ca of changeApplys) {
|
|
|
+ let sp = null;
|
|
|
+ if (ca.spid) {
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: ca.spid }) !== -1) {
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: ca.spid });
|
|
|
+ } else {
|
|
|
+ sp = await ctx.service.subProject.getDataById(ca.spid);
|
|
|
+ subProjects.push(sp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sp) {
|
|
|
+ const pageShow = JSON.parse(sp.page_show);
|
|
|
+ if (pageShow.openChangeApply) {
|
|
|
+ auditChangeApplys.push(ca);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ auditChangeApplys.push(ca);
|
|
|
+ }
|
|
|
}
|
|
|
// 获取待审批的变更方案
|
|
|
- let auditChangePlans = [];
|
|
|
- if (ctx.subProject.page_show.openChangePlan) {
|
|
|
- auditChangePlans = await ctx.service.changePlanAudit.getAuditChangePlanByWap(ctx.session.sessionUser.accountId);
|
|
|
+ const auditChangePlans = [];
|
|
|
+ const changePlans = await ctx.service.changePlanAudit.getAuditChangePlanByWap(ctx.session.sessionUser.accountId);
|
|
|
+ for (const cp of changePlans) {
|
|
|
+ let sp = null;
|
|
|
+ if (cp.spid) {
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: cp.spid }) !== -1) {
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: cp.spid });
|
|
|
+ } else {
|
|
|
+ sp = await ctx.service.subProject.getDataById(cp.spid);
|
|
|
+ subProjects.push(sp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sp) {
|
|
|
+ const pageShow = JSON.parse(sp.page_show);
|
|
|
+ if (pageShow.openChangePlan) {
|
|
|
+ auditChangePlans.push(cp);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ auditChangePlans.push(cp);
|
|
|
+ }
|
|
|
}
|
|
|
// 获取待审批的台账修订
|
|
|
const auditRevise = await ctx.service.reviseAudit.getAuditReviseByWap(ctx.session.sessionUser.accountId);
|