Browse Source

审批人上报限制

laiguoran 4 years ago
parent
commit
8450e97c1c
1 changed files with 13 additions and 2 deletions
  1. 13 2
      app/controller/change_controller.js

+ 13 - 2
app/controller/change_controller.js

@@ -609,6 +609,7 @@ module.exports = app => {
                         }
                         renderData.auditList3 = auditList3;
                     }
+
                     // 获取公司列表
                     const companyList = await ctx.service.changeCompany.getAllDataByCondition({ where: { tid: ctx.tender.id } });
                     renderData.companyList = companyList;
@@ -807,10 +808,20 @@ module.exports = app => {
                 if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
                     throw '您无权上报该变更令数据';
                 }
-                if (!(ctx.change.status === audit.flow.status.uncheck || ctx.change.status === audit.flow.status.back)) {
+                if (!(ctx.change.status === audit.flow.status.uncheck || ctx.change.status === audit.flow.status.back || ctx.change.status === audit.flow.status.revise)) {
                     throw '该变更令当前无法上报';
                 }
-
+                // 判断是否是修订,判断有无审批人员作弊
+                if (ctx.change.status === audit.flow.status.revise && ctx.tender.info.shenpi.change === shenpiConst.sp_status.sqspr) {
+                    // 获取上一次的审批人流程
+                    const lastUserList = await ctx.service.changeAudit.getListGroupByTimes(ctx.change.cid, ctx.change.times - 1);
+                    const lastUidList = ctx.helper._.map(lastUserList, 'uid');
+                    // 判断上一次审批是否为非原报为审批人
+                    const nowUidList = ctx.helper._.map(ctx.change.auditors, 'uid');
+                    if (lastUidList !== nowUidList && nowUidList.length === 2 && nowUidList[0] === nowUidList[1]) {
+                        throw '该变更令不能指定原报人为单独审批人';
+                    }
+                }
                 await ctx.service.changeAudit.start(ctx.change.cid, ctx.change.times);
 
                 ctx.redirect(ctx.request.header.referer);