MaiXinRong 1 year ago
parent
commit
b3c10f6864
2 changed files with 5 additions and 4 deletions
  1. 2 1
      app/middleware/stage_check.js
  2. 3 3
      app/service/stage_audit.js

+ 2 - 1
app/middleware/stage_check.js

@@ -101,7 +101,7 @@ module.exports = options => {
                 } else {
                     stage.curOrder = stage.curAuditors[0].order - 1
                 }
-                stage.readOnly = stage.readOnly && _.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
+                if (!stage.readOnly) stage.readOnly = !_.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
             }
             if (stage.readOnly) {
                 stage.assist = accountId === stage.user_id || stage.auditorIds.indexOf(accountId) >= 0 ? null : stage.auditAssists.find(x => { return x.ass_user_id === accountId});
@@ -159,6 +159,7 @@ module.exports = options => {
                     const lastAuditors = auditList.filter(x => { x.order === auditList.order; });
                     if (shenpiInfo && (lastAuditors.length === 0 || (lastAuditors.length > 1 || shenpiInfo.audit_id !== lastAuditors[0].aid))) {
                         yield this.service.stageAudit.updateLastAudit(stage, auditList, shenpiInfo.audit_id);
+                        yield this.service.stage.loadStageUser(stage);
                     } else if (!shenpiInfo) {
                         // 不存在终审人的状态下这里恢复为授权审批人
                         this.tender.info.shenpi.stage = shenpiConst.sp_status.sqspr;

+ 3 - 3
app/service/stage_audit.js

@@ -1855,8 +1855,8 @@ module.exports = app => {
                 let order = auditList.length > 0 ? auditList.reduce((rst, a) => { return Math.max(rst, a.order)}, 0) + 1 : 1; // 最大值 + 1
                 if (existAudit) {
                     await transaction.delete(this.tableName, { sid: stage.id, times: stage.times, aid: lastId });
-                    const sameOrder = auditList.find(x => { return x.order === existAudit.order });
-                    if (!sameOrder) {
+                    const sameOrder = auditList.filter(x => { return x.order === existAudit.order });
+                    if (sameOrder.length === 1) {
                         const updateData = [];
                         auditList.forEach(x => {
                             if (x.order <= existAudit.order) return;
@@ -1864,8 +1864,8 @@ module.exports = app => {
                         });
                         if (updateData.length > 0) {
                             await transaction.updateRows(updateData);
-                            order = order - 1;
                         }
+                        order = order - 1;
                     }
                 }
                 // 添加终审