import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
	history: createWebHistory(import.meta.env.BASE_URL),
	routes: [
		{
			path: '/',
			name: '$app',
			component: () => import('@/pages/$app/index.vue'),
			children: [
				{
					path: '/procurementPlanningList',
					name: 'procurementPlanningList',
					component: () => import('@/pages/procurementPlanning/list/index.vue'),
					meta: { name: '询价计划' }
				},
				{
					path: '/procurementPlanningAdd',
					name: 'procurementPlanningAdd',
					component: () => import('@/pages/procurementPlanning/add/index.vue'),
					meta: { name: '新增', parent: '询价计划' }
				},
				{
					path: '/procurementPlanningDetailedList',
					name: 'procurementPlanningDetailedList',
					component: () => import('@/pages/procurementPlanning/detailedList/index.vue'),
					meta: { name: '物资清单', parent: '询价计划' }
				},
				{
					path: '/sourcingRelease',
					name: 'sourcingRelease',
					component: () => import('@/pages/sourcingSupplier/release/index.vue'),
					meta: { name: '发布寻源' }
				},
				{
					path: '/sourcingProgress',
					name: 'sourcingProgress',
					component: () => import('@/pages/sourcingSupplier/progress/index.vue'),
					meta: { name: '寻源进展' }
				},
				{
					path: '/supplierList',
					name: 'supplierList',
					component: () => import('@/pages/sourcingSupplier/supplierList/index.vue'),
					meta: { name: '入驻申请' }
				},
				{
					path: '/supplierLedger',
					name: 'supplierLedger',
					component: () => import('@/pages/sourcingSupplier/supplierLedger/index.vue'),
					meta: { name: '供应商台账' }
				},
				{
					path: '/quotation',
					name: 'quotation',
					component: () => import('@/pages/materialInfo/quotation/index.vue'),
					meta: { name: '材料报价' }
				},
				{
					path: '/quotation2',
					name: 'quotation2',
					component: () => import('@/pages/materialInfo/quotation2/index.vue'),
					meta: { name: '材料报价' }
				},
				{
					path: '/g2',
					name: 'g2',
					component: () => import('@/pages/g2/index.vue'),
					meta: { name: '数据分析' }
				},
				{
					path: '/:pathMatch(.*)',
					redirect: 'procurementPlanningList'
				}
			]
		},
		{
			path: '/supplier',
			name: 'supplier',
			component: () => import('@/pages/supplier/index/index.vue'),
			children: [
				{
					path: '/settleIn',
					name: 'settleIn',
					component: () => import('@/pages/supplier/settleIn/index.vue'),
					meta: { name: '供应商入驻' }
				},
				{
					path: '/itemList',
					name: 'itemList',
					component: () => import('@/pages/supplier/item/list/index.vue'),
					meta: { name: '材料价格管理' }
				},
				{
					path: '/demandList',
					name: 'demandList',
					component: () => import('@/pages/supplier/demandList/index.vue'),
					meta: { name: '采购方寻源' }
				},
				{
					path: '/plainList',
					name: 'plainList',
					component: () => import('@/pages/supplier/plainList/index.vue'),
					meta: { name: '询价计划' }
				},
				{
					path: '/materialList',
					name: 'materialList',
					component: () => import('@/pages/supplier/plainList/materialList.vue'),
					meta: { name: 'XX询价计划清单' }
				},
				{
					path: '/itemAdd',
					name: 'itemAdd',
					component: () => import('@/pages/supplier/item/add/index.vue'),
					meta: { name: '新增', parent: '材料价格管理' }
				},
				{
					path: '/evaluateDetail',
					name: 'evaluateDetail',
					component: () => import('@/pages/supplier/evaluate/detail/index.vue'),
					meta: { name: '查看', parent: '评价记录' }
				},
				{
					path: '/evaluateList',
					name: 'evaluateList',
					component: () => import('@/pages/supplier/evaluate/list/index.vue'),
					meta: { name: '评价记录' }
				},
				{
					path: '/:pathMatch(.*)',
					redirect: 'settleIn'
				}
			]
		},
		{
			path: '/index',
			name: 'index',
			component: () => import('@/pages/index/index.vue')
		},
		{
			path: '/vuex',
			name: 'vuex',
			component: () => import('@/pages/vuex/index.vue')
		},
		{
			path: '/:pathMatch(.*)',
			redirect: 'procurementPlanningList'
		}
	]
})

export default router
