refactor(系统设置): 开源用户可以选择关闭UI模块菜单

This commit is contained in:
CaptainB 2023-01-06 15:19:35 +08:00 committed by 刘瑞斌
parent ce1aae2e4f
commit d4e4ad9a34
1 changed files with 13 additions and 7 deletions

View File

@ -28,19 +28,13 @@
<span slot="title" class="ms-menu-item-title">{{ $t('commons.api') }}</span>
</div>
</el-menu-item>
<el-menu-item index="/ui" @click="active()" v-if="hasLicense() && check('ui')" onselectstart="return false"
<el-menu-item :index="getUiIndex()" @click="clickPlanMenu" v-if="check('ui')" onselectstart="return false"
v-permission="['PROJECT_UI_SCENARIO:READ','PROJECT_UI_REPORT:READ', 'PROJECT_UI_ELEMENT:READ']">
<div>
<svg-icon iconClass="ui" class-name="ms-menu-img"/>
<span slot="title" class="ms-menu-item-title">{{ $t('commons.ui') }}</span>
</div>
</el-menu-item>
<el-menu-item v-if="!hasLicense()" @click="clickPlanMenu">
<div>
<svg-icon iconClass="ui" class-name="ms-menu-img"/>
<span slot="title" class="ms-menu-item-title">{{ $t('commons.ui') }}</span>
</div>
</el-menu-item>
<el-menu-item index="/performance" v-if="check('performance')"
onselectstart="return false"
v-permission="['PROJECT_PERFORMANCE_HOME:READ', 'PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ']">
@ -145,9 +139,18 @@ export default {
}
},
check(key) {
if (key === 'ui' && !hasLicense()) {
return this.modules[key] === 'ENABLE';
}
let microApps = JSON.parse(sessionStorage.getItem("micro_apps"));
return this.modules[key] === 'ENABLE' && microApps && microApps[key];
},
getUiIndex() {
if (hasLicense()) {
return "ui";
}
return "";
},
registerEvents() {
getModuleList()
.then(response => {
@ -164,6 +167,9 @@ export default {
});
},
clickPlanMenu() {
if (hasLicense()) {
return true;
}
this.$message({
dangerouslyUseHTMLString: true,
showClose: true,