import { computed, ref } from 'vue'

//全部菜单
export const menuList = [
    { id: 1, name: '信息通报', icon: 'xxtb', group: '技术支援', count: 12, home: true },
    { id: 2, name: '机队状态', icon: 'jdzt', group: '技术支援', count: 0, home: true },
    { id: 3, name: '支援申请', icon: 'zysq', group: '技术支援', count: 0, home: true },
    { id: 4, name: '工作指令', icon: 'gzzl', group: '技术支援', count: 0, home: true },
    { id: 5, name: '技术评估', icon: 'jspg', group: '技术支援', count: 0, home: true },
    { id: 6, name: '运行调查', icon: 'yxdc', group: '维修控制', count: 0, home: true },
    { id: 7, name: '运行决策', icon: 'yxjc', group: '维修控制', count: 0, home: true },
    { id: 8, name: '布置工作', icon: 'bzgz', group: '维修控制', count: 0, home: true },
    { id: 9, name: '航站管理', icon: 'hzgl', group: '航站管理', count: 0, home: true },
    { id: 10, name: '协议单位', icon: 'xydw', group: '航站管理', count: 0, home: true },
    { id: 11, name: '不正常事件', icon: 'bzcsj', group: '运行品质', count: 0, home: false },
    { id: 12, name: '考核记录', icon: 'khjl', group: '运行品质', count: 0, home: false },
    { id: 13, name: 'AOG任务', icon: 'AOG', group: '运行品质', count: 0, home: false },
    { id: 14, name: 'MCO', icon: 'MCO', group: '运行品质', count: 0, home: false },
    { id: 15, name: '航班保障', icon: 'hbbz', group: '运行品质', count: 0, home: false }
]
export const allMenuItem = { id: 999, name: '全部菜单', icon: 'all', group: '', count: 0, home: true }
//获取首页菜单
export const menuListHome = computed(() => {
    return menuList.filter((item) => item.home)
})
//获取除首页菜单
export const menuListNoHome = computed(() => {
    return menuList.filter((item) => !item.home)
})
//获取分组菜单
export const menuListGroup = computed(() => {
    return menuList.reduce((groups, item) => {
        // 如果该组不存在，则创建一个新组
        if (!groups[item.group]) {
            groups[item.group] = []
        }
        // 将当前项添加到对应的组中
        groups[item.group].push(item)
        return groups
    }, {})
})
