fix(项目设置): 二级菜单显示优化
--bug=1018141 --user=李玉号 【项目设置】仅项目成员权限的用户登录系统-项目设置tab页显示优化 https://www.tapd.cn/55049933/s/1266075
This commit is contained in:
parent
43a96032b9
commit
7961522b8e
|
@ -23,7 +23,54 @@
|
||||||
popper-class="submenu">
|
popper-class="submenu">
|
||||||
{{ $t('project.file_manage') }}
|
{{ $t('project.file_manage') }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-submenu index="2">
|
<el-menu-item
|
||||||
|
:index="'/project/errorreportlibrary'"
|
||||||
|
v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ']"
|
||||||
|
v-xpack
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t("error_report_library.name") }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
index="/project/template"
|
||||||
|
v-permission="['PROJECT_TEMPLATE:READ']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t('workspace.template_manage') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
:index="'/project/messagesettings'"
|
||||||
|
v-permission="['PROJECT_MESSAGE:READ']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t("organization.message_settings") }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
:index="'/project/log'"
|
||||||
|
popper-class="submenu"
|
||||||
|
v-permission="['PROJECT_OPERATING_LOG:READ']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t('project.log') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
v-xpack
|
||||||
|
:index="'/project/version'"
|
||||||
|
v-permission="['PROJECT_VERSION:READ']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t('project.version_manage') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
:index="'/project/app'"
|
||||||
|
popper-class="submenu"
|
||||||
|
v-permission="['PROJECT_APP_MANAGER:READ+EDIT']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t('project.app_manage') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item
|
||||||
|
:index="'/project/code/segment'"
|
||||||
|
popper-class="submenu"
|
||||||
|
v-permission="['PROJECT_CUSTOM_CODE:READ']"
|
||||||
|
v-if="showMenu">
|
||||||
|
{{ $t('project.code_segment.code_segment') }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-submenu index="2" v-if="!showMenu">
|
||||||
<template slot="title">{{ $t('commons.report_statistics.report_filter.more_options') }}</template>
|
<template slot="title">{{ $t('commons.report_statistics.report_filter.more_options') }}</template>
|
||||||
<el-menu-item :index="'/project/errorreportlibrary'" v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ']"
|
<el-menu-item :index="'/project/errorreportlibrary'" v-permission="['PROJECT_ERROR_REPORT_LIBRARY:READ']"
|
||||||
v-xpack>
|
v-xpack>
|
||||||
|
@ -68,6 +115,7 @@ import ProjectSwitch from "metersphere-frontend/src/components/head/ProjectSwitc
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import MsHeaderRightMenus from "metersphere-frontend/src/components/layout/HeaderRightMenus";
|
import MsHeaderRightMenus from "metersphere-frontend/src/components/layout/HeaderRightMenus";
|
||||||
import {PROJECT_NAME} from "metersphere-frontend/src/utils/constants";
|
import {PROJECT_NAME} from "metersphere-frontend/src/utils/constants";
|
||||||
|
import {hasPermission} from "metersphere-frontend/src/utils/permission";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProjectHeaderMenus",
|
name: "ProjectHeaderMenus",
|
||||||
|
@ -76,8 +124,31 @@ export default {
|
||||||
return {
|
return {
|
||||||
currentProject: sessionStorage.getItem(PROJECT_NAME),
|
currentProject: sessionStorage.getItem(PROJECT_NAME),
|
||||||
pathName: '',
|
pathName: '',
|
||||||
|
showMenu: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
let menuCount = 0;
|
||||||
|
let permissions = [
|
||||||
|
'PROJECT_APP_MANAGER:READ+EDIT',
|
||||||
|
'PROJECT_MESSAGE:READ',
|
||||||
|
'PROJECT_OPERATING_LOG:READ',
|
||||||
|
'PROJECT_CUSTOM_CODE:READ',
|
||||||
|
'PROJECT_TEMPLATE:READ',
|
||||||
|
'PROJECT_VERSION:READ',
|
||||||
|
'PROJECT_ERROR_REPORT_LIBRARY:READ',
|
||||||
|
];
|
||||||
|
for (let permission of permissions) {
|
||||||
|
// 更多选项中菜单数量小于3个时,不显示更多选项
|
||||||
|
if (menuCount >= 3) {
|
||||||
|
this.showMenu = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (hasPermission(permission)) {
|
||||||
|
menuCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route': {
|
'$route': {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|
|
@ -375,7 +375,7 @@ export default {
|
||||||
this.handleResourceOption(queryString ? this.sourceDataCopy.filter(this.createFilter(queryString)) : this.sourceDataCopy);
|
this.handleResourceOption(queryString ? this.sourceDataCopy.filter(this.createFilter(queryString)) : this.sourceDataCopy);
|
||||||
},
|
},
|
||||||
createFilter(queryString) {
|
createFilter(queryString) {
|
||||||
return item => (item.name.toLowerCase().indexOf(queryString.toLowerCase()) !== -1);
|
return item => (item.name && item.name.toLowerCase().indexOf(queryString.toLowerCase()) !== -1);
|
||||||
},
|
},
|
||||||
resetUserOption(val) {
|
resetUserOption(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
|
Loading…
Reference in New Issue