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

315 lines
8.8 KiB
Vue

<template>
<div class="sidebar">
<el-menu
:default-active="activeIndex"
class="sidebar-el-menu"
mode="horizontal"
@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>
</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,
activeIndex: "/realTimeMonitor",
items: [
// {
// icon: "el-icon-s-home",
// index: "stritl",
// title: "系统首页",
// },
{
icon: "el-icon-camera",
index: "realTimeMonitor",
title: "实时监控",
},
{
icon: "el-icon-setting",
index: "devicePhotoSchedule",
title: "拍照时间表设置",
},
{
icon: "el-icon-coin",
index: "cameraChannel",
title: "通道管理",
},
{
icon: "el-icon-picture-outline",
index: "imageSettings",
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: '历史公告'
// }
// ]
// }
// ]
// }
],
};
},
mounted() {
this.activeIndex = sessionStorage.getItem("keyPath") || "/realTimeMonitor";
},
watch: {
activeIndex(newValue) {
if (newValue != this.$route.path) {
this.activeIndex = this.$route.path;
}
},
},
methods: {
handleSelect(keyPath) {
sessionStorage.setItem("keyPath", keyPath);
},
},
};
</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;
}
}
}
}
</style>