refactor: 更多操作按钮权限样式

This commit is contained in:
chenjianxing 2021-07-13 16:38:57 +08:00 committed by jianxing
parent 1eb9dd75b2
commit 211348c6af
3 changed files with 9 additions and 3 deletions

View File

@ -114,16 +114,17 @@
},
{
label: this.$t('report.export'),
permissions: ['PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO'],
children: [
{
label: this.$t('report.export_to_ms_format'),
permissions: ['PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO'],
callback: () => {
this.$emit('exportAPI');
}
},
{
label: this.$t('report.export') + 'JMETER 格式',
permissions: ['PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO'],
callback: () => {
this.$emit('exportJmx');
}

View File

@ -74,10 +74,10 @@ export default {
},
{
label: this.$t('report.export'),
permissions: ['PROJECT_API_DEFINITION:READ+EXPORT_API'],
children: [
{
label: this.$t('report.export_to_ms_format'),
permissions: ['PROJECT_API_DEFINITION:READ+EXPORT_API'],
callback: () => {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
@ -88,6 +88,7 @@ export default {
},
{
label: this.$t('report.export_to_swagger3_format'),
permissions: ['PROJECT_API_DEFINITION:READ+EXPORT_API'],
callback: () => {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));

View File

@ -20,7 +20,8 @@
</span>
<el-dropdown-menu slot="dropdown">
<template>
<el-dropdown-item v-for="(child, index) in item.children" :key="index" @click.native.stop="click(child)">
<el-dropdown-item v-for="(child, index) in item.children" :key="index" @click.native.stop="click(child)"
:disabled="disabled(child.permissions)">
<span class="tip-font">
{{child.label}}
</span>
@ -71,6 +72,9 @@ export default {
}
},
disabled(permissions) {
if (!permissions) {
return false;
}
return !hasPermissions(...permissions);
}
}