filter: hide pagetype and workspace menu items for non-System User
This commit is contained in:
parent
76255f6757
commit
394f867eb1
@ -1,5 +1,6 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
import { useAuthStore } from './auth'
|
||||||
|
|
||||||
export interface AppMenuItem {
|
export interface AppMenuItem {
|
||||||
id: string
|
id: string
|
||||||
@ -163,7 +164,25 @@ export const useMenuStore = defineStore('menu', () => {
|
|||||||
persist()
|
persist()
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleItems = computed(() => items.value.filter(m => !m.hidden))
|
const visibleItems = computed(() => {
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const userType = authStore.user?.user_type
|
||||||
|
|
||||||
|
// 非 System User 用户类型不显示 pagetype 和 workspace 类型的菜单项
|
||||||
|
const isSystemUser = userType === 'System User'
|
||||||
|
|
||||||
|
return items.value.filter(m => {
|
||||||
|
// 过滤隐藏的菜单项
|
||||||
|
if (m.hidden) return false
|
||||||
|
|
||||||
|
// 非 System User 过滤掉 pagetype 和 workspace 类型
|
||||||
|
if (!isSystemUser && (m.type === 'pagetype' || m.type === 'workspace')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
items,
|
items,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user