Bläddra i källkod

删除期bug和重新审批修改为终审可见

laiguoran 5 år sedan
förälder
incheckning
1213b42d70

+ 3 - 1
app/controller/change_controller.js

@@ -701,7 +701,9 @@ module.exports = app => {
                 if (!changeData) {
                     throw '变更令数据错误';
                 }
-                if (changeData.status !== audit.flow.status.checked || ctx.session.sessionUser.accountId !== changeData.uid) {
+                // 获取终审
+                const auditInfo = (await this.ctx.service.changeAudit.getAllDataByCondition({ where: { cid: changeData.cid }, orders: [['usort', 'desc']], limit: 1, offset: 0 }))[0];
+                if (changeData.status !== audit.flow.status.checked || ctx.session.sessionUser.accountId !== auditInfo.uid) {
                     throw '您无权进行该操作';
                 }
                 // 重新审批

+ 1 - 1
app/controller/stage_controller.js

@@ -926,7 +926,7 @@ module.exports = app => {
          */
         async checkAuditAgain(ctx) {
             try {
-                if (ctx.stage.user_id === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) {
+                if (ctx.stage.auditors[ctx.stage.auditors.length - 1].aid === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) {
                     await ctx.service.stageAudit.checkAgain(ctx.stage.id, ctx.stage.times);
                     console.log('success');
                     ctx.redirect(ctx.request.header.referer);

+ 1 - 1
app/service/stage.js

@@ -321,7 +321,7 @@ module.exports = app => {
                         await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
                     }
                 }
-                await transaction.delete(this.ctx.service.StageAtt.tableName, { sid: id });
+                await transaction.delete(this.ctx.service.stageAtt.tableName, { sid: id });
                 await transaction.commit();
                 return true;
             } catch (err) {

+ 1 - 1
app/view/change/info.ejs

@@ -107,7 +107,7 @@
             <% } else if (auditStatus === 7) { %>
                 <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm btn-block">审批中</a>
             <% } %>
-            <% if (auditStatus === 4 && ctx.session.sessionUser.accountId === change.uid) { %>
+            <% if (auditStatus === 4 && ctx.session.sessionUser.accountId === auditList[auditList.length-1].uid) { %>
                 <!--重新审批-->
                 <a href="javascript: void(0);" data-toggle="modal" data-target="#sp-down-back" class="btn btn-warning btn-sm btn-block">重新审批</a>
             <% } %>

+ 1 - 1
app/view/change/info_modal.ejs

@@ -589,7 +589,7 @@
         </div>
     </div>
 </div>
-<% if (auditStatus === 4 && ctx.session.sessionUser.accountId === change.uid) { %>
+<% if (auditStatus === 4 && ctx.session.sessionUser.accountId === auditList[auditList.length-1].uid) { %>
 <!--重新审批-->
 <div class="modal fade" id="sp-down-back" data-backdrop="static">
     <div class="modal-dialog" role="document">

+ 1 - 1
app/view/stage/audit_btn.ejs

@@ -24,7 +24,7 @@
             <a href="#sp-back" data-toggle="modal" data-target="#sp-back" class="btn btn-warning btn-sm btn-block">审批退回</a>
         <% } %>
     <% } %>
-    <% if (ctx.stage.user_id === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
+    <% if (ctx.stage.auditors[ctx.stage.auditors.length-1].aid === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
         <a href="javascript: void(0);" data-toggle="modal" data-target="#sp-down-back" class="btn btn-warning btn-sm btn-block">重新审批</a>
     <% } %>
 </div>

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

@@ -1112,7 +1112,7 @@
     </div>
     <% } %>
 <% } %>
-<% if (ctx.stage.user_id === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
+<% if (ctx.stage.auditors[ctx.stage.auditors.length-1].aid === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
     <!--上报审批 需要完成中间计量-->
     <div class="modal fade" id="sp-down-back" data-backdrop="static">
         <div class="modal-dialog" role="document">