2026-05-15 18:18:51 +08:00
|
|
|
<template>
|
|
|
|
|
<div :class="['sidebar-container', { 'is-collapse': !sidebar.opened }]">
|
|
|
|
|
<div class="sidebar-header">
|
|
|
|
|
<div class="logo-wrapper">
|
|
|
|
|
<span class="logo-icon">📊</span>
|
2026-05-19 17:56:44 +08:00
|
|
|
<span v-show="sidebar.opened" class="logo-text">数据大屏</span>
|
2026-05-15 18:18:51 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<el-scrollbar class="sidebar-scroll">
|
|
|
|
|
<el-menu
|
|
|
|
|
:default-active="activeMenu"
|
|
|
|
|
:collapse="!sidebar.opened"
|
2026-05-17 17:24:43 +08:00
|
|
|
:collapse-transition="false"
|
2026-05-15 18:18:51 +08:00
|
|
|
mode="vertical"
|
|
|
|
|
class="sidebar-menu"
|
|
|
|
|
router
|
|
|
|
|
unique-opened
|
|
|
|
|
>
|
2026-05-19 17:56:44 +08:00
|
|
|
<el-menu-item v-for="item in menuItems" :key="item.path" :index="item.path">
|
|
|
|
|
<el-icon :size="14"><component :is="getIcon(item.meta?.icon)" /></el-icon>
|
|
|
|
|
<span>{{ item.meta?.title }}</span>
|
|
|
|
|
</el-menu-item>
|
2026-05-15 18:18:51 +08:00
|
|
|
</el-menu>
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
import { useStore } from 'vuex'
|
2026-05-19 17:56:44 +08:00
|
|
|
import { Monitor, PieChart, Document, Bell } from '@element-plus/icons-vue'
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const store = useStore()
|
|
|
|
|
|
|
|
|
|
const sidebar = computed(() => store.state.app.sidebar)
|
|
|
|
|
const activeMenu = computed(() => route.path)
|
|
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
const iconMap = {
|
|
|
|
|
'monitor': Monitor,
|
|
|
|
|
'order': Document,
|
|
|
|
|
'cost': PieChart,
|
|
|
|
|
'energy': Monitor,
|
2026-05-19 17:56:44 +08:00
|
|
|
'oee': PieChart,
|
2026-05-17 17:24:43 +08:00
|
|
|
'output': PieChart,
|
2026-05-19 17:56:44 +08:00
|
|
|
'stop': Bell
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getIcon = (iconName) => {
|
|
|
|
|
return iconMap[iconName] || Monitor
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-15 18:18:51 +08:00
|
|
|
const menuItems = [
|
2026-05-19 17:56:44 +08:00
|
|
|
{ path: '/dashboard/order', meta: { title: '订单大屏', icon: 'order' } },
|
|
|
|
|
{ path: '/dashboard/cost', meta: { title: '成本大屏', icon: 'cost' } },
|
|
|
|
|
{ path: '/dashboard/energy', meta: { title: '能源大屏', icon: 'energy' } },
|
|
|
|
|
{ path: '/dashboard/oee', meta: { title: 'OEE综合大屏', icon: 'oee' } },
|
|
|
|
|
{ path: '/dashboard/output', meta: { title: '产出监控大屏', icon: 'output' } },
|
|
|
|
|
{ path: '/dashboard/stop-analysis', meta: { title: '停机分析大屏', icon: 'stop' } },
|
2026-05-25 18:12:10 +08:00
|
|
|
{ path: '/dashboard/acid-rolling', meta: { title: '酸轧数据大屏', icon: 'example' } },
|
2026-05-29 15:53:25 +08:00
|
|
|
{ path: '/warehouse-overview', meta: { title: '库区总览大屏', icon: 'example' } },
|
|
|
|
|
{ path: '/wip', meta: { title: 'WIP在产大屏', icon: 'monitor' } }
|
2026-05-15 18:18:51 +08:00
|
|
|
]
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.sidebar-container {
|
2026-05-17 17:24:43 +08:00
|
|
|
flex-shrink: 0;
|
2026-05-15 18:18:51 +08:00
|
|
|
width: 200px;
|
2026-05-17 17:24:43 +08:00
|
|
|
height: 100vh;
|
2026-05-19 17:56:44 +08:00
|
|
|
background: linear-gradient(180deg, #0a1428 0%, #0d1b34 100%);
|
|
|
|
|
border-right: 1px solid rgba(0, 212, 255, 0.2);
|
|
|
|
|
box-shadow: 2px 2px 20px rgba(0, 0, 0, 0.3);
|
2026-05-15 18:18:51 +08:00
|
|
|
transition: width 0.28s ease;
|
2026-05-17 17:24:43 +08:00
|
|
|
overflow: hidden;
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
&.is-collapse {
|
|
|
|
|
width: 54px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sidebar-header {
|
2026-05-17 17:24:43 +08:00
|
|
|
height: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2026-05-19 17:56:44 +08:00
|
|
|
background: linear-gradient(90deg, #00a8cc 0%, #00d4ff 50%, #00a8cc 100%);
|
|
|
|
|
border-bottom: 1px solid rgba(0, 212, 255, 0.3);
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
.logo-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2026-05-17 17:24:43 +08:00
|
|
|
gap: 8px;
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
.logo-icon {
|
2026-05-17 17:24:43 +08:00
|
|
|
font-size: 20px;
|
2026-05-19 17:56:44 +08:00
|
|
|
color: #0a1428;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo-text {
|
2026-05-17 17:24:43 +08:00
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: bold;
|
2026-05-19 17:56:44 +08:00
|
|
|
color: #0a1428;
|
2026-05-17 17:24:43 +08:00
|
|
|
transition: opacity 0.2s ease;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sidebar-scroll {
|
2026-05-17 17:24:43 +08:00
|
|
|
height: calc(100% - 50px);
|
2026-05-15 18:18:51 +08:00
|
|
|
overflow-y: auto;
|
2026-05-17 17:24:43 +08:00
|
|
|
overflow-x: hidden;
|
2026-05-15 18:18:51 +08:00
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
&::-webkit-scrollbar {
|
2026-05-19 17:56:44 +08:00
|
|
|
width: 6px;
|
|
|
|
|
height: 6px;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
&::-webkit-scrollbar-track {
|
2026-05-19 17:56:44 +08:00
|
|
|
background: rgba(0, 212, 255, 0.1);
|
|
|
|
|
border-radius: 3px;
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
2026-05-15 18:18:51 +08:00
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
&::-webkit-scrollbar-thumb {
|
2026-05-19 17:56:44 +08:00
|
|
|
background: rgba(0, 212, 255, 0.3);
|
|
|
|
|
border-radius: 3px;
|
2026-05-17 17:24:43 +08:00
|
|
|
transition: background 0.2s;
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
&:hover {
|
2026-05-19 17:56:44 +08:00
|
|
|
background: rgba(0, 212, 255, 0.5);
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-15 18:18:51 +08:00
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
.sidebar-menu {
|
|
|
|
|
border-right: none;
|
|
|
|
|
background: transparent;
|
2026-05-19 17:56:44 +08:00
|
|
|
padding: 8px;
|
2026-05-17 17:24:43 +08:00
|
|
|
|
|
|
|
|
:deep(.el-menu) {
|
|
|
|
|
border-right: none;
|
|
|
|
|
background: transparent;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-19 17:56:44 +08:00
|
|
|
:deep(.el-menu-item) {
|
|
|
|
|
height: 44px;
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
margin: 6px 4px;
|
|
|
|
|
padding: 0 16px;
|
|
|
|
|
border-radius: 8px;
|
2026-05-15 18:18:51 +08:00
|
|
|
position: relative;
|
|
|
|
|
border-left: 3px solid transparent;
|
2026-05-19 17:56:44 +08:00
|
|
|
transition: all 0.25s ease;
|
|
|
|
|
background: rgba(0, 212, 255, 0.08);
|
|
|
|
|
font-size: 14px;
|
2026-05-17 17:24:43 +08:00
|
|
|
|
|
|
|
|
.el-icon {
|
2026-05-19 17:56:44 +08:00
|
|
|
color: #00d4ff;
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
font-size: 16px;
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
2026-05-15 18:18:51 +08:00
|
|
|
|
|
|
|
|
&:hover {
|
2026-05-19 17:56:44 +08:00
|
|
|
background: rgba(0, 212, 255, 0.25);
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
transform: translateX(4px);
|
2026-05-17 17:24:43 +08:00
|
|
|
|
|
|
|
|
.el-icon {
|
2026-05-19 17:56:44 +08:00
|
|
|
color: #00d4ff;
|
|
|
|
|
text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-active {
|
2026-05-19 17:56:44 +08:00
|
|
|
border-left: 3px solid #00d4ff;
|
|
|
|
|
background: rgba(0, 212, 255, 0.3);
|
|
|
|
|
color: #ffffff;
|
2026-05-15 18:18:51 +08:00
|
|
|
font-weight: 600;
|
2026-05-19 17:56:44 +08:00
|
|
|
box-shadow: 0 0 15px rgba(0, 212, 255, 0.25);
|
2026-05-17 17:24:43 +08:00
|
|
|
|
|
|
|
|
.el-icon {
|
2026-05-19 17:56:44 +08:00
|
|
|
color: #00d4ff;
|
|
|
|
|
text-shadow: 0 0 15px rgba(0, 212, 255, 0.9);
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
&.is-collapse {
|
2026-05-19 17:56:44 +08:00
|
|
|
:deep(.el-menu-item) {
|
2026-05-17 17:24:43 +08:00
|
|
|
padding: 0;
|
|
|
|
|
text-align: center;
|
2026-05-19 17:56:44 +08:00
|
|
|
border-left: none;
|
2026-05-15 18:18:51 +08:00
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
span {
|
|
|
|
|
display: none;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 17:24:43 +08:00
|
|
|
.el-icon {
|
|
|
|
|
margin-right: 0;
|
2026-05-15 18:18:51 +08:00
|
|
|
}
|
2026-05-17 17:24:43 +08:00
|
|
|
|
2026-05-19 17:56:44 +08:00
|
|
|
&.is-active {
|
|
|
|
|
border-left: none;
|
|
|
|
|
background: rgba(0, 212, 255, 0.2);
|
|
|
|
|
}
|
2026-05-17 17:24:43 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-05-19 17:56:44 +08:00
|
|
|
</style>
|