import {
	createRouter,
	createWebHashHistory,
} from "vue-router";

const routes = [
	{
		path: "/",
		redirect: "/index"
	},
	{
		icon: "menuIcon el-icon el-icon-s-home", // 菜单所用 icon 
		path: "/index", // 菜单 path
		name: "首页", // 菜单显示的名称
		component: () => import("../views/layout/home.vue"),
	},
	{
		icon: "menuIcon el-icon el-icon-postcard",
		path: "/sample",
		name: "样本",
		component: () => import("../views/fault/router/index.vue"),
		children: [{
			path: "fault",
			name: "故障样本",
			component: () => import("../views/fault/faultreal.vue"),
		},
		{
			path: "diagnose",
			name: "诊断样本",
			component: () => import("../views/fault/faultdiagnose.vue"),
		},
		{
			path: "warning",
			name: "预警样本",
			component: () => import("../views/fault/warncustom.vue"),
		}]
	},
	{
		icon: "menuIcon el-icon el-icon-document",
		path: "/know",
		name: "知识库",
		component: () => import("../views/know/router/index.vue"),
		children: [{
			path: "fault/category",
			name: "故障类型",
			component: () => import("../views/know/faultcategory.vue"),
		},
		{
			path: "warning/category",
			name: "报警类型",
			component: () => import("../views/know/warncategory.vue"),
		},
		{
			path: "maintenance/rule",
			name: "检修规则",
			component: () => import("../views/know/maintenancerule.vue"),
		},
		{
			path: "fault/manual",
			name: "故障手册",
			component: () => import("../views/know/faultmanual.vue"),
		},
		{
			path: "weather/forecast",
			name: "天气数据",
			component: () => import("../views/weather/weatherforecast.vue"),
		}]
	},
	{
		icon: "menuIcon el-icon el-icon-info",
		path: "/basicinfo",
		name: "基础配置",
		component: () => import("../views/basicinfo/router/index.vue"),
		children: [{
			path: "station",
			name: "场站数据",
			component: () => import("../views/basicinfo/station.vue"),
		},
		{
			path: "windturbine",
			name: "风机详情",
			component: () => import("../views/basicinfo/windturbine.vue"),
		}]
	},
	{
		path: "/:catchAll(.*)",
		name: "404",
		component: () => import("../views/404.vue"),
	},
];

const router = createRouter({
	history: createWebHashHistory(),
	routes
});

// router.beforeEach((to, from, next) => {
// 	next();
// });

export default router;