浏览代码

查阅所有标段权限下,查看非参与标段的期计量

maixinrong 5 年之前
父节点
当前提交
add377c524
共有 4 个文件被更改,包括 9 次插入7 次删除
  1. 0 5
      app/const/deal_pay.js
  2. 5 0
      app/middleware/session_auth.js
  3. 2 1
      app/middleware/stage_check.js
  4. 2 1
      app/service/stage.js

+ 0 - 5
app/const/deal_pay.js

@@ -14,11 +14,6 @@ const payType = {
     sf: 3,
     wc: 4
 };
-const paySubType = {
-    normal: {value: 1, name: '常规'},
-    award: {value: 2, name: '奖罚金'},
-    supply: {value: 3, title: '甲供材料'},
-};
 
 const payTemplate = [
     {order: 1, name: '本期应付', ptype: payType.yf, minus: false, expr: null, sexpr: null, rexpr: null},

+ 5 - 0
app/middleware/session_auth.js

@@ -29,6 +29,11 @@ module.exports = options => {
                 throw 'session数据错误';
             }
 
+            // 获取用户新建标段权利
+            const accountInfo = yield this.service.projectAccount.getDataById(this.session.sessionUser.accountId);
+            this.session.sessionUser.permission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
+
+
             // 同步消息
             yield this.service.notify.syncNotifyData();
         } catch (error) {

+ 2 - 1
app/middleware/stage_check.js

@@ -56,6 +56,7 @@ module.exports = options => {
             // 权限相关
             // todo 校验权限 (标段参与人、分享)
             const accountId = this.session.sessionUser.accountId, auditorIds = _.map(stage.auditors, 'aid'), shareIds = [];
+            const permission = this.session.sessionUser.permission;
             if (accountId === stage.user_id) { // 原报
                 if (stage.curAuditor) {
                     stage.readOnly = stage.curAuditor.aid !== accountId;
@@ -86,7 +87,7 @@ module.exports = options => {
                     stage.curOrder = accountId === stage.curAuditor.aid ? stage.curAuditor.order : stage.curAuditor.order - 1;
                 }
                 stage.readOnly = (stage.status !== status.checking && stage.status !== status.checkNoPre) || accountId !== stage.curAuditor.aid;
-            } else if (shareIds.indexOf(accountId) !== -1) { // 分享人
+            } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人
                 if (stage.status === status.uncheck) {
                     throw '您无权查看该数据';
                 }

+ 2 - 1
app/service/stage.js

@@ -35,6 +35,7 @@ module.exports = app => {
                 stage.curAuditor = await this.ctx.service.stageAudit.getCurAuditor(stage.id, stage.times);
 
                 const accountId = this.ctx.session.sessionUser.accountId, auditorIds = this._.map(stage.auditors, 'aid'), shareIds = [];
+                const permission = this.ctx.session.sessionUser.permission;
                 if (accountId === stage.user_id) { // 原报
                     if (stage.curAuditor) {
                         stage.readOnly = stage.curAuditor.aid !== accountId;
@@ -65,7 +66,7 @@ module.exports = app => {
                         stage.curOrder = accountId === stage.curAuditor.aid ? stage.curAuditor.order : stage.curAuditor.order - 1;
                     }
                     stage.readOnly = (stage.status !== status.checking && stage.status !== status.checkNoPre) || accountId !== stage.curAuditor.aid;
-                } else if (shareIds.indexOf(accountId) !== -1) { // 分享人
+                } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人
                     if (stage.status === status.uncheck) {
                         throw '您无权查看该数据';
                     }