MaiXinRong 1 年之前
父节点
当前提交
cb2ce14835
共有 3 个文件被更改,包括 6 次插入5 次删除
  1. 1 0
      app/controller/wap_controller.js
  2. 3 3
      app/service/stage_audit.js
  3. 2 2
      app/view/wap/shenpi_stage.ejs

+ 1 - 0
app/controller/wap_controller.js

@@ -365,6 +365,7 @@ module.exports = app => {
                 renderData.stage.auditors = await ctx.service.stageAudit.getAuditors(renderData.stage.id, times);
                 // 获取审批流程中左边列表
                 renderData.stage.auditors2 = await ctx.service.stageAudit.getAuditGroupByList(renderData.stage.id, times);
+                renderData.stage.lastAuditors = await ctx.service.stageAudit.getAuditorsByStatus(stage.id, stage.status, stage.times);
                 await ctx.render('wap/shenpi_stage.ejs', renderData);
             } catch (err) {
                 this.log(err);

+ 3 - 3
app/service/stage_audit.js

@@ -277,9 +277,9 @@ module.exports = app => {
                 if (!auditor) {
                     throw '该审核人不存在';
                 }
-                await this._syncOrderByDelete(transaction, stageId, auditor.order, times);
                 // 移除整个流程的人
                 await transaction.delete(this.tableName, { sid: stageId, order: auditor.order, times});
+                await this._syncOrderByDelete(transaction, stageId, auditor.order, times);
                 await transaction.commit();
             } catch (err) {
                 await transaction.rollback();
@@ -1650,8 +1650,8 @@ module.exports = app => {
 
                     sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`order`, la.audit_order, la.audit_type ' +
                         '  FROM ?? AS la Left Join ?? AS pa On la.`aid` = pa.`id` ' +
-                        '  WHERE la.`sid` = ? and la.`order` = ?';
-                    sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, cur.order];
+                        '  WHERE la.`sid` = ? and la.`order` = ? and times = ?';
+                    sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, cur.order, times];
                     auditor = await this.db.query(sql, sqlParam);
                     break;
                 case auditConst.status.checkNo:

+ 2 - 2
app/view/wap/shenpi_stage.ejs

@@ -47,8 +47,8 @@
             <dl class="mb-2 mt-3">
                 <dt class="bg-light p-2 d-flex justify-content-between"><span>第<%- stage.order %>期</span>
                     <span class="<%- auditConst.auditStringClass[stage.status] %>">
-                        <% if (stage.curAuditors && stage.status !== auditConst.status.checked) { %>
-                            <%- (stage.curAuditors[0].audit_type !== 1 ? ctx.helper.transFormToChinese(stage.curAuditors[0].audit_order) + '审' : stage.curAuditors[0].name + (stage.curAuditors[0].role ? '-' + stage.curAuditors[0].role : '')) %>
+                        <% if (stage.lastAuditors.length && stage.status !== auditConst.status.checked) { %>
+                            <%- (stage.lastAuditors[0].audit_type !== 1 ? ctx.helper.transFormToChinese(stage.lastAuditors[0].audit_order) + '审' : stage.lastAuditors[0].name + (stage.lastAuditors[0].role ? '-' + stage.lastAuditors[0].role : '')) %>
                         <% } %>
                         <%- stage.status === auditConst.status.checked ? '审批完成' : auditConst.auditProgress[stage.status] %>
                         </span>