Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

 Conflicts:
	ruoyi-admin/src/main/resources/application-prod.yml
	ruoyi-generator/src/main/resources/vm/java/controller.java.vm
	ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
	ruoyi-ui/src/assets/styles/ruoyi.scss
	ruoyi-ui/src/assets/styles/sidebar.scss
	ruoyi-ui/src/layout/components/Navbar.vue
	ruoyi-ui/src/layout/components/Settings/index.vue
	ruoyi-ui/src/layout/components/TagsView/index.vue
	ruoyi-ui/src/settings.js
	ruoyi-ui/src/store/getters.js
	ruoyi-ui/src/store/modules/permission.js
	ruoyi-ui/src/store/modules/settings.js
	ruoyi-ui/src/store/modules/tagsView.js
	ruoyi-ui/src/views/monitor/druid/index.vue
This commit is contained in:
疯狂的狮子li
2021-04-14 13:22:31 +08:00
16 changed files with 412 additions and 42 deletions

View File

@ -2,7 +2,8 @@
<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'">
@ -48,6 +49,7 @@
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
@ -58,6 +60,7 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
export default {
components: {
Breadcrumb,
TopNav,
Hamburger,
Screenfull,
SizeSelect,
@ -81,6 +84,11 @@ export default {
value: val
})
}
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
},
methods: {
@ -127,6 +135,11 @@ export default {
float: left;
}
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container {
display: inline-block;
vertical-align: top;

View File

@ -41,6 +41,11 @@
<el-divider/>
<h3 class="drawer-title">系统布局配置</h3>
<div class="drawer-item">
<span>开启 TopNav</span>
<el-switch v-model="topNav" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>开启 Tags-Views</span>
@ -57,6 +62,10 @@
<el-switch v-model="sidebarLogo" class="drawer-switch" />
</div>
<el-divider/>
<el-button size="small" type="primary" plain icon="el-icon-document-add" @click="saveSetting">保存配置</el-button>
<el-button size="small" plain icon="el-icon-refresh" @click="resetSetting">重置配置</el-button>
</div>
</div>
</template>
@ -67,15 +76,14 @@ import ThemePicker from '@/components/ThemePicker'
export default {
components: { ThemePicker },
data() {
return {}
return {
sideTheme: this.$store.state.settings.sideTheme
};
},
computed: {
theme() {
return this.$store.state.settings.theme
},
sideTheme() {
return this.$store.state.settings.sideTheme
},
fixedHeader: {
get() {
return this.$store.state.settings.fixedHeader
@ -87,6 +95,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
@ -122,6 +144,38 @@ export default {
key: 'sideTheme',
value: val
})
this.sideTheme = val;
},
saveSetting() {
const loading = this.$loading({
lock: true,
fullscreen: false,
text: "正在保存到本地,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
localStorage.setItem(
"layout-setting",
`{
"topNav":${this.topNav},
"tagsView":${this.tagsView},
"fixedHeader":${this.fixedHeader},
"sidebarLogo":${this.sidebarLogo},
"sideTheme":"${this.sideTheme}"
}`
);
setTimeout(loading.close(), 1000)
},
resetSetting() {
this.$loading({
lock: true,
fullscreen: false,
text: "正在清除设置缓存并刷新,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
localStorage.removeItem("layout-setting")
setTimeout("window.location.reload()", 1000)
}
}
}

View File

@ -21,6 +21,7 @@
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
<li @click="closeOthersTags">关闭其他</li>
<li v-if="!isLastView()" @click="closeRightTags">关闭右侧</li>
<li @click="closeAllTags(selectedTag)">关闭所有</li>
</ul>
</div>
@ -83,6 +84,13 @@ export default {
isAffix(tag) {
return tag.meta && tag.meta.affix
},
isLastView() {
try {
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
} catch (err) {
return false
}
},
filterAffixTags(routes, basePath = '/') {
let tags = []
routes.forEach(route => {
@ -152,6 +160,13 @@ export default {
}
})
},
closeRightTags() {
this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
this.toLastView(visitedViews)
}
})
},
closeOthersTags() {
this.$router.push(this.selectedTag).catch(()=>{});
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {