|
|
|
|
@ -37,7 +37,7 @@
|
|
|
|
|
<!-- <view class="module-icon" :style="{ background: getModuleColor(moduleIndex) }">
|
|
|
|
|
<text class="icon-text">{{ getMenuSymbol(module.name, moduleIndex) }}</text>
|
|
|
|
|
</view> -->
|
|
|
|
|
<text class="module-title">{{ translateLiteral(module.name) }}</text>
|
|
|
|
|
<text class="module-title">{{ getDisplayName(module) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="function-grid">
|
|
|
|
|
@ -60,9 +60,9 @@
|
|
|
|
|
size="24"
|
|
|
|
|
:color="getModuleColor(moduleIndex)"
|
|
|
|
|
></u-icon>
|
|
|
|
|
<text v-else class="icon-inner">{{ getMenuSymbol(entry.name, entryIndex) }}</text>
|
|
|
|
|
<text v-else class="icon-inner">{{ getMenuSymbol(getDisplayName(entry), entryIndex) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<text class="function-name">{{ translateLiteral(entry.name) }}</text>
|
|
|
|
|
<text class="function-name">{{ getDisplayName(entry) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -77,10 +77,10 @@
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
import AppEmptyState from '@/components/common/AppEmptyState.vue'
|
|
|
|
|
import { translateLiteral } from '@/locales'
|
|
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
|
|
import { buildPageModules, findTabMenuByPage, getMenuSymbol, getModuleColor, resolveMenuUrl } from '@/utils/permissionMenu'
|
|
|
|
|
import { buildPageModules, findTabMenuByPage, getLocalizedMenuName, getMenuSymbol, getModuleColor, resolveMenuUrl } from '@/utils/permissionMenu'
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
pagePath: {
|
|
|
|
|
@ -118,6 +118,7 @@ const props = defineProps({
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const { locale } = useI18n()
|
|
|
|
|
const menuSearchKeyword = ref('')
|
|
|
|
|
const scrollTop = ref(0)
|
|
|
|
|
const currentScrollTop = ref(0)
|
|
|
|
|
@ -138,11 +139,11 @@ const filteredModules = computed(() => {
|
|
|
|
|
.map((module) => ({
|
|
|
|
|
...module,
|
|
|
|
|
children: (module.children || []).filter((entry) => {
|
|
|
|
|
const target = `${module.name}|${entry.name}`.toLowerCase()
|
|
|
|
|
const target = `${getDisplayName(module)}|${getDisplayName(entry)}`.toLowerCase()
|
|
|
|
|
return target.includes(keyword)
|
|
|
|
|
})
|
|
|
|
|
}))
|
|
|
|
|
.filter((module) => (module.children || []).length > 0 || String(module.name || '').toLowerCase().includes(keyword))
|
|
|
|
|
.filter((module) => (module.children || []).length > 0 || getDisplayName(module).toLowerCase().includes(keyword))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const hasMenuPermission = computed(() => modules.value.length > 0)
|
|
|
|
|
@ -209,16 +210,22 @@ function getUviewIconName(icon) {
|
|
|
|
|
return String(icon || '').replace(/^uview-plus:/, '').trim()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDisplayName(menu) {
|
|
|
|
|
locale.value
|
|
|
|
|
return getLocalizedMenuName(menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleClick(menu) {
|
|
|
|
|
const url = resolveMenuUrl(menu)
|
|
|
|
|
console.log('[PermissionMenu] 点击菜单:', menu?.name, '| _splitKey:', menu?._splitKey, '| 路由:', url)
|
|
|
|
|
const displayName = getDisplayName(menu)
|
|
|
|
|
console.log('[PermissionMenu] 点击菜单:', displayName, '| _splitKey:', menu?._splitKey, '| 路由:', url)
|
|
|
|
|
if (url) {
|
|
|
|
|
uni.navigateTo({ url })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: `暂未配置${menu?.name || '该菜单'}页面`,
|
|
|
|
|
title: `暂未配置${displayName || '该菜单'}页面`,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|