Bläddra i källkod

重新审批后,审批退回,拷贝审批流程时过滤重复审批人

MaiXinRong 1 år sedan
förälder
incheckning
5c749cca14
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5 1
      app/service/ledger_audit.js

+ 5 - 1
app/service/ledger_audit.js

@@ -410,11 +410,15 @@ module.exports = app => {
                         where: { tender_id: tenderId, times },
                         columns: ['tender_id', 'audit_order', 'audit_id'],
                     });
+                    const insertAuditors = [];
                     for (const a of auditors) {
+                        if (insertAuditors.find(x => { return x.audit_id === a.audit_id; })) continue;
+                        a.audit_order = insertAuditors.length + 1;
                         a.times = times + 1;
                         a.status = auditConst.status.uncheck;
+                        insertAuditors.push(a)
                     }
-                    await transaction.insert(this.tableName, auditors);
+                    await transaction.insert(this.tableName, insertAuditors);
 
                     // const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.TZ, smsTypeConst.judge.result.toString(), SmsAliConst.template.ledger_result, {