中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

172 lines
5.1 KiB

<template>
<el-watermark :content="watermark" style="height: 100%">
<div class="avue-contail" :class="{ 'avue--collapse': isCollapse }">
<top ref="top" v-if="setting.styleRadio == '3'" />
<div class="avue-layout" :class="{ 'avue-layout--horizontal': isHorizontal }"
:style="{ height: setting.styleRadio == '3' ? 'calc(100% - 50px)' : '100%' }">
<div class="avue-sidebar" v-show="validSidebar"
:class="setting.styleRadio == '2' ? 'styleRadio' : setting.styleRadio == '3' || setting.styleRadio == '5' ? 'thirdBar' : ''">
<!-- 左侧导航栏 -->
<logo v-if="setting.styleRadio == '1' || setting.styleRadio == '4' || setting.styleRadio == '5'" />
<sidebar />
</div>
<div class="avue-main">
<!-- 顶部导航栏 -->
<top ref="top" v-if="setting.styleRadio != '3'" />
<!-- 顶部标签卡 -->
<tags />
<search class="avue-view" v-show="isSearch"></search>
<!-- 主体视图层 -->
<div id="avue-view" v-show="!isSearch" v-if="isRefresh">
<router-view #="{ Component }">
<keep-alive :include="$store.getters.tagsKeep">
<component :is="Component" />
</keep-alive>
</router-view>
</div>
</div>
</div>
<!-- <wechat></wechat> -->
</div>
</el-watermark>
</template>
<script>
import index from '@/mixins/index';
import wechat from './wechat.vue';
//import { validatenull } from 'utils/validate';
import { mapGetters } from 'vuex';
import tags from './tags.vue';
import search from './search.vue';
import logo from './logo.vue';
import top from './top/index.vue';
import sidebar from './sidebar/index.vue';
import website from '@/config/website';
export default {
mixins: [index],
components: {
top,
logo,
tags,
search,
sidebar,
wechat,
},
name: 'index',
provide() {
return {
index: this,
leftMenu: []
};
},
computed: {
...mapGetters([
'isHorizontal',
'isRefresh',
'isLock',
'isCollapse',
'isSearch',
'menu',
'setting',
'leftMenu',
'selectIndex', 'selectedIndex'
]),
validSidebar() {
return !(
(this.$route.meta || {}).menu === false || (this.$route.query || {}).menu === 'false'
);
},
watermark() {
return website.watermark.mode ? website.watermark.text : '';
},
},
props: [],
methods: {
//打开菜单 风格2
openMenu2(item = {}) {
if (!item.id) {
this.$store.dispatch('GetMenu', item.id).then(data => {
if (data.length !== 0) {
this.$router.$avueRouter.formatRoutes(data, true);
}
//当点击顶部菜单后默认打开第一个菜单
/*if (!this.validatenull(item)) {
let itemActive = {},
childItemActive = 0;
if (item.path) {
itemActive = item;
} else {
if (this.menu[childItemActive].length === 0) {
itemActive = this.menu[childItemActive];
} else {
itemActive = this.menu[childItemActive].children[childItemActive];
}
}
this.$store.commit('SET_MENU_ID', item);
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: (itemActive.label || itemActive.name),
src: itemActive.path
}, itemActive.meta)
});
}*/
});
} else {
if (item.children.length !== 0) {
this.$store.commit('SET_LEFT_MENU', item.children);
let tmpIndex = item.children.findIndex(item1 => item1.id == this.selectedIndex)
let index = tmpIndex == '-1' ? 0 : tmpIndex
this.$store.commit('SET_SELECT_INDEX', index);
// setStore({ name: 'left_menu', content: item.children });
// this.$router.$avueRouter.formatRoutes(item.children, true);
}
}
},
//打开菜单
openMenu(item = {}) {
this.$store.dispatch('GetMenu', item.id).then(data => {
if (data.length !== 0) {
this.$router.$avueRouter.formatRoutes(data, true);
}
//当点击顶部菜单后默认打开第一个菜单
/*if (!this.validatenull(item)) {
let itemActive = {},
childItemActive = 0;
if (item.path) {
itemActive = item;
} else {
if (this.menu[childItemActive].length === 0) {
itemActive = this.menu[childItemActive];
} else {
itemActive = this.menu[childItemActive].children[childItemActive];
}
}
this.$store.commit('SET_MENU_ID', item);
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: (itemActive.label || itemActive.name),
src: itemActive.path
}, itemActive.meta)
});
}*/
});
},
},
};
</script>
<style lang="scss" scoped>
.avue-sidebar {
overflow: auto;
}
.styleRadio {
margin-right: 8px !important;
}
.thirdBar {
width: auto !important;
}
</style>