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

184 lines
4.4 KiB
Vue

2 years ago
<template>
<div class="sidebar">
<el-menu
2 years ago
:default-active="activeIndex"
class="sidebar-el-menu"
mode="horizontal"
2 years ago
@select="handleSelect"
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>
2 years ago
</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>
2 years ago
</template>
<script>
export default {
data() {
return {
2 years ago
activeIndex: "/realTimeMonitor",
items: [
2 years ago
{
icon: "el-icon-s-home",
index: "stritl",
title: "首页",
},
{
icon: "el-icon-camera",
index: "realTimeMonitor",
title: "实时监控",
},
2 years ago
2 years ago
{
2 years ago
icon: "el-icon-film",
index: "pictureRotation",
title: "图片轮巡",
2 years ago
},
2 years ago
{
2 years ago
icon: "el-icon-bell",
index: "photoAlarm",
title: "告警处理",
2 years ago
},
2 years ago
2 years ago
{
2 years ago
icon: "el-icon-search",
index: "realTimeSearch",
title: "实时查询",
2 years ago
},
{
icon: "el-icon-files",
2 years ago
index: "property",
title: "资产管理",
subs: [
{
2 years ago
index: "lineInformation",
title: "线路信息管理",
},
{
index: "towerInformation",
title: "杆塔信息管理",
},
{
index: "photographicDevice",
title: "拍照装置管理",
},
2 years ago
{
icon: "el-icon-coin",
index: "cameraChannel",
title: "通道管理",
},
{
icon: "el-icon-setting",
index: "devicePhotoSchedule",
title: "拍照时间表设置",
},
{
icon: "el-icon-picture-outline",
index: "imageSettings",
title: "图像采集参数设置",
},
],
},
{
icon: "el-icon-monitor",
index: "system",
title: "系统管理",
subs: [
{
2 years ago
index: "userManagement",
title: "用户管理",
},
],
},
],
};
},
2 years ago
mounted() {
this.activeIndex = sessionStorage.getItem("keyPath") || "/realTimeMonitor";
},
watch: {
activeIndex(newValue) {
2 years ago
if (newValur != this.$route.path) {
2 years ago
this.activeIndex = this.$route.path;
}
2 years ago
},
},
2 years ago
methods: {
handleSelect(keyPath) {
sessionStorage.setItem("keyPath", keyPath);
},
},
2 years ago
};
</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: @color-text-secondary;
}
.el-menu-item.is-active {
i {
color: @color-primary;
}
}
.el-submenu.is-active .el-submenu__title > i {
&:first-child {
color: @color-primary;
}
2 years ago
}
}
2 years ago
}
</style>