Browse Source

撤回退回上一人问题

MaiXinRong 1 year ago
parent
commit
012c19dae1
2 changed files with 9 additions and 6 deletions
  1. 4 1
      app/middleware/stage_check.js
  2. 5 5
      app/service/stage_audit.js

+ 4 - 1
app/middleware/stage_check.js

@@ -143,7 +143,10 @@ module.exports = options => {
                     if (sameAudit) {
                         for (const audit of auditList) {
                             const shenpi = shenpiList.find(x => { return x.audit_id === audit.aid; });
-                            if (!shenpi || shenpi.audit_order !== audit.audit_order) sameAudit = false;
+                            if (!shenpi || shenpi.audit_order !== audit.audit_order) {
+                                sameAudit = false;
+                                break;
+                            }
                         }
                     }
                     if (!sameAudit) {

+ 5 - 5
app/service/stage_audit.js

@@ -1183,7 +1183,7 @@ module.exports = app => {
          * 二审 2 B checked                   二审 2 B checked
          * 三审 3 C checkNoPre  pre   ->      三审 3 C checkNoPre
          * 二审 4 B checking    cur           三审 4 C checkCancel   删4B 增4C    增extra_his    增tp_his
-         * 三审 3 C uncheck                   三审 5 C checking      status改     增pay_cur
+         * 三审 5 C uncheck                   三审 5 C checking      status改     增pay_cur
          * 四审 6 D uncheck                   四审 6 D uncheck
          *
          * @param stage
@@ -1220,8 +1220,8 @@ module.exports = app => {
                 });
                 await transaction.insert(this.tableName, newAuditors);
                 // 更新上一个人,最新审批状态为审批中
-                await transaction.update(this.tableName, { begin_time: time, status: auditConst.status.checking }, {
-                    where: { sid: selfAuditor.sid, times: selfAuditor.times, order: selfAuditor.order + 2 }
+                await transaction.update(this.tableName,  { begin_time: time, status: auditConst.status.checking }, {
+                    where: { sid: stage.id, times: selfAuditor.times, order: selfAuditor.order + 2 }
                 });
 
                 // 计算并合同支付最终数据
@@ -1234,7 +1234,7 @@ module.exports = app => {
                     yf_tp: yfPay.tp,
                     sf_tp: sfPay.tp,
                 };
-                stage.tp_history.push({ times, order: selfAuditor.order + 1, ...stageTp });
+                stage.tp_history.push({ times: stage.times, order: selfAuditor.order + 1, ...stageTp });
                 // 同步 期信息
                 await transaction.update(this.ctx.service.stage.tableName, {
                     id: stage.id,
@@ -1247,7 +1247,7 @@ module.exports = app => {
 
                 // 计量明细:勿需修改任何数据
                 // 合同支付明细:复制一份最新数据给下一人
-                await this.ctx.service.stagePay.copyAuditStagePays(stage, times, selfAuditor.order + 2, transaction, stage.times, selfAuditor.order + 1);
+                await this.ctx.service.stagePay.copyAuditStagePays(stage, stage.times, selfAuditor.order + 2, transaction, stage.times, selfAuditor.order + 1);
                 // 其他台账明细:更新一份历史数据
                 await this.ctx.service.stageJgcl.updateHistory4TimesOrder(stage, stage.times, [selfAuditor.order + 1], transaction);
                 await this.ctx.service.stageBonus.updateHistory4TimesOrder(stage, stage.times, [selfAuditor.order + 1], transaction);