瀏覽代碼

审批跳过相关

MaiXinRong 6 天之前
父節點
當前提交
610092df44
共有 3 個文件被更改,包括 20 次插入 和 16 次删除
  1. 4 5
      app/middleware/stage_check.js
  2. 14 9
      app/service/stage.js
  3. 2 2
      app/service/stage_audit.js

+ 4 - 5
app/middleware/stage_check.js

@@ -110,17 +110,16 @@ module.exports = options => {
                 if (!stage.readOnly) {
                 if (!stage.readOnly) {
                     stage.assist = ass;
                     stage.assist = ass;
                     stage.curOrder = stage.curAuditors[0].order;
                     stage.curOrder = stage.curAuditors[0].order;
-                } else {
-                    stage.curOrder = stage.curAuditors[0].order - 1;
-                }
-                if (!stage.readOnly) {
                     if (stage.curAuditors[0].audit_type === auditType.key.and) {
                     if (stage.curAuditors[0].audit_type === auditType.key.and) {
                         stage.readOnly = !_.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
                         stage.readOnly = !_.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
                         stage.canCheck = true;
                         stage.canCheck = true;
                     } else if (stage.curAuditors[0].audit_type === auditType.key.union) {
                     } else if (stage.curAuditors[0].audit_type === auditType.key.union) {
-                        stage.readOnly = stage.relaAuditor.status === status.checked;
+                        console.log(stage.relaAuditor);
+                        stage.readOnly = stage.relaAuditor.status !== status.checking;
                         stage.canCheck = !stage.readOnly;
                         stage.canCheck = !stage.readOnly;
                     }
                     }
+                } else {
+                    stage.curOrder = stage.curAuditors[0].order - 1;
                 }
                 }
             }
             }
             if (stage.readOnly) {
             if (stage.readOnly) {

+ 14 - 9
app/service/stage.js

@@ -193,20 +193,25 @@ module.exports = app => {
                 stage.readOnly = true;
                 stage.readOnly = true;
                 stage.curTimes = stage.times;
                 stage.curTimes = stage.times;
                 stage.curOrder = _.max(_.map(stage.auditors, 'order'));
                 stage.curOrder = _.max(_.map(stage.auditors, 'order'));
-            } else {
-                const ass = stage.auditAssists.find(x => { return stage.flowAuditorIds.indexOf(x.user_id) >= 0 && x.ass_user_id === accountId; });
-                stage.readOnly = stage.flowAuditorIds.indexOf(accountId) < 0 && !ass;
+            } else if (stage.curAuditors.length > 0) {
                 stage.curTimes = stage.times;
                 stage.curTimes = stage.times;
-                if (!stage.readOnly) {
+                const ass = stage.auditAssists.find(x => { return stage.flowAuditorIds.indexOf(x.user_id) >= 0 && x.ass_user_id === accountId; });
+                const inCurFlow = stage.flowAuditorIds.indexOf(accountId) >= 0 || ass;
+                if (inCurFlow) {
                     stage.assist = ass;
                     stage.assist = ass;
                     stage.curOrder = stage.curAuditors[0].order;
                     stage.curOrder = stage.curAuditors[0].order;
+                    // 会签,会签人审批通过时,只读,但是curOrder需按原来的取值
+                    if (stage.curAuditors[0].audit_type === auditType.key.and) {
+                        stage.readOnly = !_.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
+                        stage.canCheck = true;
+                    } else if (stage.curAuditors[0].audit_type === auditType.key.union) {
+                        console.log(stage.relaAuditor);
+                        stage.readOnly = stage.relaAuditor.status !== status.checking;
+                        stage.canCheck = !stage.readOnly;
+                    }
                 } else {
                 } else {
                     stage.curOrder = stage.curAuditors[0].order - 1;
                     stage.curOrder = stage.curAuditors[0].order - 1;
-                }
-                // 会签,会签人审批通过时,只读,但是curOrder需按原来的取值
-                if (!stage.readOnly) {
-                    stage.readOnly = !_.isEqual(stage.flowAuditorIds, stage.curAuditorIds);
-                    stage.canCheck = true;
+                    stage.readOnly = true;
                 }
                 }
             }
             }
             if (stage.readOnly) {
             if (stage.readOnly) {

+ 2 - 2
app/service/stage_audit.js

@@ -1322,8 +1322,8 @@ module.exports = app => {
                 });
                 });
                 await transaction.insert(this.tableName, [...checkCancelAuditors, ...checkingAuditors]);
                 await transaction.insert(this.tableName, [...checkCancelAuditors, ...checkingAuditors]);
                 // 当前审批人变成待审批
                 // 当前审批人变成待审批
-                await transaction.updateRows(this.tableName, stage.curAuditors.map(x => { return {
-                    id: x.id, begin_time: null, status: auditConst.status.uncheck, order: x.order + 2
+                await transaction.updateRows(this.tableName, stage.flowAuditors.map(x => { return {
+                    id: x.id, begin_time: null, status: auditConst.status.uncheck, order: x.order + 2, opinion: '',
                 }}));
                 }}));
                 await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(stage.curAuditors, 'id'));
                 await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(stage.curAuditors, 'id'));
                 // 计算并合同支付最终数据
                 // 计算并合同支付最终数据