多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
1.3 KiB

<script setup lang="ts">
import type { ComputedRef } from 'vue'
interface Tab {
title: string
label: string
isUIAllowed: ComputedRef<boolean>
}
const { t } = useI18n()
const { isUIAllowed } = useRoles()
const tabsInfo: Tab[] = [
{
title: 'Users Management',
label: t('title.userMgmt'),
isUIAllowed: computed(() => isUIAllowed('userMgmtTab')),
},
{
title: 'API Token Management',
label: t('title.apiTokenMgmt'),
isUIAllowed: computed(() => isUIAllowed('apiTokenTab')),
},
]
const selectedTabKey = ref(0)
const selectedTab = computed(() => tabsInfo[selectedTabKey.value])
</script>
<template>
<div v-if="selectedTab.isUIAllowed">
<a-tabs v-model:active-key="selectedTabKey" :open-keys="[]" mode="horizontal" class="nc-auth-tabs !mx-6">
<a-tab-pane v-for="(tab, key) of tabsInfo" :key="key" class="select-none">
<template #tab>
<span>
{{ tab.label }}
</span>
</template>
</a-tab-pane>
</a-tabs>
<div class="mx-4 py-6 mt-2">
<template v-if="selectedTabKey === 0">
<LazyTabsAuthUserManagement />
</template>
<template v-else>
<LazyTabsAuthApiTokenManagement />
</template>
</div>
</div>
</template>
<style scoped>
:deep(.nc-auth-tabs .ant-tabs-nav::before) {
@apply !border-none;
}
</style>