perf: 任务进度只对有权限者可见

This commit is contained in:
jmal 2025-05-06 18:02:46 +08:00
parent 90508e97ee
commit 766ea645c6
2 changed files with 13 additions and 1 deletions

View File

@ -9,7 +9,7 @@
width="600"
trigger="hover">
<TaskProgress :task-count.sync="taskCount"/>
<div slot="reference" class="right-content-button" v-show="showTaskProgress > 0 || taskCount > 0">
<div slot="reference" class="right-content-button" v-show="hasTaskProgressRole && (showTaskProgress > 0 || taskCount > 0)">
<svg-icon icon-class="gengxinjindu" :class="progressExecuting ? 'rotate' : ''"></svg-icon>
{{ $t('app.taskProgress') }}
</div>
@ -112,6 +112,9 @@ export default {
routes.rightTopRoutes = rightTopRoutes
return routes
},
hasTaskProgressRole() {
return localStorage.getItem('taskProgressRole') === '1'
}
},
mounted() {
this.isShow = this.$pc;

View File

@ -88,7 +88,16 @@ const actions = {
async setMenuList({ commit, state }) {
return new Promise( (resolve,reject) => {
menuApi.menuTree({userId: state.userId}).then((res) => {
const index = res.data.findIndex((item) => item.path === '/setting/taskProgress')
if (index > -1) {
localStorage.setItem('taskProgressRole', "1")
} else {
localStorage.removeItem('taskProgressRole')
}
state.menuList = getMenuTree(res.data);
console.log('state.menuList', state.menuList)
commit('SET_MENU_LIST', state.menuList);
resetRouter(state.menuList)
router.options.routes = router.options.routes.concat(state.menuList);