You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/components/common/Sidebar.vue

279 lines
10 KiB
Vue

2 years ago
<template>
<div class="sidebar">
<el-menu :default-active="onRoutes" class="sidebar-el-menu" mode="horizontal" router>
<template v-for="item in items">
<template v-if="item.subs">
<el-submenu :index="item.index" :key="item.index">
<template slot="title">
<i :class="item.icon"></i>
<span slot="title">{{ item.title }}</span>
</template>
<template v-for="subItem in item.subs">
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
<template slot="title">{{ subItem.title }}</template>
<el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">{{
threeItem.title
}}</el-menu-item>
</el-submenu>
<el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item>
</template>
</el-submenu>
</template>
<template v-else>
<el-menu-item :index="item.index" :key="item.index">
<i :class="item.icon"></i>
<span slot="title">{{ item.title }}</span>
</el-menu-item>
</template>
</template>
</el-menu>
</div>
</template>
<script>
import bus from '../common/bus';
export default {
data() {
return {
//collapse: false,
items: [
{
icon: 'el-icon-s-home',
index: 'stritl',
title: '系统首页'
},
{
icon: 'el-icon-camera',
index: 'realTimeMonitor',
title: '实时监控'
},
{
icon: 'el-icon-film',
index: 'pictureRotation',
title: '图片轮巡'
},
// {
// icon: 'el-icon-video-camera',
// index: '3',
// title: '视频监控',
// subs: [
// {
// index: 'videoMonitor',
// title: '监控视频'
// },
// {
// index: 'videoHistory',
// title: '视频回放'
// }
// ]
// }
// {
// icon: 'el-icon-warning-outline',
// index: 'dashboard',
// title: '预警处理'
// },
{
icon: 'el-icon-bell',
index: 'photoAlarm',
title: '告警处理'
},
// {
// icon: 'el-icon-setting',
// index: '6',
// title: '策略配置',
// subs: [
// {
// index: '6-1',
// title: '装置规则配置',
// subs: [
// {
// index: 'form',
// title: '监拍规则管理'
// },
// {
// index: 'form',
// title: '白名单管理'
// },
// {
// index: 'form',
// title: '公司采集配置'
// }
// ]
// },
// {
// index: '6-2',
// title: '分析策略设置',
// subs: [
// {
// index: 'form',
// title: '非告警区域设置'
// }
// ]
// },
// {
// index: '6-3',
// title: 'I1参数配置',
// subs: [
// {
// index: 'form',
// title: '拍照时间表设置'
// },
// {
// index: 'form',
// title: 'OSD参数配置'
// }
// ]
// }
// ]
// },
{
icon: 'el-icon-files',
index: '7',
title: '资产管理',
subs: [
{
index: '7-1',
title: '用户设备',
subs: [
{
index: 'lineInformation',
title: '线路信息管理'
},
{
index: 'towerInformation',
title: '杆塔信息管理'
},
{
index: 'towerTeam',
title: '杆塔班组用户'
},
{
index: 'groupInformation',
title: '分组信息管理'
},
{
index: 'form',
title: '线路属性分组'
},
{
index: 'form',
title: '隐患类型管理'
},
{
index: 'form',
title: '装置型号信息'
}
]
},
{
index: '7-2',
title: '监测设备',
subs: [
{
index: 'SIMCard',
title: 'SIM卡管理'
},
{
index: 'photographicDevice',
title: '拍照装置管理'
},
{
index: 'deviceVisualization',
title: '装置分布可视化'
}
]
}
]
}
// {
// icon: 'el-icon-monitor',
// index: '8',
// title: '系统管理',
// subs: [
// {
// index: '8-1',
// title: '权限配置',
// subs: [
// {
// index: 'form',
// title: '组织管理'
// },
// {
// index: 'form',
// title: '角色管理'
// },
// {
// index: 'form',
// title: '用户管理'
// }
// ]
// },
// {
// index: '8-2',
// title: '公告管理',
// subs: [
// {
// index: 'form',
// title: '发布公告'
// },
// {
// index: 'form',
// title: '历史公告'
// }
// ]
// }
// ]
// }
]
};
},
computed: {
onRoutes() {
return this.$route.path.replace('/', '');
}
},
created() {
// 通过 Event Bus 进行组件间通信,来折叠侧边栏
// bus.$on('collapse', (msg) => {
// this.collapse = msg;
// bus.$emit('collapse-content', msg);
// });
}
};
</script>
<style lang="less">
.sidebar {
float: left;
.el-menu--horizontal {
.el-menu-item {
height: 70px;
line-height: 70px;
}
.el-submenu .el-submenu__title {
height: 70px;
line-height: 70px;
}
.el-dropdown-menu__item,
.el-menu-item,
.el-submenu__title {
font-size: 16px;
}
.el-menu-item i {
color: #bfcbd9;
}
.el-menu-item.is-active {
i {
color: #20a0ff;
}
}
.el-submenu.is-active .el-submenu__title > i {
&:first-child {
color: #20a0ff;
}
}
}
}
</style>