MaiXinRong 2 years ago
parent
commit
a3a2662335
2 changed files with 3 additions and 3 deletions
  1. 1 1
      app/middleware/budget_check.js
  2. 2 2
      app/service/sub_proj_permission.js

+ 1 - 1
app/middleware/budget_check.js

@@ -29,7 +29,7 @@ module.exports = options => {
             } else {
                 const bp = yield this.service.subProjPermission.getBudgetUserPermission(id);
                 if (!bp) throw '您无权查看该项目';
-                this.budget.readOnly = bp.permission.indexOf(this.service.subProjPermission.PermissionConst.budget.edit.value) < 0;
+                this.budget.readOnly = bp.budget_permission.indexOf(this.service.subProjPermission.PermissionConst.budget.edit.value) < 0;
             }
             yield next;
         } catch (err) {

+ 2 - 2
app/service/sub_proj_permission.js

@@ -94,8 +94,8 @@ module.exports = app => {
         }
 
         async getBudgetUserPermission(bid) {
-            const _ = this.ctx.helper._;
-            const result = await this.getDataByCondition({uid: this.ctx.session.sessionUser.accountId, bid});
+            const subProj = await this.service.subProject.getDataByCondition({ budget_id: bid });
+            const result = await this.getDataByCondition({ spid: subProj.id, uid: this.ctx.session.sessionUser.accountId });
             if (result) this.parsePermission(result);
             return result;
         }