Bladeren bron

fix: 修复计量审核,无法审核的bug

lanjianrong 4 jaren geleden
bovenliggende
commit
c74cd2a2e2
1 gewijzigde bestanden met toevoegingen van 18 en 15 verwijderingen
  1. 18 15
      app/controller/stage_controller.js

+ 18 - 15
app/controller/stage_controller.js

@@ -150,7 +150,8 @@ module.exports = app => {
             }
             // 获取审批流程中左边列表
             ctx.stage.auditors2 = await ctx.service.stageAudit.getAuditGroupByListWithOwner(ctx.stage.id, times);
-            if (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) {
+            const { status } = ctx.stage;
+            if (status === auditConst.status.uncheck || status === auditConst.status.checkNo) {
                 ctx.stage.auditorList = await ctx.service.stageAudit.getAuditors(ctx.stage.id, ctx.stage.times);
             }
         }
@@ -1016,11 +1017,13 @@ module.exports = app => {
                 }
 
                 await ctx.service.stageAudit.start(ctx.stage.id, ctx.stage.times);
-                const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
-                ctx.body = { err: 0, msg: '', data: [] };
+                // const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
+                // ctx.body = { err: 0, msg: '', data: [] };
+                ctx.redirect(ctx.request.header.referer);
             } catch (err) {
                 this.log(err);
-                ctx.body = this.ajaxErrorBody(err, '上报失败');
+                ctx.redirect(ctx.request.header.referer);
+                // ctx.body = this.ajaxErrorBody(err, '上报失败');
             }
         }
         /**
@@ -1037,7 +1040,7 @@ module.exports = app => {
                 if (!this.ctx.stage.curAuditor || this.ctx.stage.curAuditor.aid !== ctx.session.sessionUser.accountId) {
                     throw '您无权进行该操作';
                 }
-                const data = JSON.parse(ctx.request.body.data);
+                const data = ctx.request.body;
                 data.checkType = parseInt(data.checkType);
                 // const data = {
                 //     checkType: parseInt(ctx.request.body.checkType),
@@ -1053,20 +1056,20 @@ module.exports = app => {
                 }
 
                 await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
-                const stageOrder = parseInt(ctx.params.order);
-                const stage = await ctx.service.stage.getDataByCondition({
-                    tid: ctx.tender.id,
-                    order: stageOrder,
-                });
-                const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
-                ctx.body = { err: 0, msg: '', data: [] };
-                // ctx.redirect(ctx.request.header.referer);
+                // const stageOrder = parseInt(ctx.params.order);
+                // const stage = await ctx.service.stage.getDataByCondition({
+                //     tid: ctx.tender.id,
+                //     order: stageOrder,
+                // });
+                // const auditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
+                // ctx.body = { err: 0, msg: '', data: [] };
+                ctx.redirect(ctx.request.header.referer);
             } catch (err) {
                 // console.log(err);
                 this.log(err);
-                ctx.body = this.ajaxErrorBody(err, '提交失败');
+                // ctx.body = this.ajaxErrorBody(err, '提交失败');
                 // ctx.session.postError = err.toString();
-                // ctx.redirect(ctx.request.header.referer);
+                ctx.redirect(ctx.request.header.referer);
             }
         }
         /**