kongdeqiang
2023-06-08 f015ecea67a1e322374c422f6661366f93341556
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,112 +43,18 @@
<script>
    import bus from '../common/bus';
    import {mapState} from 'vuex';
    export default {
        data() {
            return {
                collapse: false,
                items: [
                  {
                    id:1,
                    icon: 'el-icon-folder-opened',
                    indexUrl: '1',
                    name: '系统管理',
                    children:[
                      {
                        id:1,
                        icon: 'el-icon-user-solid',
                        name: '人员管理',
                        parentId: 1,
                        indexUrl: 'user'
                      }
                    ]
                  },
                  {
                      id:2,
                      icon: 'el-icon-folder-opened',
                      indexUrl: '2',
                      name: '智慧泊车管理',
                      children:[
                          {
                              icon: 'el-icon-document',
                              name: '停车场管理',
                              parentId: 2,
                              indexUrl: "park"
                          },
                          {
                              icon: 'el-icon-document',
                              name: '收费规则管理',
                              parentId: 2,
                              indexUrl: "costRule"
                          },
                          {
                            icon: 'el-icon-document',
                            name: '车辆入场管理',
                            parentId: 2,
                            indexUrl: "enterPark"
                          },
                          {
                            icon: 'el-icon-document',
                            name: '车辆出场管理',
                            parentId: 2,
                            indexUrl: "outPark"
                          },
                          {
                            icon: 'el-icon-document',
                            name: '白名单管理',
                            parentId: 2,
                            indexUrl: "whiteList"
                          },
                          {
                            icon: 'el-icon-document',
                            name: '泊车发票管理',
                            parentId: 2,
                            indexUrl: "parkticket"
                          },
                          {
                            icon: 'el-icon-document',
                            name: '订单统计',
                            parentId: 2,
                            indexUrl: "orderRecord"
                          },
                      ]
                  },
                  {
                    id:3,
                    icon: 'el-icon-folder-opened',
                    indexUrl: '3',
                    name: '智慧罚没管理',
                    children:[
                      {
                        icon: 'el-icon-document',
                        name: '违章类型管理',
                        parentId: 3,
                        indexUrl: "violationType"
                      },
                      {
                        icon: 'el-icon-document',
                        name: '街道管理',
                        parentId: 3,
                        indexUrl: "street"
                      },
                      {
                        icon: 'el-icon-document',
                        name: '罚单管理',
                        parentId: 3,
                        indexUrl: "ticket"
                      },
                      {
                        icon: 'el-icon-document',
                        name: '罚没发票管理',
                        parentId: 3,
                        indexUrl: "zfticket"
                      },
                    ]
                  },
                ]
            }
        },
        computed:{
          ...mapState({
             items:'resultAsyncRoutes'
            }),
            onRoutes(){
                return this.$route.path.replace('/','');
            }
@@ -158,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>