Browse Source

修改审批页面按钮权限

zhangli 1 year ago
parent
commit
a96f5c149f

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

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

+ 1 - 0
src/utils/routerUtil.js

@@ -58,6 +58,7 @@ export const generatorDynamicRouter = () => {
                 routers: routers,
                 routers: routers,
                 menuMap: menuMap,
                 menuMap: menuMap,
                 buttons: buttons,
                 buttons: buttons,
+                menusBase: res.data.menus,
                 user: res.data.user,
                 user: res.data.user,
                 allButtons: res.data.allMenuButtons
                 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>
                     <a-button type="primary" @click="handleSearchClick">查询</a-button>
                   </div>
                   </div>
                 </a-form>
                 </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>
             </div>
           </div>
           </div>
@@ -115,11 +115,11 @@
              <!-- isAudit 0能审核 1不能审核 -->
              <!-- isAudit 0能审核 1不能审核 -->
             <template v-if="($route.query.showUnchecked ? true : record.isAudit == 0) && (record.approvalStatus == 1 || record.approvalStatus == 3)" >
             <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" > -->
             <!-- <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>
             <template v-else>
             <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>
           </template>
           </template>
         </rx-grid>
         </rx-grid>
@@ -172,6 +172,7 @@ import classApi from '@/api/knowledge/classify'
 import { getCategory } from '../aJs/getClassifyTree'
 import { getCategory } from '../aJs/getClassifyTree'
 import mixin from "../aMixin/mixin"
 import mixin from "../aMixin/mixin"
 import initMixin from "../aMixin/initMixin"
 import initMixin from "../aMixin/initMixin"
+import {mapState} from "vuex";
 const auditMixin = new mixin('audit')
 const auditMixin = new mixin('audit')
 export default {
 export default {
   name: 'auditManageList',
   name: 'auditManageList',
@@ -360,7 +361,6 @@ export default {
   },
   },
   mounted() {
   mounted() {
     let innerWidth = window.innerWidth
     let innerWidth = window.innerWidth
-
     // 计算
     // 计算
     setTimeout(() => {
     setTimeout(() => {
       let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
       let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
@@ -381,6 +381,9 @@ export default {
    
    
   },
   },
   computed: {
   computed: {
+    ...mapState({
+      menusBase: state => state.appSetting.menusBase,
+    }),
     getApprovalStatus(){
     getApprovalStatus(){
       return function(arg) {
       return function(arg) {
         switch(arg) {
         switch(arg) {
@@ -410,6 +413,15 @@ export default {
       }
       }
       this.reloadTable()
       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) {
     handleJumpUpdateClick(record,arg) {
       // 从知识管理跳转
       // 从知识管理跳转