浏览代码

标段设置权限

laiguoran 5 年之前
父节点
当前提交
c3a269be2a
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13 2
      app/controller/tender_controller.js

+ 13 - 2
app/controller/tender_controller.js

@@ -363,12 +363,23 @@ module.exports = app => {
                 if (!data) {
                     throw '提交数据错误';
                 }
+                // 针对查阅所有标段者但非原报和审批人提示
+                const times = ctx.tender.data.ledger_status === auditConst.ledger.status.checkNo ? ctx.tender.data.ledger_times - 1 : ctx.tender.data.ledger_times;
+                const auditors = await this.service.ledgerAudit.getAuditors(ctx.tender.id, times);
+                const auditorsId = ctx.helper._.map(auditors, 'audit_id');
+                const stageAuditors = await this.service.stageAudit.getAllAuditors(ctx.tender.id);
+                const stageAUditorsId = ctx.helper._.map(stageAuditors, 'aid');
+                const accountId = ctx.session.sessionUser.accountId;
+                if (auditorsId.indexOf(accountId) === -1 && ctx.tender.data.user_id !== accountId &&
+                    stageAUditorsId.indexOf(accountId) === -1) {
+                    throw '您无权修改标段设置内容';
+                }
+
                 if (ctx.tender.data.ledger_status === auditConst.ledger.status.checked) {
                     if (data.deal_param) {
                         const lastStage = await this.ctx.service.stage.getLastestStage(ctx.tender.id, true);
                         if (lastStage) {
-                            if (lastStage.order > 1 || (lastStage.status === auditConst.stage.status.checked || lastStage.status === auditConst.stage.status.checking))
-                                throw '第一期上报后不可修改合同参数';
+                            if (lastStage.order > 1 || (lastStage.status === auditConst.stage.status.checked || lastStage.status === auditConst.stage.status.checking)) throw '第一期上报后不可修改合同参数';
                             if (lastStage.user_id !== ctx.session.sessionUser.accountId) throw '仅原报可修改合同参数';
                         }
                     }