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.
 
 
 
 
 
 

154 lines
3.8 KiB

<template>
<el-container>
<el-header class="nav-container">
<navbar :nav-index="0" @nav-items-click="navClick" />
</el-header>
<el-container>
<el-aside width="auto" class="aside-container">
<sidebar :items="sidebarItems" main-router="first"> </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";
import { vueTestRouterMenu } from "@/router/modules/first";
import Lockr from "lockr";
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(["first", "firstRouters", "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() {
// const workbenchMenus = this.firstRouters.children
// console.log(this.firstRouters)
// return workbenchMenus
let currentUserRoles = Lockr.get("userRoles");
for (let index = 0; index < vueTestRouterMenu.length; index++) {
const routerMenuItem = vueTestRouterMenu[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 vueTestRouterMenu;
},
},
created() {},
methods: {
navClick(index) {},
// 新增跳转
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;
}
},
in_array(stringToSearch, arrayToSearch) {
for (let s = 0; s < arrayToSearch.length; s++) {
const thisEntry = arrayToSearch[s].toString();
if (thisEntry == stringToSearch) {
return true;
}
}
return false;
},
},
};
</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>