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.

174 lines
4.0 KiB

3 years ago
<template>
<el-container>
<el-header class="nav-container">
<navbar
:nav-index="1"
@nav-items-click="navClick"/>
</el-header>
<el-container>
<el-aside
width="auto"
class="aside-container">
<sidebar
:items="sidebarItems"
main-router="sys">
<div
slot="add"
class="quick-add">
<div class="quick-add-content">
<p
v-for="(item, index) in list"
:key="index"
@click="addSkip(item)">
<i
:class="item.icon"
class="iconfont"/>
<span>{{ item.label }}</span>
</p>
</div>
</div>
</sidebar>
</el-aside>
<el-main
id="workbench-main-container">
<div :class="{'fixed-header':fixedHeader}">
<tags-view v-if="needTagsView" />
</div>
<app-main/>
</el-main>
</el-container>
</el-container>
</template>
<script>
import { mapGetters,mapState } from 'vuex'
import { Navbar, Sidebar, AppMain,TagsView } from './components'
export default {
name: 'Layout',
components: {
Navbar,
Sidebar,
AppMain,
TagsView
},
data() {
return {
addDialog: false,
list: [
{
label: '日志',
icon: 'log',
},
{
label: '审批',
icon: 'examine',
},
{
label: '任务',
icon: 'task',
},
{
label: '日程',
icon: 'schedule',
},
{
label: '公告',
icon: 'notice',
}
],
// 新建
showCategorySelect: false,
isCreate: false, // 是创建
createInfo: {} // 创建所需要的id 标题名信息
}
},
computed: {
...mapGetters([ 'sysRouters','roles']),
...mapState({
sidebar: state => state.app.sidebar,
device: state => state.app.device,
showSettings: state => state.settings.showSettings,
needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader
}),
sidebarItems() {
// return workbenchTestRouterMenu
for (let index = 0; index < workbenchTestRouterMenu.length; index++) {
const routerMenuItem = workbenchTestRouterMenu[index]
for(let j=0;j<routerMenuItem.children.length;j++){
if(routerMenuItem.children[j].meta.roles){
routerMenuItem.children[j].hidden = !this.in_array(routerMenuItem.children[j].meta.roles,this.roles)
}
}
}
return workbenchTestRouterMenu
}
},
created() {
},
methods: {
navClick(index) {
},
in_array(stringToSearch, arrayToSearch) {
for (let s = 0; s < arrayToSearch.length; s++) {
const thisEntry = arrayToSearch[s].toString();
if (thisEntry == stringToSearch) {
return true;
}
}
return false;
},
// 新增跳转
addSkip(val) {
switch (val.label) {
case '日志':
// this.$router.push({ path: 'journal', query: { routerKey: 1 }})
break
case '审批':
this.showCategorySelect = true
break
case '任务':
// this.$router.push({ path: 'task', query: { routerKey: 1 }})
break
case '日程':
//this.$router.push({ path: 'schedule-new', query: { routerKey: 1 }})
break
case '公告':
//this.$router.push({ path: 'notice-new', query: { routerKey: 1 }})
break
}
},
}
}
</script>
<style lang="scss" scoped>
@import './styles/common.scss';
.el-container {
min-height: 0;
}
.aside-container {
position: relative;
background-color: #2d3037;
box-sizing: border-box;
border-right: solid 1px #e6e6e6;
overflow: visible;
}
.nav-container {
padding: 0;
box-shadow: 0px 1px 2px #dbdbdb;
z-index: 100;
min-width: 1200px;
height: 45px !important;
}
.quick-add {
height: 178px;
}
</style>