Преглед изворни кода

台账修订,重新审批相关

MaiXinRong пре 1 година
родитељ
комит
bd2081386e
2 измењених фајлова са 18 додато и 11 уклоњено
  1. 17 10
      app/service/ledger_audit.js
  2. 1 1
      app/view/ledger/audit_modal.ejs

+ 17 - 10
app/service/ledger_audit.js

@@ -713,28 +713,35 @@ module.exports = app => {
          */
         async checkAgain(tenderId, times = 1) {
             const time = new Date();
+            const accountId = this.ctx.session.sessionUser.accountId;
             // 整理当前流程审核人状态更新
             const auditors = await this.getAllDataByCondition({
                 where: { tender_id: tenderId, times },
                 orders: [['audit_order', 'desc']],
             });
             if (auditors.length <= 0) throw '台账审核数据错误';
-            const selfAudit = auditors[0];
-            if (selfAudit.audit_id !== this.ctx.session.sessionUser.accountId) throw '当前台账您无权重审';
+            const flowAuditors = auditors.filter(x => { return x.audit_order === auditors[0].audit_order; });
+            const selfAudit = flowAuditors.find(x => { return x.audit_id === accountId; });
+            if (!selfAudit) throw '当前台账您无权重审';
             const tender = this.ctx.service.tender.getDataById(tenderId);
             if (!tender) throw '标段数据错误';
 
             let otherAuditIds = [tender.user_id, ...auditors.map(x => { return x.audit_id })];
             otherAuditIds = this._.uniq(otherAuditIds).filter(x => { return x !== selfAudit.audit_id; });
 
-            const checkAgainAuditor = {
-                tender_id: tenderId, times, audit_order: selfAudit.audit_order + 1, audit_id: selfAudit.audit_id,
-                begin_time: time, end_time: time, opinion: '', status: auditConst.status.checkAgain,
-            };
-            const checkingAuditor = {
-                tender_id: tenderId, times, audit_order: selfAudit.audit_order + 2, audit_id: selfAudit.audit_id,
-                begin_time: time, end_time: null, opinion: '', status: auditConst.status.checking,
-            };
+            const checkAgainAuditor = flowAuditors.map(x => {
+                return {
+                    tender_id: tenderId, times, audit_order: x.audit_order + 1, audit_id: x.audit_id,
+                    begin_time: time, end_time: time, opinion: '',
+                    status: x.audit_id === accountId ? auditConst.status.checkAgain : auditConst.status.checkSkip,
+                }
+            });
+            const checkingAuditor = flowAuditors.map(x => {
+                return {
+                    tender_id: tenderId, times, audit_order: x.audit_order + 2, audit_id: x.audit_id,
+                    begin_time: time, end_time: null, opinion: '', status: auditConst.status.checking,
+                };
+            });
             const transaction = await this.db.beginTransaction();
             try {
                 // 当前审批人2次添加至流程中

+ 1 - 1
app/view/ledger/audit_modal.ejs

@@ -499,7 +499,7 @@
         </div>
     </div>
 <% } %>
-<% if (tender.ledger_status === auditConst.status.checked && auditors[auditors.length - 1].audit_id === ctx.session.sessionUser.accountId && !tender.hasStage && !tender.hasRevise) { %>
+<% if (tender.ledger_status === auditConst.status.checked && tender.finalAuditorIds.indexOf(ctx.session.sessionUser.accountId) >= 0 && !tender.hasStage && !tender.hasRevise) { %>
 <% if (!authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
 <!--终审重新审批-->
 <div class="modal fade" id="sp-down-back" data-backdrop="static">