<template>
    <div id="main">
        <el-aside width="100%">
            <el-menu
                :collapse="false"
                :collapse-transition="true"
                :unique-opened="true"
                :router="true"
            >
                <el-submenu v-for="item in tree" :index="item.title" :key="item.title">
                    <template slot="title">
                        <i :class="item.icon"></i>
                        <span slot="title">{{ item.title }}</span>
                    </template>
                    <el-menu-item-group v-for="sort in item.sort" :key="sort.title">
                        <template slot="title">{{ sort.title }}</template>
                        <el-menu-item
                            v-for="link in sort.link"
                            :key="link.router"
                            :index="link.router"
                        >{{ link.title }}</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </el-aside>
    </div>
</template>

<script>
export default {
    name: 'Nav',
    components: {},
    data () {
        return {
            tree: [
                {
                    title: '办公管理',
                    icon: 'el-icon-message',
                    sort: [
                        {
                            title: '通知公告',
                            link: [
                                {
                                    title: '通知公告管理',
                                    router: '/office/noticeAnnouncement/NoticeAnnouncement'
                                }
                            ]
                        },
                        {
                            title: '会议信息',
                            link: [
                                {
                                    title: '会议信息管理',
                                    router: '/office/meeting/list'
                                }
                            ]
                        },
                        {
                            title: '功能室信息',
                            link: [
                                {
                                    title: '功能室管理',
                                    router: '/office/functionRomm/list'
                                }
                            ]
                        },
                        {
                            title: '申请审批',
                            link: [
                                {
                                    title: '资产管理',
                                    router: '/office/apply/AssetManage'
                                }
                            ]
                        },
                        {
                            title: '智能通讯录',
                            link: [
                                {
                                    title: '通讯录信息',
                                    router: '/office/smartAddressList/addressList'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: '教务管理',
                    icon: 'el-icon-date',
                    sort: [
                        {
                            title: '班主任工作量化考核',
                            link: [
                                {
                                    title: '考核指标管理',
                                    router: '/education/classTeacherAssessment/assessmentIndex'
                                },
                                {
                                    title: '考评登记',
                                    router: '/education/classTeacherAssessment/assessmentRecord'
                                },
                                {
                                    title: '考核结果报表',
                                    router: '/education/classTeacherAssessment/assessmentReport'
                                }
                            ]
                        },
                        {
                            title: '教师发展系统',
                            link: [
                                {
                                    title: '教师专业发展手册',
                                    router: '/education/teacherDevelopment/manual'
                                },
                                {
                                    title: '学生考勤规则配置',
                                    router: '/studentDailySign/signRules/index'
                                }
                            ]
                        },
                        {
                            title: '班级管理',
                            link: [
                                {
                                    title: '在校表现',
                                    router: '/education/schoolPerforman/list/List'
                                }
                            ]
                        },
                        {
                            title: '班级管理',
                            link: [
                                {
                                    title: '学生荣誉档案',
                                    router: '/education/studentHonor/honorEntry/honorRecord'
                                },
                                {
                                    title: '荣誉分类管理',
                                    router: '/education/studentHonor/honorEntry/honorManage'
                                }
                            ]
                        },
                        {
                            title: '教师专业档案',
                            link: [
                                {
                                    title: '教师专业档案管理',
                                    router: '/education/teacherProfessionalArchives/professionalArchivesList'
                                },
                                {
                                    title: '专业梯次管理',
                                    router: '/education/teacherProfessionalArchives/professionalLevelEntry'
                                },
                                {
                                    title: '继续教育管理',
                                    router: '/education/teacherProfessionalArchives/continueEducationEntry'
                                },
                                {
                                    title: '我的档案',
                                    router: '/education/teacherProfessionalArchives/myProfessionalArchives'
                                }
                            ]
                        },
                        {
                            title: '德育管理',
                            link: [
                                {
                                    title: '德育设置',
                                    router: '/education/moralEducation/setting/index'
                                },
                                {
                                    title: '德育报表',
                                    router: '/education/moralEducation/report/index'
                                }
                            ]
                        },
                        {
                            title: '学生考勤',
                            link: [
                                {
                                    title: '学生考勤',
                                    router: '/education/studentAttendance/index/Index'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: '绩效管理',
                    icon: 'el-icon-star-on',
                    sort: [
                        {
                            title: '考勤管理',
                            link: [
                                {
                                    title: '考勤记录',
                                    router: '/performance/dailySign/record'
                                },
                                {
                                    title: '考勤统计',
                                    router: '/performance/dailySign/statistics'
                                },
                                {
                                    title: '考勤设置',
                                    router: '/performance/dailySign/Set'
                                }
                            ]
                        },
                        {
                            title: '教师荣誉',
                            link: [
                                {
                                    title: '我的荣誉',
                                    router: '/performance/teacherHonor/myHonor'
                                },
                                {
                                    title: '我的审核',
                                    router: '/performance/teacherHonor/myAudit'
                                },
                                {
                                    title: '教师荣誉列表',
                                    router: '/performance/teacherHonor/honorRecord'
                                },
                                {
                                    title: '荣誉分类管理',
                                    router: '/performance/teacherHonor/honorManage'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: '后勤管理',
                    icon: 'el-icon-sold-out',
                    sort: [
                        {
                            title: '来访系统(人脸版)',
                            link: [
                                {
                                    title: '来访管理',
                                    router: '/logistics/visit/visitManagement'
                                }
                            ]
                        },
                        {
                            title: '午托管理',
                            link: [
                                {
                                    title: '午托信息管理',
                                    router: '/logistics/midday/infoManagement'
                                },
                                {
                                    title: '系统设置',
                                    icon: 'el-icon-setting',
                                    sort: [{
                                        title: '用户信息',
                                        link: [
                                            {
                                                title: '家长信息管理',
                                                router: '/systemAdmin/user/parents/list'
                                            }
                                            // {
                                            // title: '学生信息管理（家长关联页）',
                                            // router: '/systemAdmin/user/student/parents/list'
                                            // }
                                        ]
                                    }]
                                },
                                {
                                    title: '午托系统设置',
                                    router: '/logistics/midday/settingManagement'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: '智慧环境',
                    icon: 'el-icon-edit',
                    sort: [
                        {
                            title: '班牌管理',
                            link: [
                                {
                                    title: '栏目管理',
                                    router: '/smartCampus/etags/columnManagement'
                                },
                                {
                                    title: '内容管理',
                                    router: '/smartCampus/etags/contentManagement'
                                },
                                {
                                    title: '设备管理',
                                    router: '/smartCampus/etags/equipmentManagement'
                                },
                                {
                                    title: '视频管理',
                                    router: '/smartCampus/etags/UploadVideo'
                                }
                            ]
                        },
                        {
                            title: '签到设备管理',
                            link: [
                                {
                                    title: '签到设备管理',
                                    router: '/smartCampus/deviceManage/sign/list'
                                }
                            ]
                        },
                        {
                            title: '告警设备管理',
                            link: [
                                {
                                    title: '告警设备管理',
                                    router: '/smartCampus/warnRecord/deviceList'
                                },
                                {
                                    title: '告警记录',
                                    router: '/smartCampus/warnRecord/index'
                                },
                                {
                                    title: '告警统计',
                                    router: '/smartCampus/warnRecord/statistics'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: '系统设置',
                    icon: 'el-icon-setting',
                    sort: [
                        {
                            title: '用户信息',
                            link: [
                                {
                                    title: '家长信息管理',
                                    router: '/systemAdmin/user/parents/list'
                                }
                                // {
                                // title: '学生信息管理（家长关联页）',
                                // router: '/systemAdmin/user/student/parents/list'
                                // }
                            ]
                        }
                    ]
                },
                {
                    title: '系统设置',
                    icon: 'el-icon-setting',
                    sort: [{
                        title: '用户信息',
                        link: [
                            {
                                title: '家长信息管理',
                                router: '/systemAdmin/user/parents/list'
                            }
                            // {
                            // title: '学生信息管理（家长关联页）',
                            // router: '/systemAdmin/user/student/parents/list'
                            // }
                        ]
                    }]
                },
                {
                    title: '公共组件demo',
                    icon: 'el-icon-setting',
                    sort: [
                        {
                            title: 'demo',
                            link: [
                                {
                                    title: '编辑器',
                                    router: '/zTestCompinents/Editor'
                                },
                                {
                                    title: '百度编辑器',
                                    router: '/zTestCompinents/UEditor'
                                },
                                {
                                    title: '画廊',
                                    router: '/zTestCompinents/Gallery'
                                },
                                {
                                    title: '上传文件',
                                    router: '/zTestCompinents/ObjectStorageService'
                                }
                                // {
                                // title: '学生信息管理（家长关联页）',
                                // router: '/systemAdmin/user/student/parents/list'
                                // }
                            ]
                        }
                    ]
                }
            ]
        }
    },
    methods: {
        getToken () {
            this.$api.loginApi
                .getToken({
                    // UserId: 'db5b70c3-16a7-4a57-b1a0-e95608d24d70',
                    // UserName: '00000000000',
                    // Password: 'F5C44C218B44B0181EA587C092CBAAE2',
                    // CompanyId: '60315ee1-a798-4e3a-9116-0c656854578d',
                    // SchoolCode: '10086',
                    // UserType: 1,
                    // RealName: '龙少'

                    // UserName: 'lanyAdmin',
                    // Password: '7A90DDBB4FC3F89D51B40D8700309FFA',
                    // UserType: 1

                    // UserName: 'Testk12',
                    // Password: 'B1C1D2FEB63AE081E30135CFDCAEE071',
                    // UserType: 1

                    // UserName: '15712111558',
                    // Password: '4E71002969FCD46813B869E931AEDF4B',
                    // UserType: 1

                    // UserId: '19f8839f-0f55-4190-a940-d3051ef3da6e',
                    // UserName: '18281626787',
                    // Password: 'E10ADC3949BA59ABBE56E057F20F883E',
                    // CompanyId: '60315ee1-a798-4e3a-9116-0c656854578d',
                    // SchoolCode: '10086',
                    // UserType: 1,
                    // RealName: '王灿'

                    // UserName: '18129846505',
                    // Password: '0EA3575CBDAFF152E66D83603E6D0644',
                    // UserType: 1,

                    UserName: '13247512049',
                    Password: '4E71002969FCD46813B869E931AEDF4B',
                    UserType: 1

                    // UserName: '18720051015',
                    // Password: 'FD44F9CA4BAB3EF1AB93D37C3E89D3F5',
                    // UserType: 1,

                    // UserName: '57557578578',
                    // Password: '6AFB376C299B00A7FBDC893F35C5B72D',
                    // UserType: 1,

                    // UserName: '15712111558',
                    // Password: '4E71002969FCD46813B869E931AEDF4B',
                    // UserType: 1

                    // UserName: 'OauthAdmin',
                    // Password: '3453EFA583AC3320339B9B8778DD81C2',
                    // UserType: 1

                    // UserName: '13424355909',
                    // Password: '8E25A526BD1808929FCF996EFC9272B4',
                    // UserType: 1

                    // UserName: '13424355909',
                    // Password: '8E25A526BD1808929FCF996EFC9272B4',
                    // UserType: 1

                    // UserName: '10075_Vschool100',
                    // Password: '90B4F9192F2459599041295A7C42B7AF',
                    // UserType: 1

                    // UserName: '10067_Vschool100',
                    // Password: '6321E8CE114D93995DFF500F3B1E2A4B',
                    // UserType: 1

                })
                .then(res => {
                    let data = res.data
                    if (data.Status) {
                        const expireTime = new Date(data.Data.expireTime).getTime()
                        this.$store.commit('saveToken', data.Data.token)
                        this.$store.commit('saveExpireTime', expireTime)
                    }
                }).catch(res => {
                    console.log(res)
                })
        }
    },
    mounted () {
        this.getToken()
    }
}
</script>

<style lang="less" scoped></style>
