<!-- 面包屑导航 -->
<template>
	<div class='mainBreadcrumb'>
		<el-breadcrumb separator="/">
			<el-breadcrumb-item v-if="authority.username !== 'root'" :to="{ path: '/home' }">首页</el-breadcrumb-item>
			<el-breadcrumb-item v-if="authority.username === 'root'" :to="{ path: '/adminSetting' }">首页</el-breadcrumb-item>

			<el-breadcrumb-item v-if="currentRouter === '/taskManage' || currentRouter === '/addTask' || currentRouter === '/viewTask'" :to="{ path: '/taskManage' }">任务管理</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/addTask'" >新建任务</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/viewTask' || currentRouter === '/taskDetails' || currentRouter === '/unpublishedTask'" :to="{ path: '/viewTask' }">查看任务</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/departmentTask'" :to="{ path: '/departmentTask' }">部门任务</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/unpublishedTask'" >未发布任务</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/taskDetails'" >任务详情</el-breadcrumb-item>

			<el-breadcrumb-item v-if="currentRouter === '/personManage' || currentRouter === '/personDetails' || currentRouter === '/personInfo' || currentRouter === '/personList' || currentRouter === '/personTask'" :to="{ path: '/personManage' }">人员管理</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/personDetails'">个人信息</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/personList' || currentRouter === '/personTask'" :to="{ path: '/personList' }">人员列表</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/personInfo'">人员信息</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/personTask'">人员任务统计</el-breadcrumb-item>

			<el-breadcrumb-item v-if="currentRouter === '/paramsSetting'">参数配置</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/consumerManage' || currentRouter === '/consumerDetails' || currentRouter === '/createConsumer'" :to="{ path: '/consumerManage' }">用户管理</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/consumerDetails'">用户详情</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/createConsumer'">新增用户</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/roleManage'" :to="{ path: '/roleManage' }">角色管理</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/authorityManage'">权限管理</el-breadcrumb-item>
			<el-breadcrumb-item v-if="currentRouter === '/departmentManage'">部门管理</el-breadcrumb-item>

			<!--<el-breadcrumb-item>考勤管理</el-breadcrumb-item>-->
		</el-breadcrumb>
	</div>
</template>

<script>
	//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
	//例如：import 《组件名称》 from '《组件路径》';

	export default {
		name: "mainBreadcrumb",
//import引入的组件需要注入到对象中才能使用
		components: {},
		data () {
//这里存放数据
			return {
				authority: '',
				currentRouter: '',
			};
		},
//监听属性 类似于data概念
		computed: {},
//监控data中的数据变化
		watch: {
			$route(to){
				console.log(to.path);
				this.currentRouter = to.path;
			}
		},
//方法集合
		methods: {},
//生命周期 - 创建完成（可以访问当前this实例）
		created () {

		},
//生命周期 - 挂载完成（可以访问DOM元素）
		mounted () {
			let datas = JSON.parse(this.$Base64.decode(localStorage.getItem('login')));
			// console.log(datas)
			this.authority = datas;
			this.currentRouter = this.$route.path;
		},
		beforeCreate () {
		}, //生命周期 - 创建之前
		beforeMount () {
		}, //生命周期 - 挂载之前
		beforeUpdate () {
		}, //生命周期 - 更新之前
		updated () {
		}, //生命周期 - 更新之后
		beforeDestroy () {
		}, //生命周期 - 销毁之前
		destroyed () {
		}, //生命周期 - 销毁完成
		activated () {
		}, //如果页面有keep-alive缓存功能，这个函数会触发
	}
</script>
<style scoped>
	.mainBreadcrumb{

	}
</style>
