瀏覽代碼

修复审批流bug

laiguoran 2 年之前
父節點
當前提交
36f1b7742f
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 3 0
      app/service/payment_detail.js
  2. 9 0
      app/service/payment_detail_audit.js

+ 3 - 0
app/service/payment_detail.js

@@ -243,6 +243,9 @@ module.exports = app => {
             if (details && details.length > 0) {
                 const detailInfo = details[0];
                 if (detailInfo.status === auditConst.status.uncheck || detailInfo.status === auditConst.status.checkNo) {
+                    // 判断该人是否在审批流程里,是则移除并调整order
+                    const result2 = await this.ctx.service.paymentDetailAudit.updateAuditByReport(transaction, detailInfo.id, detailInfo.times, uid);
+                    // 更新为上报人
                     return await transaction.update(this.tableName, { id: detailInfo.id, uid });
                 }
             }

+ 9 - 0
app/service/payment_detail_audit.js

@@ -627,6 +627,15 @@ module.exports = app => {
             ];
             return await this.db.query(sql, sqlParam);
         }
+
+        async updateAuditByReport(transaction, td_id, times, uid) {
+            const auditor = await this.getDataByCondition({ td_id, times, aid: uid });
+            if (auditor) {
+                // 更新order
+                await this._syncOrderByDelete(transaction, td_id, auditor.order, times);
+                return await transaction.delete(this.tableName, { id: auditor.id });
+            }
+        }
     }
 
     return PaymentDetailAudit;