标签栏完善、布局管理、监控系统、信息通知管理跳转

This commit is contained in:
2023-03-17 14:22:08 +08:00
parent e74846da17
commit 7138434472
18 changed files with 856 additions and 63 deletions

View File

@@ -1,16 +1,16 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<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" />
<el-tooltip content="项目文档" effect="dark" placement="bottom">
<Doc class="right-menu-item hover-effect" />
</el-tooltip>
<!-- <el-tooltip content="项目文档" effect="dark" placement="bottom">
<Doc class="right-menu-item hover-effect" />
</el-tooltip>-->
<el-tooltip content="全屏缩放" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" />
@@ -18,16 +18,16 @@
<notice-icon class="right-menu-item"/>
<notice-icon-reader ref="noticeIconReader"/>
<el-tooltip content="布局设置" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
<!-- <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">
<img :src="Avatar" class="user-avatar">
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover">
<div class="avatar-wrapper">
<img :src="Avatar" class="user-avatar">
<i class="el-icon-caret-bottom" />
<!-- <img :src="Avatar" class="user-avatar" style="border: #f5141e 1px solid">-->
<span class="user-nickname">{{ user.personName }}</span>
</div>
<el-dropdown-menu slot="dropdown">
<span style="display:block;" @click="show = true">
@@ -55,6 +55,8 @@
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import TopNav from '@/components/TopNav'
import Doc from '@/components/Doc'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
@@ -72,7 +74,8 @@ export default {
Screenfull,
SizeSelect,
Search,
Doc
Doc,
TopNav
},
data() {
return {
@@ -97,6 +100,11 @@ export default {
value: val
})
}
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
},
methods: {
@@ -146,6 +154,11 @@ export default {
float: left;
}
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
@@ -177,27 +190,22 @@ export default {
}
}
}
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.avatar-container {
margin-right: 30px;
//margin-right: 10px;
.avatar-wrapper {
margin-top: 5px;
//margin-top: 5px;
position: relative;
.user-avatar {
.user-nickname {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
font-size: 18px;
margin-left: -10px;
}
}
}

View File

@@ -1,33 +1,94 @@
<template>
<div class="drawer-container">
<div>
<h3 class="drawer-title">系统布局设置</h3>
<div class="setting-drawer-content">
<div class="setting-drawer-title">
<h3 class="drawer-title">主题风格设置</h3>
</div>
<div class="setting-drawer-block-checbox">
<div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-dark')">
<img src="@/assets/images/dark.svg" alt="dark">
<div v-if="sideTheme === 'theme-dark'" class="setting-drawer-block-checbox-selectIcon" style="display: block;">
<i aria-label="图标: check" class="anticon anticon-check">
<svg
viewBox="64 64 896 896"
data-icon="check"
width="1em"
height="1em"
:fill="theme"
aria-hidden="true"
focusable="false"
class=""
>
<path
d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"
/>
</svg>
</i>
</div>
</div>
<div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-light')">
<img src="@/assets/images/light.svg" alt="light">
<div v-if="sideTheme === 'theme-light'" class="setting-drawer-block-checbox-selectIcon" style="display: block;">
<i aria-label="图标: check" class="anticon anticon-check">
<svg
viewBox="64 64 896 896"
data-icon="check"
width="1em"
height="1em"
:fill="theme"
aria-hidden="true"
focusable="false"
class=""
>
<path
d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"
/>
</svg>
</i>
</div>
</div>
</div>
<div class="drawer-item">
<span>主题颜色</span>
<theme-picker style="float: right;height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
</div>
</div>
<el-divider />
<h3 class="drawer-title">系统布局配置</h3>
<div class="drawer-item">
<span>主题颜色</span>
<theme-picker style="float: right;height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
<span>开启 TopNav</span>
<el-switch v-model="topNav" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>显示标签</span>
<span>开启 Tags-Views</span>
<el-switch v-model="tagsView" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>固定头部</span>
<span>固定 Header</span>
<el-switch v-model="fixedHeader" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>显示LOGO</span>
<span>显示 Logo</span>
<el-switch v-model="sidebarLogo" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>菜单UniqueOpened</span>
<el-switch v-model="uniqueOpened" class="drawer-switch" />
<span>动态标题</span>
<el-switch v-model="dynamicTitle" class="drawer-switch" />
</div>
<el-divider />
<el-button size="mini" type="primary" plain icon="el-icon-document-add" @click="saveSetting">保存配置</el-button>
<el-button size="mini" plain icon="el-icon-refresh" @click="resetSetting">重置配置</el-button>
</div>
</div>
</template>
@@ -38,7 +99,10 @@ import ThemePicker from '@/components/ThemePicker'
export default {
components: { ThemePicker },
data() {
return {}
return {
theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme
}
},
computed: {
fixedHeader: {
@@ -52,6 +116,20 @@ export default {
})
}
},
topNav: {
get() {
return this.$store.state.settings.topNav
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'topNav',
value: val
})
if (!val) {
this.$store.commit('SET_SIDEBAR_ROUTERS', this.$store.state.permission.defaultRoutes)
}
}
},
tagsView: {
get() {
return this.$store.state.settings.tagsView
@@ -74,13 +152,13 @@ export default {
})
}
},
uniqueOpened: {
dynamicTitle: {
get() {
return this.$store.state.settings.uniqueOpened
return this.$store.state.settings.dynamicTitle
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'uniqueOpened',
key: 'dynamicTitle',
value: val
})
}
@@ -92,12 +170,84 @@ export default {
key: 'theme',
value: val
})
this.theme = val
},
handleTheme(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme',
value: val
})
this.sideTheme = val
},
saveSetting() {
this.$modal.loading('正在保存到本地,请稍候...')
this.$cache.local.set(
'layout-setting',
`{
"topNav":${this.topNav},
"tagsView":${this.tagsView},
"fixedHeader":${this.fixedHeader},
"sidebarLogo":${this.sidebarLogo},
"dynamicTitle":${this.dynamicTitle},
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
}`
)
setTimeout(this.$modal.closeLoading(), 1000)
},
resetSetting() {
this.$modal.loading('正在清除设置缓存并刷新,请稍候...')
this.$cache.local.remove('layout-setting')
setTimeout('window.location.reload()', 1000)
}
}
}
</script>
<style lang="scss" scoped>
.setting-drawer-content {
.setting-drawer-title {
margin-bottom: 12px;
color: rgba(0, 0, 0, .85);
font-size: 14px;
line-height: 22px;
font-weight: bold;
}
.setting-drawer-block-checbox {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 10px;
margin-bottom: 20px;
.setting-drawer-block-checbox-item {
position: relative;
margin-right: 16px;
border-radius: 2px;
cursor: pointer;
img {
width: 48px;
height: 48px;
}
.setting-drawer-block-checbox-selectIcon {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
padding-top: 15px;
padding-left: 24px;
color: #1890ff;
font-weight: 700;
font-size: 14px;
}
}
}
}
.drawer-container {
padding: 24px;
font-size: 14px;

View File

@@ -1,13 +1,13 @@
<template>
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBackground }">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 v-else class="sidebar-title">{{ title }} </h1>
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 class="sidebar-title">{{ title }} </h1>
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
</router-link>
</transition>
</div>
@@ -15,6 +15,7 @@
<script>
import Logo from '@/assets/images/logo.png'
import variables from '@/assets/styles/variables.scss'
export default {
name: 'SidebarLogo',
props: {
@@ -23,11 +24,25 @@ export default {
required: true
}
},
computed: {
variables() {
return variables
},
sideTheme() {
return this.$store.state.settings.sideTheme
}
},
data() {
return {
title: '诺力mes系统',
logo: Logo
title: '诺力mes平台',
logo: Logo,
title_param: 'platform'
}
},
created() {
this.getValueByCode(this.title_param).then(res => {
this.title = res.value
})
}
}
</script>

