Browse Source

导航栏权限判断调整

ellisran 2 days ago
parent
commit
1a6b6a12b2
3 changed files with 11 additions and 1 deletions
  1. 6 1
      app/base/base_controller.js
  2. 1 0
      app/view/layout/menu.ejs
  3. 4 0
      config/menu.js

+ 6 - 1
app/base/base_controller.js

@@ -37,11 +37,16 @@ class BaseController extends Controller {
             menuList.datacollect.display = ctx.subProject.showDataCollect || false;
             menuList.file.display = ctx.subProject.page_show.openFile || false;
             menuList.contract.display = ctx.subProject.page_show.openContract || ctx.subProject.page_show.openTenderContract || false;
+            menuList.contract.children.find(item => item.msg === 'subproj').display = ctx.subProject.page_show.openContract || false;
+            menuList.contract.children.find(item => item.msg === 'tender').display = ctx.subProject.page_show.openTenderContract || false;
             menuList.financial.display = ctx.subProject.page_show.openFinancial || false;
             menuList.budget.display = ctx.subProject.page_show.openBudget || false;
             menuList.payment.display = ctx.subProject.page_show.openPayment || false;
             menuList.quality.display = ctx.subProject.page_show.quality || false;
-            menuList.inspection.display = ctx.subProject.page_show.quality || false;
+            menuList.inspection.display = ctx.subProject.page_show.qualityInspection || false;
+            menuList.safe.display = ctx.subProject.page_show.safePayment || ctx.subProject.page_show.safeInspection || false;
+            menuList.safe.children.find(item => item.msg === 'payment').display = ctx.subProject.page_show.safePayment || false;
+            menuList.safe.children.find(item => item.msg === 'inspection').display = ctx.subProject.page_show.safeInspection || false;
             for (const index in menuList) {
                 const im = menuList[index];
                 if (!im.url) {

+ 1 - 0
app/view/layout/menu.ejs

@@ -27,6 +27,7 @@
                 </a>
             </li>
             <% for (const child of menu.children) { %>
+                <% if (!child.display) { continue } %>
                 <li data-index="<%- 'nav_' + index %>" class="child-bg <% if((ctx.controllerName === child.controller && (!child.notIncludedUrl || !child.notIncludedUrl.some(item => ctx.url.includes(item)))) || (!!child.controllers && child.controllers.indexOf(ctx.controllerName) >= 0 && (!child.includedUrl || !child.includedUrl[ctx.controllerName] || child.includedUrl[ctx.controllerName].some(item => ctx.url.includes(item)))) || (child.url && child.url === ctx.url)) { %>active<% } %>">
                     <a href="<%- child.url %>" data-toggle="tooltip" data-placement="right" title="" data-original-title="<%- child.name %>">
                         <i></i>

+ 4 - 0
config/menu.js

@@ -111,6 +111,7 @@ const menu = {
                 name: '项目合同',
                 caption: '项目合同',
                 controller: 'contract',
+                display: true,
                 notIncludedUrl: ['/contract/tender'],
             },
             {
@@ -118,6 +119,7 @@ const menu = {
                 name: '标段合同',
                 caption: '标段合同',
                 controllers: ['contract'],
+                display: true,
                 includedUrl: { contract: ['/contract/tender'] },
             },
         ],
@@ -152,6 +154,7 @@ const menu = {
                 name: '安全计量',
                 caption: '安全计量',
                 controller: 'safe',
+                display: true,
                 notIncludedUrl: ['/inspection'],
             },
             {
@@ -159,6 +162,7 @@ const menu = {
                 name: '安全巡检',
                 caption: '安全巡检',
                 controllers: ['safe'],
+                display: true,
                 includedUrl: { safe: ['/inspection'] },
             },
         ],