kongdeqiang
2023-06-08 23cade0714cf5728fe46583415ed0dd744f98695
src/components/common/Sidebar.vue
@@ -1,14 +1,16 @@
<template>
    <div class="sidebar">
        <el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router>
            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router
            >
            <template v-for="item in items">
                <template v-if="item.children">
                    <el-submenu :index="item.indexUrl" :key="item.indexUrl">
                    <el-submenu :index="item.indexUrl" :key="item.indexUrl"
                    >
                        <template slot="title">
                            <i :class="item.icon"></i><span slot="title">{{ item.name }}</span>
                        </template>
                        <template v-for="subItem in item.children">
                        <div v-for="subItem in item.children" :key="subItem.indexUrl">
                            <!--<el-submenu v-if="subItem.children" :index="subItem.indexUrl" :key="subItem.indexUrl">-->
                                <!--<template slot="title">-->
                                    <!--<i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>-->
@@ -19,12 +21,12 @@
                                    <!--</template>-->
                                <!--</el-menu-item>-->
                            <!--</el-submenu>-->
                            <el-menu-item :index="subItem.indexUrl" :key="subItem.indexUrl">
                            <el-menu-item :index="subItem.indexUrl">
                                <template slot="title">
                                    <i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>
                                </template>
                            </el-menu-item>
                        </template>
                        </div>
                    </el-submenu>
                </template>
                <template v-else>
@@ -41,77 +43,18 @@
<script>
    import bus from '../common/bus';
    import {mapState} from 'vuex';
    export default {
        data() {
            return {
                collapse: false,
                items: [
                    {
                        id:1,
                        icon: 'el-icon-document',
                        name: '人员管理',
                        indexUrl: 'user'
                    },
                    {
                        id:2,
                        icon: 'el-icon-document',
                        name: '停车场管理',
                        indexUrl: 'park'
                    },
                    {
                        id:3,
                        icon: 'el-icon-document',
                        name: '违章类型管理',
                        indexUrl: 'violationType'
                    },
                    // {
                    //     id:4,
                    //     icon: 'el-icon-document',
                    //     name: '订单管理',
                    //     indexUrl: 'outPark'
                    // },
                    // {
                    //     id:5,
                    //     icon: 'el-icon-document',
                    //     name: '罚单管理',
                    //     indexUrl: 'ticket'
                    // },
                    {
                        id:6,
                        icon: 'el-icon-document',
                        name: '白名单',
                        indexUrl: 'whiteList'
                    },
                    {
                        id:7,
                        icon: 'el-icon-document',
                        name: '街道管理',
                        indexUrl: 'street'
                    },
                    // {
                    //     id:3,
                    //     icon: 'el-icon-folder-opened',
                    //     indexUrl: '2',
                    //     name: '统计报表',
                    //     children:[
                    //         {
                    //             icon: 'el-icon-document',
                    //             name: '普通员工月度评价',
                    //             parentId: 3,
                    //             indexUrl: "puTongYuanGongStatistic"
                    //         },
                    //         {
                    //             icon: 'el-icon-document',
                    //             name: '职能部门评价结果',
                    //             parentId: 3,
                    //             indexUrl: "leaderStatistic"
                    //         }
                    //     ]
                    // }
                ]
            }
        },
        computed:{
          ...mapState({
             items:'resultAsyncRoutes'
            }),
            onRoutes(){
                return this.$route.path.replace('/','');
            }
@@ -123,11 +66,15 @@
            })
        },
        mounted(){
            // type 2 : all
            // type 0 :  泊车 id:2
            // type 1 :  执法 id:3
            // var url = this.$systemconfig.basePath + '/menuList';
            // this.$byutil.postData(this,url,{},res=>{
            //     this.items = res.obj.menuList;
            // })
        }
        },
    }
</script>