| | |
| | | import MenuDialog from './modules/menu-dialog.vue' |
| | | |
| | | import { formatMenuTitle } from '@/utils/router' |
| | | import ArtSvgIcon from '@/components/core/base/art-svg-icon/index.vue' |
| | | import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue' |
| | | import { useTableColumns } from '@/hooks/core/useTableColumns' |
| | | import { fetchGetMenuList } from '@/api/system-manage' |
| | |
| | | if (row.meta?.link) return '外链' |
| | | return '未知' |
| | | } |
| | | const getMenuDisplayTitle = (row) => { |
| | | const titleKey = row.meta?.title || row.name || '' |
| | | const normalizedTitleKey = |
| | | titleKey && !String(titleKey).includes('.') ? `menu.${titleKey}` : titleKey |
| | | return formatMenuTitle(normalizedTitleKey) |
| | | } |
| | | const getMenuDisplayIcon = (row) => row.meta?.icon || row.icon || '' |
| | | const { columnChecks, columns } = useTableColumns(() => [ |
| | | { |
| | | prop: 'meta.icon', |
| | | label: '图标预览', |
| | | width: 96, |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | const icon = getMenuDisplayIcon(row) |
| | | |
| | | if (!icon) return h('span', { class: 'text-g-400' }, '-') |
| | | |
| | | return h('div', { class: 'flex items-center justify-center' }, [ |
| | | h(ArtSvgIcon, { icon, class: 'text-base text-g-700' }) |
| | | ]) |
| | | } |
| | | }, |
| | | { |
| | | prop: 'meta.title', |
| | | label: '菜单名称', |
| | | minWidth: 120, |
| | | formatter: (row) => formatMenuTitle(row.meta?.title) |
| | | formatter: (row) => getMenuDisplayTitle(row) |
| | | }, |
| | | { |
| | | prop: 'type', |
| | |
| | | }) |
| | | } |
| | | const searchMenu = (items) => { |
| | | const results = [] |
| | | const results = [] |
| | | for (const item of items) { |
| | | const searchName = appliedFilters.name?.toLowerCase().trim() || '' |
| | | const searchRoute = appliedFilters.route?.toLowerCase().trim() || '' |
| | | const menuTitle = formatMenuTitle(item.meta?.title || '').toLowerCase() |
| | | const menuTitle = getMenuDisplayTitle(item).toLowerCase() |
| | | const menuPath = (item.path || '').toLowerCase() |
| | | const nameMatch = !searchName || menuTitle.includes(searchName) |
| | | const routeMatch = !searchRoute || menuPath.includes(searchRoute) |