Просмотр исходного кода

修改审批页面按钮权限

zhangli 1 год назад
Родитель
Сommit
a96f5c149f

+ 6 - 0
src/store/modules/appSetting.js

@@ -10,6 +10,7 @@ const appSetting = {
         breadlist: [],
         buttons: {},
         allButtons: {},
+        menusBase:[],
         appKey: ["webApp"],
         appUse:false,//是否选中应用
         idKey: '',//权限的key
@@ -86,6 +87,9 @@ const appSetting = {
         setAllButtons: (state, allButtons) => {
             state.allButtons = allButtons;
         },
+        setMenusBase: (state, menusBase) => {
+            state.menusBase = menusBase;
+        },
         setAppKey: (state, appKey) => {
             state.appKey = [appKey];
         },
@@ -146,6 +150,7 @@ const appSetting = {
                 generatorDynamicRouter().then(res => {
                     var routers = res.routers;
                     var menus = res.menus;
+                    var menusBase = res.menusBase;
                     var menuMap = res.menuMap;
                     var buttons = res.buttons;
                     var allButtons = res.allButtons;
@@ -153,6 +158,7 @@ const appSetting = {
                     commit('setMenuMap', menuMap);
                     commit('setMenus', menus);
                     commit('setButtons', buttons);
+                    commit('setMenusBase', menusBase);
                     commit('setAllButtons', allButtons);
                     commit('setUser', user);
                     commit('setLogined', true);

+ 1 - 0
src/utils/routerUtil.js

@@ -58,6 +58,7 @@ export const generatorDynamicRouter = () => {
                 routers: routers,
                 menuMap: menuMap,
                 buttons: buttons,
+                menusBase: res.data.menus,
                 user: res.data.user,
                 allButtons: res.data.allMenuButtons
             };

+ 18 - 6
src/views/modules/knowledge/warehouse/auditManageList.vue

@@ -74,8 +74,8 @@
                     <a-button type="primary" @click="handleSearchClick">查询</a-button>
                   </div>
                 </a-form>
-                <rx-button alias="processEdit" :butn-icon="'false'" @click="$router.push('/knowledge/auditProcessMaintain')">维护审核流程</rx-button>
-                <rx-button alias="processBatch" :butn-icon="'false'" @click="handldAuditClick('batch')">批量审核</rx-button>
+                <a-button v-if="checkButton('processEdit')" alias="processEdit" :butn-icon="'false'" @click="$router.push('/knowledge/auditProcessMaintain')">维护审核流程</a-button>
+                <a-button v-if="checkButton('processBatch')" alias="processBatch" :butn-icon="'false'" @click="handldAuditClick('batch')">批量审核</a-button>
               </div>
             </div>
           </div>
@@ -115,11 +115,11 @@
              <!-- isAudit 0能审核 1不能审核 -->
             <template v-if="($route.query.showUnchecked ? true : record.isAudit == 0) && (record.approvalStatus == 1 || record.approvalStatus == 3)" >
             <!-- <template v-if="(record.approvalStatus == 1 || record.approvalStatus == 3) && record.approverId == $store.state.appSetting.user.userId" > -->
-              <rx-button class="clearBtn" alias="processDo" :butn-icon="'none'" @click="handleJumpUpdateClick(record)">审核</rx-button>
-              <rx-button class="clearBtn" alias="processFast" :butn-icon="'none'" @click="handldAuditClick('fast',record)">快速审核</rx-button>
+              <a-button v-if="checkButton('processDo')" class="clearBtn" alias="processDo" :butn-icon="'none'" @click="handleJumpUpdateClick(record)">审核</a-button>
+              <a-button v-if="checkButton('processFast')" class="clearBtn" alias="processFast" :butn-icon="'none'" @click="handldAuditClick('fast',record)">快速审核</a-button>
             </template>
             <template v-else>
-              <rx-button class="clearBtn" alias="processLook" :butn-icon="'none'" @click="handleJumpUpdateClick(record,true)">查看</rx-button>
+              <a-button v-if="checkButton('processLook')" class="clearBtn" alias="processLook" :butn-icon="'none'" @click="handleJumpUpdateClick(record,true)">查看</a-button>
             </template>
           </template>
         </rx-grid>
@@ -172,6 +172,7 @@ import classApi from '@/api/knowledge/classify'
 import { getCategory } from '../aJs/getClassifyTree'
 import mixin from "../aMixin/mixin"
 import initMixin from "../aMixin/initMixin"
+import {mapState} from "vuex";
 const auditMixin = new mixin('audit')
 export default {
   name: 'auditManageList',
@@ -360,7 +361,6 @@ export default {
   },
   mounted() {
     let innerWidth = window.innerWidth
-
     // 计算
     setTimeout(() => {
       let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
@@ -381,6 +381,9 @@ export default {
    
   },
   computed: {
+    ...mapState({
+      menusBase: state => state.appSetting.menusBase,
+    }),
     getApprovalStatus(){
       return function(arg) {
         switch(arg) {
@@ -410,6 +413,15 @@ export default {
       }
       this.reloadTable()
     },
+    //判断按钮权限
+    checkButton(menuKey){
+      let btnLength = this.menusBase.filter(item => item.menuKey == menuKey)
+      if(btnLength.length>0){
+        return true;
+      }else{
+        return false;
+      }
+    },
     // 审核
     handleJumpUpdateClick(record,arg) {
       // 从知识管理跳转