first commit
This commit is contained in:
@@ -0,0 +1,328 @@
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
|
||||
// 路由配置
|
||||
const routes = [
|
||||
// 登录页
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@/views/Login.vue'),
|
||||
meta: { title: '登录', requiresAuth: false }
|
||||
},
|
||||
|
||||
// 主框架
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/components/layout/MainLayout.vue'),
|
||||
redirect: '/dashboard',
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
// 经营仪表盘
|
||||
{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
component: () => import('@/views/Dashboard.vue'),
|
||||
meta: { title: '经营仪表盘', icon: 'fa-chart-line' }
|
||||
},
|
||||
|
||||
// 功能流程图
|
||||
{
|
||||
path: 'workflow',
|
||||
name: 'Workflow',
|
||||
component: () => import('@/views/Workflow.vue'),
|
||||
meta: { title: '功能流程图', icon: 'fa-project-diagram' }
|
||||
},
|
||||
|
||||
// ========== 日程安排 ==========
|
||||
{
|
||||
path: 'calendar',
|
||||
name: 'ScheduleCalendar',
|
||||
component: () => import('@/views/calendar/ScheduleCalendar.vue'),
|
||||
meta: { title: 'Schedule Calendar', icon: 'fa-calendar-week' }
|
||||
},
|
||||
|
||||
// ========== 客户管理 ==========
|
||||
{
|
||||
path: 'customer',
|
||||
name: 'CustomerList',
|
||||
component: () => import('@/views/customer/CustomerList.vue'),
|
||||
meta: { title: '客户管理', icon: 'fa-users' }
|
||||
},
|
||||
{
|
||||
path: 'customer/appointment',
|
||||
name: 'Appointment',
|
||||
component: () => import('@/views/customer/Appointment.vue'),
|
||||
meta: { title: '预约测量', icon: 'fa-calendar-check' }
|
||||
},
|
||||
{
|
||||
path: 'customer/measurement',
|
||||
name: 'MeasurementManage',
|
||||
component: () => import('@/views/customer/MeasurementManage.vue'),
|
||||
meta: { title: '测量管理', icon: 'fa-ruler-combined' }
|
||||
},
|
||||
|
||||
// ========== 测量报价 ==========
|
||||
{
|
||||
path: 'quote',
|
||||
name: 'QuoteMeasure',
|
||||
component: () => import('@/views/quote/QuoteMeasure.vue'),
|
||||
meta: { title: '测量报价', icon: 'fa-calculator' }
|
||||
},
|
||||
{
|
||||
path: 'quote/generate',
|
||||
name: 'QuoteGenerate',
|
||||
component: () => import('@/views/quote/QuoteGenerate.vue'),
|
||||
meta: { title: '报价表生成', icon: 'fa-file-invoice' }
|
||||
},
|
||||
|
||||
// ========== 订单管理 ==========
|
||||
{
|
||||
path: 'order',
|
||||
name: 'OrderList',
|
||||
component: () => import('@/views/order/OrderList.vue'),
|
||||
meta: { title: '订单管理', icon: 'fa-shopping-cart' }
|
||||
},
|
||||
{
|
||||
path: 'order/tracking',
|
||||
name: 'OrderTracking',
|
||||
component: () => import('@/views/order/OrderTracking.vue'),
|
||||
meta: { title: '订单跟踪', icon: 'fa-truck' }
|
||||
},
|
||||
{
|
||||
path: 'order/follow',
|
||||
name: 'OrderFollow',
|
||||
component: () => import('@/views/order/OrderFollow.vue'),
|
||||
meta: { title: '跟单页', icon: 'fa-clipboard-list' }
|
||||
},
|
||||
{
|
||||
path: 'order/detail',
|
||||
name: 'OrderDetail',
|
||||
component: () => import('@/views/order/OrderDetail.vue'),
|
||||
meta: { title: '定单明细', icon: 'fa-list-alt' }
|
||||
},
|
||||
{
|
||||
path: 'order/deal',
|
||||
name: 'OrderDeal',
|
||||
component: () => import('@/views/order/OrderDeal.vue'),
|
||||
meta: { title: '成交定单', icon: 'fa-handshake' }
|
||||
},
|
||||
{
|
||||
path: 'order/recheck',
|
||||
name: 'OrderRecheck',
|
||||
component: () => import('@/views/order/OrderRecheck.vue'),
|
||||
meta: { title: '复尺确认', icon: 'fa-check-double' }
|
||||
},
|
||||
|
||||
// ========== 生产管理 ==========
|
||||
{
|
||||
path: 'production/task',
|
||||
name: 'ProductionTask',
|
||||
component: () => import('@/views/production/ProductionTask.vue'),
|
||||
meta: { title: '生产任务板', icon: 'fa-tasks' }
|
||||
},
|
||||
{
|
||||
path: 'production/purchase',
|
||||
name: 'ProductionPurchase',
|
||||
component: () => import('@/views/production/ProductionPurchase.vue'),
|
||||
meta: { title: '生产采购', icon: 'fa-shopping-basket' }
|
||||
},
|
||||
{
|
||||
path: 'production/purchase-detail',
|
||||
name: 'ProductionPurchaseDetail',
|
||||
component: () => import('@/views/production/ProductionPurchaseDetail.vue'),
|
||||
meta: { title: '生产采购明细', icon: 'fa-list' }
|
||||
},
|
||||
|
||||
// ========== 安装管理 ==========
|
||||
{
|
||||
path: 'install/add',
|
||||
name: 'InstallAdd',
|
||||
component: () => import('@/views/install/InstallAdd.vue'),
|
||||
meta: { title: '新增安装', icon: 'fa-plus-circle' }
|
||||
},
|
||||
{
|
||||
path: 'install/task',
|
||||
name: 'InstallTask',
|
||||
component: () => import('@/views/install/InstallTask.vue'),
|
||||
meta: { title: '安装任务板', icon: 'fa-clipboard-check' }
|
||||
},
|
||||
{
|
||||
path: 'install/schedule',
|
||||
name: 'InstallSchedule',
|
||||
component: () => import('@/views/install/InstallSchedule.vue'),
|
||||
meta: { title: '安装人员排班表', icon: 'fa-calendar-alt' }
|
||||
},
|
||||
{
|
||||
path: 'install/complete',
|
||||
name: 'InstallComplete',
|
||||
component: () => import('@/views/install/InstallComplete.vue'),
|
||||
meta: { title: '帘窗安装完成', icon: 'fa-check-circle' }
|
||||
},
|
||||
|
||||
// ========== 售后管理 ==========
|
||||
{
|
||||
path: 'after-sale/reason',
|
||||
name: 'AfterSaleReason',
|
||||
component: () => import('@/views/aftersale/AfterSaleReason.vue'),
|
||||
meta: { title: '售后原因', icon: 'fa-question-circle' }
|
||||
},
|
||||
{
|
||||
path: 'after-sale/arrange',
|
||||
name: 'AfterSaleArrange',
|
||||
component: () => import('@/views/aftersale/AfterSaleArrange.vue'),
|
||||
meta: { title: '维修安排', icon: 'fa-tools' }
|
||||
},
|
||||
|
||||
// ========== 财务管理 ==========
|
||||
{
|
||||
path: 'finance/final-payment',
|
||||
name: 'FinalPayment',
|
||||
component: () => import('@/views/finance/FinalPayment.vue'),
|
||||
meta: { title: '收尾款', icon: 'fa-money-bill-wave' }
|
||||
},
|
||||
{
|
||||
path: 'finance/invoice',
|
||||
name: 'Invoice',
|
||||
component: () => import('@/views/finance/Invoice.vue'),
|
||||
meta: { title: '发票管理', icon: 'fa-file-invoice-dollar' }
|
||||
},
|
||||
|
||||
// ========== 采购库存 ==========
|
||||
{
|
||||
path: 'purchase/order',
|
||||
name: 'PurchaseOrder',
|
||||
component: () => import('@/views/purchase/PurchaseOrder.vue'),
|
||||
meta: { title: '采购订单', icon: 'fa-cart-plus' }
|
||||
},
|
||||
{
|
||||
path: 'purchase/supplier',
|
||||
name: 'Supplier',
|
||||
component: () => import('@/views/purchase/Supplier.vue'),
|
||||
meta: { title: '供应商管理', icon: 'fa-truck-loading' }
|
||||
},
|
||||
{
|
||||
path: 'purchase/inventory',
|
||||
name: 'Inventory',
|
||||
component: () => import('@/views/purchase/Inventory.vue'),
|
||||
meta: { title: '库存管理', icon: 'fa-boxes' }
|
||||
},
|
||||
|
||||
// ========== 产品管理 ==========
|
||||
{
|
||||
path: 'product/library',
|
||||
name: 'ProductLibrary',
|
||||
component: () => import('@/views/product/ProductLibrary.vue'),
|
||||
meta: { title: '产品库管理', icon: 'fa-cube' }
|
||||
},
|
||||
{
|
||||
path: 'product/material',
|
||||
name: 'ProductMaterial',
|
||||
component: () => import('@/views/product/ProductMaterial.vue'),
|
||||
meta: { title: '面料配件库', icon: 'fa-layer-group' }
|
||||
},
|
||||
|
||||
// ========== 人员管理 ==========
|
||||
{
|
||||
path: 'staff/measurer',
|
||||
name: 'MeasurerManage',
|
||||
component: () => import('@/views/staff/MeasurerManage.vue'),
|
||||
meta: { title: '测量师管理', icon: 'fa-user-tie' }
|
||||
},
|
||||
{
|
||||
path: 'staff/installer',
|
||||
name: 'InstallerManage',
|
||||
component: () => import('@/views/staff/InstallerManage.vue'),
|
||||
meta: { title: '安装师傅管理', icon: 'fa-hard-hat' }
|
||||
},
|
||||
|
||||
// ========== 系统设置 ==========
|
||||
{
|
||||
path: 'system/role',
|
||||
name: 'RolePermission',
|
||||
component: () => import('@/views/system/RolePermission.vue'),
|
||||
meta: { title: '角色权限', icon: 'fa-user-shield' }
|
||||
},
|
||||
{
|
||||
path: 'system/user',
|
||||
name: 'SystemUser',
|
||||
component: () => import('@/views/system/SystemUser.vue'),
|
||||
meta: { title: '系统用户', icon: 'fa-users-cog' }
|
||||
},
|
||||
{
|
||||
path: 'system/notification-template',
|
||||
name: 'NotificationTemplate',
|
||||
component: () => import('@/views/system/NotificationTemplate.vue'),
|
||||
meta: { title: '通知模板', icon: 'fa-bell' }
|
||||
},
|
||||
{
|
||||
path: 'system/work-time',
|
||||
name: 'WorkTime',
|
||||
component: () => import('@/views/system/WorkTime.vue'),
|
||||
meta: { title: '工作时间', icon: 'fa-clock' }
|
||||
},
|
||||
{
|
||||
path: 'system/message',
|
||||
name: 'MessageCenter',
|
||||
component: () => import('@/views/system/MessageCenter.vue'),
|
||||
meta: { title: '消息中心', icon: 'fa-envelope' }
|
||||
},
|
||||
|
||||
// ========== 数据分析 ==========
|
||||
{
|
||||
path: 'analysis/center',
|
||||
name: 'AnalysisCenter',
|
||||
component: () => import('@/views/analysis/AnalysisCenter.vue'),
|
||||
meta: { title: '数据分析中心', icon: 'fa-chart-bar' }
|
||||
},
|
||||
{
|
||||
path: 'analysis/report',
|
||||
name: 'ReportAnalysis',
|
||||
component: () => import('@/views/analysis/ReportAnalysis.vue'),
|
||||
meta: { title: '报表分析', icon: 'fa-chart-pie' }
|
||||
},
|
||||
{
|
||||
path: 'analysis/satisfaction',
|
||||
name: 'SatisfactionSurvey',
|
||||
component: () => import('@/views/analysis/SatisfactionSurvey.vue'),
|
||||
meta: { title: '满意度调查', icon: 'fa-smile' }
|
||||
},
|
||||
{
|
||||
path: 'analysis/channel',
|
||||
name: 'ChannelManage',
|
||||
component: () => import('@/views/analysis/ChannelManage.vue'),
|
||||
meta: { title: '渠道管理', icon: 'fa-network-wired' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 404
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'NotFound',
|
||||
component: () => import('@/views/NotFound.vue')
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
// 路由守卫
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 设置页面标题
|
||||
document.title = to.meta.title ? `${to.meta.title} · 窗帘工厂` : '窗帘工厂管理系统'
|
||||
|
||||
// 检查登录状态
|
||||
const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true'
|
||||
|
||||
if (to.meta.requiresAuth !== false && !isLoggedIn && to.path !== '/login') {
|
||||
next('/login')
|
||||
} else if (to.path === '/login' && isLoggedIn) {
|
||||
next('/dashboard')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user