feat: 更新布局、大屏页面、酸轧报表接口,调整导航栏/侧边栏联动
This commit is contained in:
39
src/layout/components/AppMain.vue
Normal file
39
src/layout/components/AppMain.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<section class="app-main">
|
||||
<router-view v-slot="{ Component }">
|
||||
<transition name="fade-transform" mode="out-in">
|
||||
<component :is="Component" />
|
||||
</transition>
|
||||
</router-view>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-main {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
background: #f5f7fa;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fade-transform-leave-active,
|
||||
.fade-transform-enter-active {
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
.fade-transform-enter {
|
||||
opacity: 0;
|
||||
transform: translateX(-30px);
|
||||
}
|
||||
|
||||
.fade-transform-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(30px);
|
||||
}
|
||||
</style>
|
||||
@@ -38,20 +38,13 @@ const toggleSideBar = () => {
|
||||
.navbar {
|
||||
height: 50px;
|
||||
background: linear-gradient(90deg, #20b6f9, #2178f1);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 200px;
|
||||
z-index: 100;
|
||||
transition: left 0.28s ease;
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
|
||||
.app-wrapper.sidebar-close & {
|
||||
left: 54px;
|
||||
}
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.navbar-left {
|
||||
@@ -113,4 +106,4 @@ const toggleSideBar = () => {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -10,6 +10,7 @@
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
:collapse="!sidebar.opened"
|
||||
:collapse-transition="false"
|
||||
mode="vertical"
|
||||
class="sidebar-menu"
|
||||
router
|
||||
@@ -42,7 +43,7 @@
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useStore } from 'vuex'
|
||||
import { Refresh, FullScreen, User, Search } from '@element-plus/icons-vue'
|
||||
import { Refresh, Monitor, PieChart, Document, List, Plus, Bell, Setting } from '@element-plus/icons-vue'
|
||||
|
||||
const route = useRoute()
|
||||
const store = useStore()
|
||||
@@ -50,88 +51,91 @@ const store = useStore()
|
||||
const sidebar = computed(() => store.state.app.sidebar)
|
||||
const activeMenu = computed(() => route.path)
|
||||
|
||||
const iconMap = {
|
||||
'dashboard': Monitor,
|
||||
'monitor': Monitor,
|
||||
'example': PieChart,
|
||||
'order': Document,
|
||||
'cost': PieChart,
|
||||
'energy': Monitor,
|
||||
'pie-chart': PieChart,
|
||||
'list': List,
|
||||
'plus': Plus,
|
||||
'document': Document,
|
||||
'output': PieChart,
|
||||
'stop': Bell,
|
||||
'system': Setting,
|
||||
'user': Refresh,
|
||||
'role': Refresh,
|
||||
'menu': List,
|
||||
'config': Setting,
|
||||
'database': Monitor
|
||||
}
|
||||
|
||||
const getIcon = (iconName) => {
|
||||
return iconMap[iconName] || Monitor
|
||||
}
|
||||
|
||||
const menuItems = [
|
||||
{
|
||||
path: '/index',
|
||||
meta: { title: '工作台', icon: 'home' }
|
||||
meta: { title: '工作台', icon: 'dashboard' },
|
||||
children: []
|
||||
},
|
||||
{
|
||||
path: '/dashboard',
|
||||
meta: { title: '数据大屏', icon: 'monitor' },
|
||||
children: [
|
||||
{ path: '/dashboard/demo', meta: { title: '示例大屏', icon: 'chart' } },
|
||||
{ path: '/dashboard/order', meta: { title: '订单大屏', icon: 'chart' } },
|
||||
{ path: '/dashboard/cost', meta: { title: '成本大屏', icon: 'chart' } },
|
||||
{ path: '/dashboard/energy', meta: { title: '能源大屏', icon: 'monitor' } }
|
||||
{ path: '/dashboard/demo', meta: { title: '示例大屏', icon: 'example' }, children: [] },
|
||||
{ path: '/dashboard/order', meta: { title: '订单大屏', icon: 'order' }, children: [] },
|
||||
{ path: '/dashboard/cost', meta: { title: '成本大屏', icon: 'cost' }, children: [] },
|
||||
{ path: '/dashboard/energy', meta: { title: '能源大屏', icon: 'energy' }, children: [] },
|
||||
{ path: '/dashboard/acid-rolling', meta: { title: '酸轧数据大屏', icon: 'example' }, children: [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/screens',
|
||||
meta: { title: '大屏管理', icon: 'layout' },
|
||||
path: '/screen-manage',
|
||||
meta: { title: '大屏管理', icon: 'pie-chart' },
|
||||
children: [
|
||||
{ path: '/screens', meta: { title: '大屏列表', icon: 'list' } },
|
||||
{ path: '/screens/acid-rolling', meta: { title: '酸轧数据大屏', icon: 'chart' } }
|
||||
{ path: '/screen-manage', meta: { title: '大屏列表', icon: 'list' }, children: [] },
|
||||
{ path: '/screen-manage/create', meta: { title: '新建大屏', icon: 'plus' }, children: [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/reports',
|
||||
meta: { title: '报表管理', icon: 'document' },
|
||||
children: [
|
||||
{ path: '/reports', meta: { title: '报表列表', icon: 'list' } },
|
||||
{ path: '/reports/acid-rolling', meta: { title: '酸轧产出报表', icon: 'chart' } },
|
||||
{ path: '/reports/acid-stop', meta: { title: '酸轧停机报表', icon: 'settings' } }
|
||||
{ path: '/reports', meta: { title: '报表列表', icon: 'list' }, children: [] },
|
||||
{ path: '/reports/acid-rolling', meta: { title: '酸轧产出报表', icon: 'output' }, children: [] },
|
||||
{ path: '/reports/acid-stop', meta: { title: '酸轧停机报表', icon: 'stop' }, children: [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/system',
|
||||
meta: { title: '系统管理', icon: 'settings' },
|
||||
meta: { title: '系统管理', icon: 'system' },
|
||||
children: [
|
||||
{ path: '/system/user', meta: { title: '用户管理', icon: 'user' } },
|
||||
{ path: '/system/role', meta: { title: '角色管理', icon: 'user' } },
|
||||
{ path: '/system/menu', meta: { title: '菜单管理', icon: 'user' } },
|
||||
{ path: '/system/config', meta: { title: '系统配置', icon: 'settings' } }
|
||||
{ path: '/system/menu', meta: { title: '菜单管理', icon: 'menu' }, children: [] },
|
||||
{ path: '/system/config', meta: { title: '系统配置', icon: 'config' }, children: [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/data-source',
|
||||
meta: { title: '数据源配置', icon: 'database' }
|
||||
meta: { title: '数据源配置', icon: 'database' },
|
||||
children: []
|
||||
}
|
||||
]
|
||||
|
||||
const iconMap = {
|
||||
'home': Refresh,
|
||||
'monitor': FullScreen,
|
||||
'chart': Refresh,
|
||||
'document': Search,
|
||||
'settings': Refresh,
|
||||
'database': FullScreen,
|
||||
'user': User,
|
||||
'lock': User,
|
||||
'menu': Refresh,
|
||||
'layout': FullScreen,
|
||||
'list': Search
|
||||
}
|
||||
|
||||
const getIcon = (iconName) => {
|
||||
if (!iconName) return Refresh
|
||||
return iconMap[iconName] || Refresh
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebar-container {
|
||||
flex-shrink: 0;
|
||||
width: 200px;
|
||||
background: #333333;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background: #ffffff;
|
||||
border-right: 1px solid #e8e8e8;
|
||||
box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
|
||||
transition: width 0.28s ease;
|
||||
border-right: 1px solid #444444;
|
||||
overflow: hidden;
|
||||
|
||||
&.is-collapse {
|
||||
width: 54px;
|
||||
@@ -139,138 +143,162 @@ const getIcon = (iconName) => {
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
background: #2d2d2d;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid #444444;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #3A71A8, #324157);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.logo-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
gap: 8px;
|
||||
|
||||
.logo-icon {
|
||||
font-size: 18px;
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
white-space: nowrap;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-scroll {
|
||||
flex: 1;
|
||||
height: calc(100% - 50px);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
||||
:deep(.el-scrollbar__wrap) {
|
||||
overflow-x: hidden;
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-menu {
|
||||
border: none;
|
||||
border-right: none;
|
||||
background: transparent;
|
||||
height: 100%;
|
||||
padding: 4px 0;
|
||||
padding: 4px;
|
||||
|
||||
:deep(.el-menu-item) {
|
||||
color: #999999;
|
||||
padding: 0 16px;
|
||||
font-size: 13px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin: 0 6px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 2px;
|
||||
transition: all 0.2s ease;
|
||||
:deep(.el-menu) {
|
||||
border-right: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
:deep(.el-menu-item),
|
||||
:deep(.el-sub-menu__title) {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
color: #333333;
|
||||
margin: 2px 0;
|
||||
padding: 0 8px;
|
||||
border-radius: 0;
|
||||
position: relative;
|
||||
border-left: 3px solid transparent;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
.el-icon {
|
||||
color: #8c8c8c;
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #444444 !important;
|
||||
color: #ffffff;
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
color: #1a1a1a;
|
||||
|
||||
.el-icon {
|
||||
color: #555555;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: #4a90d9 !important;
|
||||
color: #ffffff;
|
||||
border-left: 3px solid #409eff;
|
||||
background: rgba(64, 158, 255, 0.1);
|
||||
color: #1a1a1a;
|
||||
font-weight: 600;
|
||||
border-left: 3px solid #5F7BA0;
|
||||
|
||||
.el-icon {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-sub-menu__title) {
|
||||
color: #999999;
|
||||
padding: 0 16px;
|
||||
font-size: 13px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin: 0 6px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 2px;
|
||||
transition: all 0.2s ease;
|
||||
background: transparent;
|
||||
position: relative;
|
||||
border-left: 3px solid transparent;
|
||||
|
||||
&:hover {
|
||||
background: #444444 !important;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: #4a90d9 !important;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
border-left: 3px solid #5F7BA0;
|
||||
&::after {
|
||||
font-size: 12px;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-sub-menu .el-menu-item) {
|
||||
padding-left: 40px !important;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
border-left: none;
|
||||
|
||||
&:hover {
|
||||
background: #3a3a3a !important;
|
||||
}
|
||||
padding-left: 18px !important;
|
||||
font-size: 13px;
|
||||
|
||||
&.is-active {
|
||||
background: #3d5a7a !important;
|
||||
border-left: 3px solid #5F7BA0;
|
||||
padding-left: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-menu--popup) {
|
||||
background: #3a3a3a !important;
|
||||
border: 1px solid #444444;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 4px;
|
||||
:deep(.el-sub-menu .el-sub-menu .el-menu-item) {
|
||||
padding-left: 28px !important;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-menu-item {
|
||||
color: #999999;
|
||||
padding: 0 20px;
|
||||
font-size: 13px;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
border-left: none;
|
||||
&.is-collapse {
|
||||
:deep(.el-menu-item),
|
||||
:deep(.el-sub-menu__title) {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
|
||||
&:hover {
|
||||
background: #444444 !important;
|
||||
color: #ffffff;
|
||||
span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: #4a90d9 !important;
|
||||
color: #ffffff;
|
||||
.el-icon {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
:deep(.el-menu--popup) {
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
|
||||
.el-menu-item {
|
||||
padding: 0 20px;
|
||||
border-left: none;
|
||||
|
||||
&:hover {
|
||||
background: rgba(64, 158, 255, 0.08);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
border-left: none;
|
||||
background: rgba(64, 158, 255, 0.12);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,121 +1,43 @@
|
||||
<template>
|
||||
<div :class="['app-wrapper', { 'sidebar-close': !sidebar.opened }]">
|
||||
<Sidebar />
|
||||
<div class="main-container">
|
||||
<Navbar />
|
||||
<TagsView />
|
||||
<Breadcrumb />
|
||||
<main class="app-main">
|
||||
<transition name="fade-transform" mode="out-in">
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive :include="cachedViews">
|
||||
<component :is="Component" :key="route.fullPath" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</transition>
|
||||
</main>
|
||||
<div class="app-wrapper">
|
||||
<sidebar />
|
||||
<div class="main-wrapper">
|
||||
<navbar />
|
||||
<app-main />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useStore } from 'vuex'
|
||||
import Sidebar from './components/Sidebar/index.vue'
|
||||
import Navbar from './components/Navbar/index.vue'
|
||||
import Breadcrumb from './components/Breadcrumb/index.vue'
|
||||
import TagsView from './components/TagsView/index.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const store = useStore()
|
||||
|
||||
const sidebar = computed(() => store.state.app.sidebar)
|
||||
const cachedViews = computed(() => store.state.tagsView?.cachedViews || [])
|
||||
import AppMain from './components/AppMain.vue'
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body, #app {
|
||||
height: 100%;
|
||||
font-family: 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.app-wrapper {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
min-height: 100vh;
|
||||
transition: padding-left 0.28s ease;
|
||||
padding-left: 200px;
|
||||
.main-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-wrapper.sidebar-close {
|
||||
.main-container {
|
||||
padding-left: 54px;
|
||||
:deep(.sidebar-container) {
|
||||
flex-shrink: 0;
|
||||
width: 200px;
|
||||
transition: width 0.28s ease;
|
||||
|
||||
&.is-collapse {
|
||||
width: 54px;
|
||||
}
|
||||
}
|
||||
|
||||
.app-main {
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
min-height: calc(100vh - 180px);
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
min-height: calc(100vh - 230px);
|
||||
}
|
||||
|
||||
.components-container {
|
||||
margin: 30px 50px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fade-transform-enter-active,
|
||||
.fade-transform-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.fade-transform-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateX(-20px);
|
||||
}
|
||||
|
||||
.fade-transform-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.main-container {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.app-wrapper.sidebar-close .main-container {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.app-wrapper.sidebar-opened .main-container {
|
||||
padding-left: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user