View File

@@ -1,12 +1,12 @@
<template>
<div :class="{'has-logo':showLogo}">
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBg : '#ffffff' }">
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="variables.menuBg"
:text-color="variables.menuText"
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBackground"
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuText : variables.menuText"
:unique-opened="$store.state.settings.uniqueOpened"
:active-text-color="variables.menuActiveText"
:collapse-transition="false"
@@ -19,7 +19,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/assets/styles/variables.scss'
@@ -27,6 +27,7 @@ import variables from '@/assets/styles/variables.scss'
export default {
components: { SidebarItem, Logo },
computed: {
...mapState(['settings']),
...mapGetters([
'sidebarRouters',
'sidebar'

View File

@@ -19,6 +19,8 @@
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">刷新</li>
<li v-if="!(selectedTag.meta&&selectedTag.meta.affix)" @click="closeSelectedTag(selectedTag)">关闭</li>
<li v-if="!isFirstView()" @click="closeLeftTags()">关闭左侧</li>
<li v-if="!isLastView()" @click="closeRightTags">关闭右侧</li>
<li @click="closeOthersTags">关闭其他</li>
<li @click="closeAllTags(selectedTag)">关闭全部</li>
</ul>
@@ -132,7 +134,9 @@ export default {
})
},
closeSelectedTag(view) {
// console.log(view)
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
// console.log(visitedViews)
if (this.isActive(view)) {
this.toLastView(visitedViews, view)
}
@@ -152,6 +156,30 @@ export default {
this.toLastView(visitedViews, view)
})
},
closeLeftTags() {
this.$router.push(this.selectedTag)
let flag = 0
for (let i = (this.$store.state.tagsView.visitedViews.length - 1); i >= 0; i--) {
if (this.$store.state.tagsView.visitedViews[i].fullPath === this.selectedTag.fullPath) {
flag = 1
} else if (flag === 1 && this.$store.state.tagsView.visitedViews[i].fullPath !== '/dashboard') { //
this.$store.dispatch('tagsView/delView', this.$store.state.tagsView.visitedViews[i]).then(({ visitedViews }) => {
})
}
}
},
closeRightTags() {
let flag = 1
for (let i = (this.$store.state.tagsView.visitedViews.length - 1); i >= 0; i--) {
if (this.$store.state.tagsView.visitedViews[i].fullPath === this.selectedTag.fullPath) {
flag = 0
} else if (flag === 1 && this.$store.state.tagsView.visitedViews[i].fullPath !== '/dashboard') { //
this.$store.dispatch('tagsView/delView', this.$store.state.tagsView.visitedViews[i]).then(({ visitedViews }) => {
})
}
}
this.$router.push(this.selectedTag)
},
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
@@ -186,6 +214,20 @@ export default {
},
closeMenu() {
this.visible = false
},
isFirstView() {
try {
return this.selectedTag.fullPath === this.visitedViews[1].fullPath || this.selectedTag.fullPath === '/dashboard'
} catch (err) {
return false
}
},
isLastView() {
try {
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
} catch (err) {
return false
}
}
}
}