浏览代码

变更审批通过后端逻辑更改

ellisran 1 年之前
父节点
当前提交
2a99082529
共有 2 个文件被更改,包括 10 次插入6 次删除
  1. 8 6
      app/service/change.js
  2. 2 0
      app/view/change/information_modal.ejs

+ 8 - 6
app/service/change.js

@@ -856,10 +856,13 @@ module.exports = app => {
                     });
                 });
                 await this.transaction.insert('zh_notice', records);
+                // 判断是否终审方法需要更改了,因为存在修改审批流程的操作,会使判断是否终审有问题
+                const curAudit = await this.ctx.service.changeAudit.getCurAuditor(changeData.cid, changeData.times);
+                const nextAudit = await this.ctx.service.changeAudit.getDataByCondition({ cid: changeData.cid, times: changeData.times, usite: curAudit.usite + 1 });
 
                 // 设置审批人通过
                 const audit_update = {
-                    id: postData.audit_id,
+                    id: curAudit.id,
                     sdesc: postData.sdesc,
                     status: audit.flow.auditStatus.checked,
                     sin_time: new Date(),
@@ -896,7 +899,7 @@ module.exports = app => {
                         await this.transaction.update(this.ctx.service.changeAuditList.tableName, list_update);
                     }
                 }
-                if (postData.audit_next_id === undefined) {
+                if (nextAudit === undefined) {
                     // 变更令审批完成
                     change_update.status = audit.flow.status.checked;
                     change_update.p_code = postData.p_code;
@@ -935,20 +938,19 @@ module.exports = app => {
                 } else {
                     // 设置下一个审批人为审批状态
                     const nextAudit_update = {
-                        id: postData.audit_next_id,
+                        id: nextAudit.id,
                         status: audit.flow.auditStatus.checking,
                         sin_time: new Date(),
                     };
                     await this.transaction.update(this.ctx.service.changeAudit.tableName, nextAudit_update);
 
                     // 添加短信通知-需要审批提醒功能
-                    const nextAuditData = await this.ctx.service.changeAudit.getDataById(postData.audit_next_id);
                     const sms = new SMS(this.ctx);
                     const code = await sms.contentChange(changeData.code);
                     const shenpiUrl = await this.ctx.helper.urlToShort(
                         this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + changeData.tid + '/change/' + changeData.cid + '/information#shenpi'
                     );
-                    await this.ctx.helper.sendAliSms(nextAuditData.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, {
+                    await this.ctx.helper.sendAliSms(nextAudit.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, {
                         biangeng: code,
                         code: shenpiUrl,
                     });
@@ -960,7 +962,7 @@ module.exports = app => {
                         code: this.ctx.session.sessionProject.code,
                         c_name: changeData.name,
                     };
-                    await this.ctx.helper.sendWechat(nextAuditData.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
+                    await this.ctx.helper.sendWechat(nextAudit.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
                 }
                 change_update.total_price = total_price;
                 const options = {

+ 2 - 0
app/view/change/information_modal.ejs

@@ -1518,6 +1518,8 @@
             // 退回选择修改审批人流程
             $('#hideSp').click(function () {
                 $('#sp-list').modal('hide');
+                $('#sp-done').modal('hide');
+                $('#sp-back').modal('hide');
             });
             $('a[f-target]').click(function () {
                 $($(this).attr('f-target')).modal('show');