- 新增 SubNav 组件:Navbar 下方水平子导航条,展示当前二级菜单下的三级页面,支持滚动和下拉分组 - 新增 redirectMenu 页面:点击二级菜单时卡片式展示子页面列表 - SidebarItem 深度 >=1 时改为叶子节点渲染(小圆点标记),激活高亮回退到二级菜单 - Navbar 布局重构为 Flexbox,面包屑/SubNav 根据场景切换 - 新增 productionLine Vuex 模块,轧辊研磨页改为 store 方式读取产线数据 - Sidebar activeMenu 逻辑增强:自动定位当前页所属二级菜单
275 lines
7.0 KiB
Vue
275 lines
7.0 KiB
Vue
<template>
|
|
<div class="navbar">
|
|
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
|
|
|
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-show="topNav || !showSubNav"/>
|
|
<sub-nav id="subnav-container" class="subnav-container" v-if="!topNav" @has-items="showSubNav = $event"/>
|
|
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
|
|
|
|
<div class="right-menu">
|
|
<template v-if="device!=='mobile'">
|
|
<search id="header-search" class="right-menu-item" />
|
|
<div class="right-menu-item hover-effect" @click="gotoTodo" title="代办事项">
|
|
<el-icon class="el-icon-document-checked" />
|
|
</div>
|
|
<div class="right-menu-item hover-effect" @click="gotoWarning" title="告警信息">
|
|
<el-badge :value="hasWarning || ''" class="nav-badge">
|
|
<el-icon class="el-icon-bell" />
|
|
</el-badge>
|
|
</div>
|
|
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
|
|
<div class="right-menu-item hover-effect" @click="refresh" title="刷新">
|
|
<el-icon class="el-icon-refresh" />
|
|
</div>
|
|
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">
|
|
<size-select id="size-select" class="right-menu-item hover-effect" />
|
|
</el-tooltip> -->
|
|
</template>
|
|
|
|
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
|
<div class="avatar-wrapper">
|
|
<img :src="avatar" class="user-avatar">
|
|
<i class="el-icon-caret-bottom" />
|
|
</div>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<router-link to="/user/profile">
|
|
<el-dropdown-item>个人中心</el-dropdown-item>
|
|
</router-link>
|
|
<el-dropdown-item @click.native="setting = true">
|
|
<span>布局设置</span>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item divided @click.native="logout">
|
|
<span>退出登录</span>
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
import Breadcrumb from '@/components/Breadcrumb'
|
|
import TopNav from '@/components/TopNav'
|
|
import SubNav from './SubNav'
|
|
import Hamburger from '@/components/Hamburger'
|
|
import Screenfull from '@/components/Screenfull'
|
|
// import SizeSelect from '@/components/SizeSelect'
|
|
import Search from '@/components/HeaderSearch'
|
|
import { listMaterialWarning } from '@/api/wms/materialWarning'
|
|
// import RuoYiGit from '@/components/RuoYi/Git'
|
|
// import RuoYiDoc from '@/components/RuoYi/Doc'
|
|
|
|
export default {
|
|
components: {
|
|
Breadcrumb,
|
|
TopNav,
|
|
SubNav,
|
|
Hamburger,
|
|
Screenfull,
|
|
// SizeSelect,
|
|
Search,
|
|
// RuoYiGit,
|
|
// RuoYiDoc
|
|
},
|
|
data() {
|
|
return {
|
|
hasWarning: false,
|
|
warningTimer: null,
|
|
showSubNav: true
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters([
|
|
'sidebar',
|
|
'avatar',
|
|
'device'
|
|
]),
|
|
setting: {
|
|
get() {
|
|
return this.$store.state.settings.showSettings
|
|
},
|
|
set(val) {
|
|
this.$store.dispatch('settings/changeSetting', {
|
|
key: 'showSettings',
|
|
value: val
|
|
})
|
|
}
|
|
},
|
|
topNav: {
|
|
get() {
|
|
return this.$store.state.settings.topNav
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
toggleSideBar() {
|
|
this.$store.dispatch('app/toggleSideBar')
|
|
},
|
|
refresh() {
|
|
window.location.reload(true)
|
|
// this.$store.dispatch('app/refresh')
|
|
},
|
|
gotoTodo() {
|
|
this.$router.push({ path: '/wms/todo' })
|
|
},
|
|
gotoWarning() {
|
|
this.$router.push({ path: '/wms/materialWarning' })
|
|
},
|
|
checkWarning() {
|
|
listMaterialWarning({ pageNum: 1, pageSize: 1, warningStatus: '0' }).then(response => {
|
|
this.hasWarning = response.total
|
|
}).catch(() => {
|
|
this.hasWarning = 0
|
|
})
|
|
},
|
|
async logout() {
|
|
this.$confirm('确定注销并退出系统吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
this.$store.dispatch('LogOut').then(() => {
|
|
location.href = process.env.VUE_APP_CONTEXT_PATH + "index";
|
|
})
|
|
}).catch(() => {});
|
|
}
|
|
},
|
|
mounted() {
|
|
this.checkWarning()
|
|
this.warningTimer = setInterval(() => {
|
|
this.checkWarning()
|
|
}, 60000)
|
|
},
|
|
beforeDestroy() {
|
|
if (this.warningTimer) {
|
|
clearInterval(this.warningTimer)
|
|
this.warningTimer = null
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.navbar {
|
|
height: 50px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
// 金属质感渐变背景
|
|
// background: #454c51;
|
|
// border-bottom: 1px solid #8d939b;
|
|
// box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1),
|
|
// 0 1px 1px rgba(255, 255, 255, 0.08) inset;
|
|
|
|
.hamburger-container {
|
|
line-height: 46px;
|
|
height: 100%;
|
|
flex-shrink: 0;
|
|
cursor: pointer;
|
|
transition: all .3s ease;
|
|
-webkit-tap-highlight-color: transparent;
|
|
padding: 0 15px;
|
|
border-right: 1px solid rgba(0, 0, 0, 0.05);
|
|
|
|
&:hover {
|
|
background: rgba(0, 0, 0, 0.05);
|
|
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.08),
|
|
inset -1px -1px 2px rgba(255, 255, 255, 0.05);
|
|
}
|
|
}
|
|
|
|
.breadcrumb-container {
|
|
flex-shrink: 0;
|
|
padding-left: 15px;
|
|
}
|
|
|
|
.subnav-container {
|
|
flex: 1;
|
|
min-width: 0;
|
|
padding-left: 8px;
|
|
}
|
|
|
|
.topmenu-container {
|
|
position: absolute;
|
|
left: 50px;
|
|
}
|
|
|
|
.errLog-container {
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.right-menu {
|
|
flex-shrink: 0;
|
|
margin-left: auto;
|
|
height: 100%;
|
|
line-height: 50px;
|
|
|
|
&:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.right-menu-item {
|
|
display: inline-block;
|
|
padding: 0 12px;
|
|
height: 100%;
|
|
font-size: 18px;
|
|
// 金属风格文字色
|
|
color: #111;
|
|
vertical-align: text-bottom;
|
|
transition: all 0.2s ease;
|
|
|
|
&.hover-effect {
|
|
cursor: pointer;
|
|
position: relative;
|
|
|
|
&:hover {
|
|
background: rgba(0, 0, 0, 0.05);
|
|
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.08),
|
|
inset -1px -1px 2px rgba(255, 255, 255, 0.05);
|
|
color: #333;
|
|
}
|
|
}
|
|
}
|
|
|
|
.avatar-container {
|
|
margin-right: 15px;
|
|
|
|
.avatar-wrapper {
|
|
margin-top: 5px;
|
|
position: relative;
|
|
|
|
.user-avatar {
|
|
cursor: pointer;
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 8px;
|
|
// 头像金属边框
|
|
border: 1px solid #a0a6ad;
|
|
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.el-icon-caret-bottom {
|
|
cursor: pointer;
|
|
position: absolute;
|
|
right: -15px;
|
|
top: 25px;
|
|
font-size: 12px;
|
|
color: #666;
|
|
}
|
|
}
|
|
}
|
|
|
|
.nav-badge {
|
|
::v-deep .el-badge__content.is-fixed {
|
|
top: 14px;
|
|
right: 14px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |