<template>
	<div class="main1">
		<div class="main-top2">
			<div class="FengXianDIV1">
				<img class="img" src="@/assets/images/wd.png" width="29" height="25" />
				<span class="title">{{ title }}</span>
			</div>
			<div class="GeneralSelectDiv1">
				<div class="item bg_tool">工具/发送区</div>
				<div class="item bg_statistics">统计/分析区</div>
				<div class="item bg_set">设置/编辑区</div>
			</div>
			<!-- <div class="clearboth"></div> -->
		</div>
		<div class="conent">
			<div class="area border_sending">
				<div class="area_item bg_tool" v-for="item in sendingList" :key="item.menuId">
					<a href="javascript:void(0);" title="" @click="pageTo(item)">{{ item.menuName }}</a>
					<a href="javascript:void(0);"><i class="el-icon-s-promotion" @click="addShortcutMenu(item)"></i></a>
				</div>
			</div>
			<div class="area border_analysis">
				<div class="area_item bg_statistics" v-for="item in analysisList" :key="item.menuId">
					<a href="javascript:void(0);" title="" @click="pageTo(item)">{{ item.menuName }}</a>
					<a href="javascript:void(0);"><i class="el-icon-s-promotion" @click="addShortcutMenu(item)"></i></a>
				</div>
			</div>
			<div class="area">
				<div class="area_item bg_set" v-for="item in editList" :key="item.menuId">
					<a href="javascript:void(0);" title="" @click="pageTo(item)">{{ item.menuName }}</a>
					<a href="javascript:void(0);"><i class="el-icon-s-promotion" @click="addShortcutMenu(item)"></i></a>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import EventBus from "@/utils/eventBus";
export default {
	data() {
		return {
			// 标题
			title: undefined,
			// 文档列表
			docList: [],
			// 当前父菜单对象
			currentMenu: {},
			// 菜单位置
			type: undefined,
			//当前菜单路由id
			routeId: undefined,
			sendingList: [], // 工具/发送区列表
			analysisList: [], // 统计/分析区列表
			editList: [] // 设置/编辑区列表
		}
	},
	computed: {},
	watch: {
		// 监听路由跳转
		$route: {
			handler: function (route) {
				this.routeId = route.query.id
				this.title = route.query.title
				this.init(this.routeId)
			},
			//一进页面就执行
			immediate: true
			//deep:true
		}
	},
	methods: {
		// 获取菜单
		init(routeId) {
			if (this.$store.state.permission.routes) {
				const routes = this.$store.state.permission.routes
				this.$nextTick(() => {
					this.docList = routes.filter((item, index, c) => item.parentId == routeId)
					// 工具/发送区列表
					this.sendingList = this.docList.filter((item, index, c) => item.menuCategory == 0)
					// 统计/分析区列表
					this.analysisList = this.docList.filter((item, index, c) => item.menuCategory == 1)
					// 设置/编辑区列表
					this.editList = this.docList.filter((item, index, c) => item.menuCategory == 2)
				})
			}
		},
		// 页面跳转
		pageTo(item) {
			this.$router.push({ path: item.path })
		},
		// 添加快捷菜单
		addShortcutMenu(item) {
			EventBus.$emit("addShortcutMenu", item)
		},
	}
}
</script>

<style scoped lang="scss">
.main1 {
	min-height: calc(100vh);
	padding: 10px 10px 0 10px;
	box-shadow: #dac488 0px 0px 14px inset;
	background-color: #000;
}
.main-top2 {
	position: relative;
	height: 60px;
	border-bottom: 2px solid #ffeb9c;
	width: 100%;
}
.FengXianDIV1 {
	height: 60px;
	line-height: 60px;
	border-top-left-radius: 6px;
	border-top-right-radius: 6px;
	background-color: #ffeb9c;
	min-width: 177px;
	float: left;
	color: #000;
	font-size: 20px;
	font-weight: 600;
	display: flex;
	img {
		margin: 16px 15px 16px 12px;
		width: 29px;
		height: 25px;
	}
}
.GeneralSelectDiv1 {
	display: flex;
}
.item {
	width: 160px;
	height: 45px;
	margin-left: 5px;
	margin-top: 10px;
	border-radius: 5px;
	line-height: 45px;
	text-align: center;
	color: #000;
	font-size: 16px;
	font-weight: 600;
}
.area {
	display: flex;
	flex-wrap: wrap;
	padding: 26px 5px;
}
.area_item {
	position: relative;
	width: 160px;
	height: 50px;
	border-radius: 5px;
	line-height: 50px;
	text-align: center;
	margin: 5px 5px;
	a {
		color: #000;
		font-size: 16px;
		font-weight: 400;
	}
}
.bg_tool {
	background: #c2e6f2;
}
.bg_statistics {
	background: #c6efcd;
}
.bg_set {
	background: #fcf2d5;
}
.border_sending {
	border-bottom: #c2e6f2 1px solid;
}
.border_analysis {
	border-bottom: #c6efcd 1px solid;
}
.el-icon-s-promotion{
	position: absolute;
	right: 5%;
	top: 55%;
	font-size: 19px;
	color: #000;
}
</style>
