|
@@ -885,6 +885,53 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async _commonGetAudit(ctx, params, stgAudit) {
|
|
|
+ switch (params.stage_id) {
|
|
|
+ case -300: // 变更令
|
|
|
+ const changeAudit = await ctx.service.changeAudit.getAuditors(params.change_id, params.change_times, true);
|
|
|
+ const change = await ctx.service.change.getChangeByCid(params.change_id);
|
|
|
+ let orgChangeStatus = 3;
|
|
|
+ if ([1, 9].includes(change.status)) orgChangeStatus = 1; // 原报只要已上报(非1、9),status都是3
|
|
|
+ stgAudit.push({ aid: change.uid, status: orgChangeStatus, opinion: '', end_time: change.in_time, order: 0 }); // 加上原报
|
|
|
+ changeAudit.forEach(audit => {
|
|
|
+ stgAudit.push({ aid: audit.uid, status: audit.status, opinion: audit.sdesc, end_time: audit.sin_time, order: audit.usite });
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case -301: // 变更方案
|
|
|
+ const changePlanAudit = await ctx.service.changePlanAudit.getAuditors(params.business_id, params.change_plan_times, true);
|
|
|
+ const change_plan = await ctx.service.changePlan.getDataById(params.business_id);
|
|
|
+ let orgChangePlanStatus = 3;
|
|
|
+ if ([1, 9].includes(change_plan.status)) orgChangePlanStatus = 1; // 原报只要已上报(非1、9),status都是3
|
|
|
+ stgAudit.push({ aid: change_plan.uid, status: orgChangePlanStatus, opinion: '', end_time: change_plan.in_time, order: 0 }); // 加上原报
|
|
|
+ changePlanAudit.forEach(audit => {
|
|
|
+ stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case -302: // 变更立项
|
|
|
+ const changeProjectAudit = await ctx.service.changeProjectAudit.getAuditors(params.business_id, params.change_project_times, true);
|
|
|
+ const change_project = await ctx.service.changeProject.getDataById(params.business_id);
|
|
|
+ let orgChangePrjStatus = 3;
|
|
|
+ if ([1, 9].includes(change_project.status)) orgChangePrjStatus = 1; // 原报只要已上报(非1、9),status都是3
|
|
|
+ stgAudit.push({ aid: change_project.uid, status: orgChangePrjStatus, opinion: '', end_time: change_project.in_time, order: 0 }); // 加上原报
|
|
|
+ changeProjectAudit.forEach(audit => {
|
|
|
+ stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case -303: // 变更申请
|
|
|
+ const changeApplyAudit = await ctx.service.changeApplyAudit.getAuditors(params.business_id, params.change_apply_times, true);
|
|
|
+ const change_apply = await ctx.service.changeApply.getDataById(params.business_id);
|
|
|
+ let orgChangeApplyStatus = 3;
|
|
|
+ if ([1, 9].includes(change_apply.status)) orgChangeApplyStatus = 1; // 原报只要已上报(非1、9),status都是3
|
|
|
+ stgAudit.push({ aid: change_apply.uid, status: orgChangeApplyStatus, opinion: '', end_time: change_apply.in_time, order: 0 }); // 加上原报
|
|
|
+ changeApplyAudit.forEach(audit => {
|
|
|
+ stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async _getReport(ctx, params) {
|
|
|
// console.log('in getReport');
|
|
|
// console.log(params);
|
|
@@ -947,42 +994,7 @@ module.exports = app => {
|
|
|
stgAudit = [];
|
|
|
stgAuditForOrg = [];
|
|
|
stageFlow = [];
|
|
|
- switch (params.stage_id) {
|
|
|
- case -300: // 变更令
|
|
|
- const changeAudit = await ctx.service.changeAudit.getAuditors(params.change_id, params.change_times, true);
|
|
|
- const change = await ctx.service.change.getChangeByCid(params.change_id);
|
|
|
- stgAudit.push({ aid: change.uid, status: 3, opinion: '', end_time: change.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.uid, status: audit.status, opinion: audit.sdesc, end_time: audit.sin_time, order: audit.usite });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -301: // 变更方案
|
|
|
- const changePlanAudit = await ctx.service.changePlanAudit.getAuditors(params.business_id, params.change_plan_times, true);
|
|
|
- const change_plan = await ctx.service.changePlan.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_plan.uid, status: 3, opinion: '', end_time: change_plan.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changePlanAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: 3, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -302: // 变更立项
|
|
|
- const changeProjectAudit = await ctx.service.changeProjectAudit.getAuditors(params.business_id, params.change_project_times, true);
|
|
|
- const change_project = await ctx.service.changeProject.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_project.uid, status: 3, opinion: '', end_time: change_project.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeProjectAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -303: // 变更申请
|
|
|
- const changeApplyAudit = await ctx.service.changeApplyAudit.getAuditors(params.business_id, params.change_apply_times, true);
|
|
|
- const change_apply = await ctx.service.changeApply.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_apply.uid, status: 3, opinion: '', end_time: change_apply.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeApplyAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ this._commonGetAudit(ctx, params, stgAudit);
|
|
|
stgAudit.sort(function(stg1, stg2) {
|
|
|
return stg1.order - stg2.order;
|
|
|
});
|
|
@@ -1104,42 +1116,7 @@ module.exports = app => {
|
|
|
}
|
|
|
} else if ([-300, -301, -302, -303].includes(params.stage_id)) {
|
|
|
stgAudit = [];
|
|
|
- switch (params.stage_id) {
|
|
|
- case -300:
|
|
|
- const changeAudit = await ctx.service.changeAudit.getAuditors(params.change_id, params.change_times, true);
|
|
|
- const change = await ctx.service.change.getChangeByCid(params.change_id);
|
|
|
- stgAudit.push({ aid: change.uid, status: 3, opinion: '', end_time: change.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.uid, status: audit.status, opinion: audit.sdesc, end_time: audit.sin_time, order: audit.usite });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -301: // 变更方案
|
|
|
- const changePlanAudit = await ctx.service.changePlanAudit.getAuditors(params.business_id, params.change_plan_times, true);
|
|
|
- const change_plan = await ctx.service.changePlan.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_plan.uid, status: 3, opinion: '', end_time: change_plan.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changePlanAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -302: // 变更立项
|
|
|
- const changeProjectAudit = await ctx.service.changeProjectAudit.getAuditors(params.business_id, params.change_project_times, true);
|
|
|
- const change_project = await ctx.service.changeProject.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_project.uid, status: 3, opinion: '', end_time: change_project.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeProjectAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- case -303: // 变更申请
|
|
|
- const changeApplyAudit = await ctx.service.changeApplyAudit.getAuditors(params.business_id, params.change_apply_times, true);
|
|
|
- const change_apply = await ctx.service.changeApply.getDataById(params.business_id);
|
|
|
- stgAudit.push({ aid: change_apply.uid, status: 3, opinion: '', end_time: change_apply.in_time, order: 0 }); // 加上原报,且默认status = 3
|
|
|
- changeApplyAudit.forEach(audit => {
|
|
|
- stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
|
|
|
- });
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ this._commonGetAudit(ctx, params, stgAudit);
|
|
|
this._mergeBlankRoleSignDate(roleRel, stgAudit);
|
|
|
}
|
|
|
|