@@ -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 '您无权进行该操作';
// 重新审批
@@ -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);
@@ -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) {
@@ -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>
@@ -589,7 +589,7 @@
</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">
@@ -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) { %>
@@ -1112,7 +1112,7 @@
-<% 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) { %>
<!--上报审批 需要完成中间计量-->