|  |  |  | 
|---|
|  |  |  | <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>--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--</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> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import bus from '../common/bus'; | 
|---|
|  |  |  | import {mapState} from 'vuex'; | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | collapse: false, | 
|---|
|  |  |  | items: [ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id:1, | 
|---|
|  |  |  | icon: 'el-icon-user-solid', | 
|---|
|  |  |  | name: '人员管理', | 
|---|
|  |  |  | indexUrl: 'user' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id:2, | 
|---|
|  |  |  | icon: 'el-icon-place', | 
|---|
|  |  |  | 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-checked', | 
|---|
|  |  |  | name: '白名单', | 
|---|
|  |  |  | indexUrl: 'whiteList' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id:7, | 
|---|
|  |  |  | icon: 'el-icon-s-fold', | 
|---|
|  |  |  | name: '街道管理', | 
|---|
|  |  |  | indexUrl: 'street' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | id:8, | 
|---|
|  |  |  | icon: 'el-icon-document', | 
|---|
|  |  |  | name: '收费规则管理', | 
|---|
|  |  |  | indexUrl: 'costRule' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     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('/',''); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  |  | 
|---|