|
@@ -1,3 +1,4 @@
|
|
|
+
|
|
|
<template>
|
|
|
<div class="sidebar" :style="collapse ? 'width:85px' : ''">
|
|
|
<div class="logo" v-if="!collapse">
|
|
@@ -8,64 +9,23 @@
|
|
|
<div class="text">运营支撑</div>
|
|
|
</div>
|
|
|
<div class="menu-wrap no-scrollbar">
|
|
|
+ {{ menuListsss }}
|
|
|
<el-menu
|
|
|
class="sidebar-el-menu"
|
|
|
:default-active="onRoutes"
|
|
|
:collapse="collapse"
|
|
|
background-color="#171F32"
|
|
|
text-color="#aaadba"
|
|
|
+ active-text-color="#2887f2"
|
|
|
unique-opened
|
|
|
+ collapse-transition
|
|
|
+ @select="handleOpen"
|
|
|
router
|
|
|
:style="collapse ? 'width:84px' : 'width:220px'"
|
|
|
>
|
|
|
- <!-- <template v-for="item in siderMenuList"> -->
|
|
|
- <template v-for="item in menuList">
|
|
|
- <template v-if="item.children">
|
|
|
- <el-submenu :index="item.linkPath" :key="item.linkPath">
|
|
|
- <template slot="title">
|
|
|
- <img :src="envConfig.baseImgApi + item.menuImage" style="width: 14px; height: 14px; margin-right: 10px" />
|
|
|
- <span slot="title">{{ item.name }}</span>
|
|
|
- </template>
|
|
|
- <template v-for="subItem in item.children">
|
|
|
- <el-submenu v-if="subItem.children" :index="subItem.linkPath" :key="subItem.linkPath">
|
|
|
- <img
|
|
|
- slot="title"
|
|
|
- :src="envConfig.baseImgApi + subItem.menuImage"
|
|
|
- style="width: 14px; height: 14px; margin-right: 10px"
|
|
|
- />
|
|
|
- <template slot="title">{{ subItem.name }}</template>
|
|
|
- <el-menu-item
|
|
|
- style="padding-left: 88px"
|
|
|
- v-for="threeItem in subItem.children"
|
|
|
- :key="threeItem.linkPath"
|
|
|
- :index="threeItem.linkPath"
|
|
|
- >
|
|
|
- <template slot="title">{{ threeItem.name }}</template>
|
|
|
- </el-menu-item>
|
|
|
- </el-submenu>
|
|
|
- <el-menu-item v-else :index="subItem.linkPath" :key="subItem.linkPath">
|
|
|
- <img
|
|
|
- :src="envConfig.baseImgApi + subItem.menuImage"
|
|
|
- style="width: 14px; height: 14px; margin-right: 10px"
|
|
|
- />
|
|
|
- <template slot="title"> {{ subItem.name }}</template>
|
|
|
- </el-menu-item>
|
|
|
- </template>
|
|
|
- </el-submenu>
|
|
|
- </template>
|
|
|
- <!-- 一级菜单 -->
|
|
|
- <template v-else>
|
|
|
- <el-menu-item :index="item.linkPath" :key="item.linkPath">
|
|
|
- <img :src="envConfig.baseImgApi + item.menuImage" style="width: 14px; height: 14px; margin-right: 10px" />
|
|
|
- <span slot="title">{{ item.name }}</span>
|
|
|
- </el-menu-item>
|
|
|
- </template>
|
|
|
- </template>
|
|
|
+ <menu-tree :menuList="menuList" :collapse="collapse" :openArray="openArray"></menu-tree>
|
|
|
</el-menu>
|
|
|
</div>
|
|
|
- <div class="menu-footer" :class="theme == 'dark' ? 'dark' : 'light'" :style="collapse ? 'width:84px' : 'width:220px'">
|
|
|
- <div></div>
|
|
|
- </div>
|
|
|
<div class="footer">
|
|
|
<img
|
|
|
:class="[collapse ? 'expandhover' : 'packuphover']"
|
|
@@ -77,43 +37,32 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import envConfig from '@/config';
|
|
|
-import { mapState, mapGetters, mapMutations, mapActions } from 'vuex';
|
|
|
-const darkTheme = new Set(['/dispatchCenter', '/waterSupplyMap', '/operation/video', '/operation/pipe-network']);
|
|
|
-const collapsePages = new Set(['/viewDetail', '/installplanView']);
|
|
|
+import { mapState } from 'vuex';
|
|
|
+import MenuTree from './MenuTree.vue';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- envConfig: envConfig,
|
|
|
- siderMenuList: [],
|
|
|
btnCollpaseright: require('@assets/img/btn_collpaseright.png'),
|
|
|
- btnCollpaseleft: require('@assets/img/btn_collpaseleft.png')
|
|
|
+ btnCollpaseleft: require('@assets/img/btn_collpaseleft.png'),
|
|
|
+ openList: []
|
|
|
};
|
|
|
},
|
|
|
+ components: {
|
|
|
+ MenuTree
|
|
|
+ },
|
|
|
computed: {
|
|
|
- // ...mapState(['menuList']),
|
|
|
- menuList(){
|
|
|
- return this.$store.getters['getMenuList']
|
|
|
- },
|
|
|
onRoutes() {
|
|
|
- if (this.$route.path) {
|
|
|
- let theme = darkTheme.has(this.$route.path) ? 'dark' : 'light';
|
|
|
- this.$store.commit('setTheme', darkTheme.has(this.$route.path) ? 'dark' : 'light');
|
|
|
- let iscollapse = collapsePages.has(this.$route.path);
|
|
|
- this.$store.dispatch('collapse', iscollapse);
|
|
|
- }
|
|
|
- return this.$route.path.replace('/', '');
|
|
|
+ return this.$route.path;
|
|
|
},
|
|
|
collapse() {
|
|
|
return this.$store.getters['getCollapse'];
|
|
|
},
|
|
|
- theme() {
|
|
|
- return this.$store.getters.getTheme;
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- menuList(newVal) {
|
|
|
- this.getMenuList();
|
|
|
+ menuList() {
|
|
|
+ let list = this.$store.getters['getMenuList'];
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ openArray() {
|
|
|
+ return this.openList;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -121,25 +70,16 @@ export default {
|
|
|
collapseChage() {
|
|
|
this.$store.dispatch('collapse', !this.collapse);
|
|
|
},
|
|
|
- getMenuList(resolve) {
|
|
|
- this.$http.get('/user/findUserMenu', { appId: '1002' }).then(({ status, data, msg }) => {
|
|
|
- if (0 === status) {
|
|
|
- this.siderMenuList = data[0].children;
|
|
|
- resolve && resolve(true);
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ handleOpen(key, keyPath) {
|
|
|
+ this.openList = keyPath;
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- // new Promise((resolve) => {
|
|
|
- // this.getMenuList(resolve);
|
|
|
- // }).then((_) => {});
|
|
|
- }
|
|
|
+ created() {}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-@import '@assets/css/public-style.scss';
|
|
|
.sidebar {
|
|
|
width: 220px;
|
|
|
display: flex;
|
|
@@ -147,7 +87,6 @@ export default {
|
|
|
background: #171f32;
|
|
|
border-radius: 0px 30px 30px 0px;
|
|
|
z-index: 2;
|
|
|
- // background: #222B41 url('../../assets/img/bg_img.png') no-repeat bottom right;
|
|
|
.logo {
|
|
|
width: 100%;
|
|
|
height: 110px;
|
|
@@ -189,16 +128,13 @@ export default {
|
|
|
overflow: auto;
|
|
|
flex: 1;
|
|
|
scrollbar-width: 0;
|
|
|
- // background: #171F32;
|
|
|
}
|
|
|
.menu-footer.dark {
|
|
|
- // position: absolute;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
width: 220px;
|
|
|
height: 30px;
|
|
|
- // border-radius: 0px 30px 30px 0px;
|
|
|
- // background-color: #f4f7f9;
|
|
|
+
|
|
|
div {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -210,27 +146,12 @@ export default {
|
|
|
background-color: #070f22 !important;
|
|
|
z-index: 1;
|
|
|
}
|
|
|
- // div{
|
|
|
- // width: 100%;
|
|
|
- // height: 100%;
|
|
|
- // border-radius: 0px 30px 30px 0px;
|
|
|
- // background: #171F32;
|
|
|
- // border: none;
|
|
|
- // }
|
|
|
- // }
|
|
|
+
|
|
|
&.light {
|
|
|
background-color: #f4f7f9 !important;
|
|
|
z-index: 1;
|
|
|
}
|
|
|
}
|
|
|
- // .menu-footer.light{
|
|
|
- // bottom: 0;
|
|
|
- // left: 0;
|
|
|
- // width: 220px;
|
|
|
- // height: 30px;
|
|
|
- // background-color: #f4f7f9 !important;
|
|
|
- // z-index: 1;
|
|
|
- // }
|
|
|
.footer {
|
|
|
position: absolute;
|
|
|
bottom: 30px;
|
|
@@ -244,20 +165,13 @@ export default {
|
|
|
height: 24px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
- .expandhover:hover {
|
|
|
- background: url('../../assets/img/btn_collpaseright.png') no-repeat;
|
|
|
- // background-color: rgba(39, 135, 241,0.4);
|
|
|
- background-size: 100% 100%;
|
|
|
- }
|
|
|
- .packuphover:hover {
|
|
|
- background: url('../../assets/img/btn_collpaseleft.png') no-repeat;
|
|
|
- // background-color: rgba(39, 135, 241,0.4);
|
|
|
- background-size: 100% 100%;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+.el-menu {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
|
|
|
-.sidebar-el-menu > .el-submenu.is-opened > .el-submenu__title {
|
|
|
+.sidebar-el-menu .el-submenu.is-opened > .el-submenu__title {
|
|
|
//设置一级菜单点开后的状态
|
|
|
color: #fff !important;
|
|
|
background: rgb(44, 53, 74);
|
|
@@ -266,28 +180,27 @@ export default {
|
|
|
.sidebar-el-menu > .el-submenu.is-opened > .el-menu--inline > .el-submenu.is-opened > .el-submenu__title {
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
-.sidebar-el-menu > .el-submenu.is-opened.is-active > .el-submenu__title {
|
|
|
+.sidebar-el-menu > div > .el-submenu.is-opened.is-active > .el-submenu__title {
|
|
|
background: #2c354a !important;
|
|
|
border-radius: 32px 0px 0px 32px;
|
|
|
- color: $mainTextColor !important;
|
|
|
-
|
|
|
- border-right: 2px solid $mainTextColor;
|
|
|
+ color: rgb(39, 135, 241) !important;
|
|
|
+ border-right: 2px solid #2787f1;
|
|
|
.el-submenu__icon-arrow::before {
|
|
|
- color: $mainTextColor;
|
|
|
+ color: rgb(39, 135, 241);
|
|
|
}
|
|
|
}
|
|
|
.el-menu-item.is-active {
|
|
|
- // color:rgb(39, 135, 241);
|
|
|
- color: $mainTextColor;
|
|
|
+ color: rgb(39, 135, 241);
|
|
|
}
|
|
|
-// .el-submenu.is-active > div > span {
|
|
|
-// color: rgb(39, 135, 241);
|
|
|
-// }
|
|
|
+.el-submenu.is-active > div > span {
|
|
|
+ color: rgb(39, 135, 241);
|
|
|
+}
|
|
|
+
|
|
|
.sidebar .logo.shrink {
|
|
|
display: flex;
|
|
|
font-size: 16px;
|
|
|
justify-content: center;
|
|
|
- color: $mainTextColor;
|
|
|
+ // color: $mainTextColor;
|
|
|
border-bottom: 2px solid #2a335c;
|
|
|
margin-bottom: 20px;
|
|
|
align-items: flex-start;
|
|
@@ -301,19 +214,35 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// .sidebar .logo.shrink {
|
|
|
+// display: flex;
|
|
|
+// justify-content: center;
|
|
|
+// color: #2787f1;
|
|
|
+// border-bottom: 2px solid #2a335c;
|
|
|
+// margin-bottom: 20px;
|
|
|
+// align-items: flex-start;
|
|
|
+// .text {
|
|
|
+// width: 48px;
|
|
|
+// height: 48px;
|
|
|
+// background: rgba(255, 255, 255, 0.1);
|
|
|
+// border-radius: 4px;
|
|
|
+// border: 1px solid rgba(255, 255, 255, 0.4);
|
|
|
+// text-align: center;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
.el-menu--collapse > .is-active {
|
|
|
- color: $mainTextColor;
|
|
|
+ color: #2787f1;
|
|
|
+
|
|
|
background: #2c354a;
|
|
|
border-radius: 32px 0px 0px 32px;
|
|
|
- // margin:0;
|
|
|
}
|
|
|
+
|
|
|
.el-menu--collapse > .is-active > .el-submenu__title {
|
|
|
background: transparent !important;
|
|
|
}
|
|
|
.el-submenu > .el-submenu__title:hover {
|
|
|
//设置一级菜单的鼠标经过时候的样式
|
|
|
- // background: linear-gradient(to right, rgba(39,135,241,0.2) 20%, black 100%);
|
|
|
- // border-radius: 0;
|
|
|
background: rgb(44, 53, 74) !important;
|
|
|
border-radius: 32px 0px 0px 32px !important;
|
|
|
}
|