routes.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. import type { RouteRecordRaw } from 'vue-router';
  2. import AppLayout from '@/layout/AppLayout.vue';
  3. import type { UserRole } from '@/types/page';
  4. const allRoles: UserRole[] = ['admin', 'manager', 'operator', 'procurement', 'warehouse', 'customer_service'];
  5. export const routes: RouteRecordRaw[] = [
  6. {
  7. path: '/login',
  8. name: 'login',
  9. component: () => import('@/views/auth/LoginView.vue'),
  10. meta: { public: true, title: '登录' }
  11. },
  12. {
  13. path: '/',
  14. component: AppLayout,
  15. redirect: '/report/dashboard',
  16. meta: { requiresAuth: true },
  17. children: [
  18. {
  19. path: '/report/dashboard',
  20. name: 'report-dashboard',
  21. component: () => import('@/views/dashboard/ReportDashboardView.vue'),
  22. meta: { title: '运营看板', pageKey: 'report-dashboard', roles: ['admin', 'manager', 'operator', 'procurement'] }
  23. },
  24. {
  25. path: '/report/center',
  26. name: 'report-center',
  27. component: () => import('@/views/report/ReportCenterView.vue'),
  28. meta: { title: '报表中心', pageKey: 'report-center', roles: ['admin', 'manager', 'operator', 'procurement'] }
  29. },
  30. {
  31. path: '/product/list',
  32. name: 'product-list',
  33. component: () => import('@/views/product/ProductListView.vue'),
  34. meta: { title: '商品列表', pageKey: 'product-list', roles: ['admin', 'manager', 'operator'] }
  35. },
  36. {
  37. path: '/product/editor',
  38. name: 'product-editor',
  39. component: () => import('@/views/product/ProductEditorView.vue'),
  40. meta: { title: '商品新建/编辑', pageKey: 'product-editor', roles: ['admin', 'manager', 'operator'] }
  41. },
  42. {
  43. path: '/product/mapping',
  44. name: 'product-mapping',
  45. component: () => import('@/views/product/ProductMappingView.vue'),
  46. meta: { title: '渠道映射', pageKey: 'product-mapping', roles: ['admin', 'manager', 'operator'] }
  47. },
  48. {
  49. path: '/product/pricing',
  50. name: 'product-pricing',
  51. component: () => import('@/views/product/ProductPricingView.vue'),
  52. meta: { title: '定价与库存规则', pageKey: 'product-pricing', roles: ['admin', 'manager', 'operator'] }
  53. },
  54. {
  55. path: '/order/list',
  56. name: 'order-list',
  57. component: () => import('@/views/order/OrderListView.vue'),
  58. meta: { title: '订单列表', pageKey: 'order-list', roles: ['admin', 'manager', 'operator', 'customer_service', 'warehouse'] }
  59. },
  60. {
  61. path: '/order/detail',
  62. name: 'order-detail',
  63. component: () => import('@/views/order/OrderDetailView.vue'),
  64. meta: { title: '订单详情/处理', pageKey: 'order-detail', roles: ['admin', 'manager', 'operator', 'customer_service', 'warehouse'] }
  65. },
  66. {
  67. path: '/order/after-sale',
  68. name: 'order-after-sale',
  69. component: () => import('@/views/order/OrderAfterSaleView.vue'),
  70. meta: { title: '售后处理', pageKey: 'order-after-sale', roles: ['admin', 'manager', 'operator', 'customer_service'] }
  71. },
  72. {
  73. path: '/supplier/list',
  74. name: 'supplier-list',
  75. component: () => import('@/views/supplier/SupplierListView.vue'),
  76. meta: { title: '供应商管理', pageKey: 'supplier-list', roles: ['admin', 'manager', 'procurement'] }
  77. },
  78. {
  79. path: '/supplier/purchase-orders',
  80. name: 'purchase-orders',
  81. component: () => import('@/views/supplier/PurchaseOrderView.vue'),
  82. meta: { title: '采购单管理', pageKey: 'purchase-orders', roles: ['admin', 'manager', 'procurement'] }
  83. },
  84. {
  85. path: '/supplier/capability',
  86. name: 'supply-capability',
  87. component: () => import('@/views/supplier/SupplyCapabilityView.vue'),
  88. meta: { title: '供货能力配置', pageKey: 'supply-capability', roles: ['admin', 'manager', 'procurement'] }
  89. },
  90. {
  91. path: '/channel/config',
  92. name: 'channel-config',
  93. component: () => import('@/views/channel/ChannelConfigView.vue'),
  94. meta: { title: '渠道接入配置', pageKey: 'channel-config', roles: ['admin', 'manager', 'operator'] }
  95. },
  96. {
  97. path: '/inventory/overview',
  98. name: 'inventory-overview',
  99. component: () => import('@/views/inventory/InventoryOverviewView.vue'),
  100. meta: { title: '库存总览', pageKey: 'inventory-overview', roles: ['admin', 'manager', 'operator', 'procurement', 'warehouse'] }
  101. },
  102. {
  103. path: '/inventory/shipping',
  104. name: 'shipping-work',
  105. component: () => import('@/views/inventory/ShippingWorkView.vue'),
  106. meta: { title: '发货作业', pageKey: 'shipping-work', roles: ['admin', 'manager', 'warehouse'] }
  107. },
  108. {
  109. path: '/inventory/logs',
  110. name: 'inventory-logs',
  111. component: () => import('@/views/warehouse/InventoryLogView.vue'),
  112. meta: { title: '库存变动记录', pageKey: 'inventory-logs', roles: ['admin', 'manager', 'operator', 'warehouse'] }
  113. },
  114. {
  115. path: '/warehouse/manage',
  116. name: 'warehouse-manage',
  117. component: () => import('@/views/warehouse/WarehouseView.vue'),
  118. meta: { title: '仓库管理', pageKey: 'warehouse-manage', roles: ['admin', 'manager'] }
  119. },
  120. {
  121. path: '/logistics/providers',
  122. name: 'logistics-providers',
  123. component: () => import('@/views/logistics/LogisticsProviderView.vue'),
  124. meta: { title: '物流商配置', pageKey: 'logistics-providers', roles: ['admin', 'manager', 'operator'] }
  125. },
  126. {
  127. path: '/logistics/templates',
  128. name: 'shipping-templates',
  129. component: () => import('@/views/logistics/ShippingTemplateView.vue'),
  130. meta: { title: '运费模板', pageKey: 'shipping-templates', roles: ['admin', 'manager', 'operator'] }
  131. },
  132. {
  133. path: '/finance/payments',
  134. name: 'finance-payments',
  135. component: () => import('@/views/finance/PaymentView.vue'),
  136. meta: { title: '收款管理', pageKey: 'finance-payments', roles: ['admin', 'manager', 'finance'] }
  137. },
  138. {
  139. path: '/procurement/replenishment',
  140. name: 'replenishment-plan',
  141. component: () => import('@/views/procurement/ReplenishmentPlanView.vue'),
  142. meta: { title: '备货计划', pageKey: 'replenishment-plan', roles: ['admin', 'manager', 'procurement'] }
  143. },
  144. {
  145. path: '/crm/tickets',
  146. name: 'crm-tickets',
  147. component: () => import('@/views/crm/TicketView.vue'),
  148. meta: { title: '工单管理', pageKey: 'crm-tickets', roles: ['admin', 'manager', 'customer_service'] }
  149. },
  150. {
  151. path: '/system/roles',
  152. name: 'role-permission',
  153. component: () => import('@/views/system/RolePermissionView.vue'),
  154. meta: { title: '角色权限', pageKey: 'role-permission', roles: ['admin'] }
  155. },
  156. {
  157. path: '/system/logs',
  158. name: 'operation-log',
  159. component: () => import('@/views/system/OperationLogView.vue'),
  160. meta: { title: '操作日志', pageKey: 'operation-log', roles: ['admin', 'manager'] }
  161. },
  162. {
  163. path: '/system/api-keys',
  164. name: 'api-key',
  165. component: () => import('@/views/system/ApiKeyView.vue'),
  166. meta: { title: 'API Key 管理', pageKey: 'api-key', roles: ['admin'] }
  167. },
  168. {
  169. path: '/warehouse/return-package',
  170. name: 'return-package',
  171. component: () => import('@/views/warehouse/ReturnPackageView.vue'),
  172. meta: { title: '退件管理', pageKey: 'return-package', roles: ['admin', 'manager', 'warehouse'] }
  173. },
  174. {
  175. path: '/finance/refund',
  176. name: 'finance-refund',
  177. component: () => import('@/views/finance/RefundView.vue'),
  178. meta: { title: '退款管理', pageKey: 'finance-refund', roles: ['admin', 'manager', 'finance'] }
  179. },
  180. {
  181. path: '/finance/settlement',
  182. name: 'supplier-settlement',
  183. component: () => import('@/views/finance/SupplierSettlementView.vue'),
  184. meta: { title: '供应商结算', pageKey: 'supplier-settlement', roles: ['admin', 'manager', 'finance'] }
  185. },
  186. {
  187. path: '/marketing/promotion',
  188. name: 'marketing-promotion',
  189. component: () => import('@/views/marketing/PromotionView.vue'),
  190. meta: { title: '促销活动', pageKey: 'marketing-promotion', roles: ['admin', 'manager', 'operator'] }
  191. },
  192. {
  193. path: '/report/inventory-turnover',
  194. name: 'inventory-turnover',
  195. component: () => import('@/views/report/InventoryTurnoverView.vue'),
  196. meta: { title: '库存周转分析', pageKey: 'inventory-turnover', roles: ['admin', 'manager', 'procurement'] }
  197. },
  198. {
  199. path: '/procurement/purchase-request',
  200. name: 'purchase-request',
  201. component: () => import('@/views/procurement/PurchaseRequestView.vue'),
  202. meta: { title: '采购需求申请', pageKey: 'purchase-request', roles: ['admin', 'manager', 'procurement'] }
  203. },
  204. {
  205. path: '/procurement/iqc',
  206. name: 'procurement-iqc',
  207. component: () => import('@/views/procurement/IQCView.vue'),
  208. meta: { title: '来料质检', pageKey: 'procurement-iqc', roles: ['admin', 'manager', 'procurement', 'warehouse'] }
  209. },
  210. {
  211. path: '/system/notification',
  212. name: 'system-notification',
  213. component: () => import('@/views/system/NotificationView.vue'),
  214. meta: { title: '消息中心', pageKey: 'system-notification', roles: ['admin', 'manager'] }
  215. },
  216. {
  217. path: '/system/message-template',
  218. name: 'message-template',
  219. component: () => import('@/views/system/MessageTemplateView.vue'),
  220. meta: { title: '消息模板', pageKey: 'message-template', roles: ['admin', 'manager'] }
  221. },
  222. {
  223. path: '/system/approval-flow',
  224. name: 'approval-flow',
  225. component: () => import('@/views/system/ApprovalFlowView.vue'),
  226. meta: { title: '审批流程', pageKey: 'approval-flow', roles: ['admin'] }
  227. },
  228. {
  229. path: '/finance/invoice',
  230. name: 'finance-invoice',
  231. component: () => import('@/views/finance/InvoiceView.vue'),
  232. meta: { title: '发票管理', pageKey: 'finance-invoice', roles: ['admin', 'manager', 'finance'] }
  233. },
  234. {
  235. path: '/marketing/coupon',
  236. name: 'marketing-coupon',
  237. component: () => import('@/views/marketing/CouponView.vue'),
  238. meta: { title: '优惠券管理', pageKey: 'marketing-coupon', roles: ['admin', 'manager', 'operator'] }
  239. },
  240. {
  241. path: '/marketing/price-watch',
  242. name: 'marketing-price-watch',
  243. component: () => import('@/views/marketing/PriceWatchView.vue'),
  244. meta: { title: '价格预警', pageKey: 'marketing-price-watch', roles: ['admin', 'manager', 'operator'] }
  245. },
  246. {
  247. path: '/crm/satisfaction',
  248. name: 'crm-satisfaction',
  249. component: () => import('@/views/crm/SatisfactionView.vue'),
  250. meta: { title: '满意度评价', pageKey: 'crm-satisfaction', roles: ['admin', 'manager', 'customer_service'] }
  251. },
  252. {
  253. path: '/supplier/performance',
  254. name: 'supplier-performance',
  255. component: () => import('@/views/supplier/SupplierPerformanceView.vue'),
  256. meta: { title: '供应商绩效', pageKey: 'supplier-performance', roles: ['admin', 'manager', 'procurement'] }
  257. },
  258. {
  259. path: '/system/employee',
  260. name: 'system-employee',
  261. component: () => import('@/views/system/EmployeeView.vue'),
  262. meta: { title: '员工管理', pageKey: 'system-employee', roles: ['admin'] }
  263. },
  264. {
  265. path: '/system/department',
  266. name: 'system-department',
  267. component: () => import('@/views/system/DepartmentView.vue'),
  268. meta: { title: '部门管理', pageKey: 'system-department', roles: ['admin'] }
  269. },
  270. {
  271. path: '/report/sales-analysis',
  272. name: 'sales-analysis',
  273. component: () => import('@/views/report/SalesAnalysisView.vue'),
  274. meta: { title: '销售分析', pageKey: 'sales-analysis', roles: ['admin', 'manager', 'operator'] }
  275. },
  276. {
  277. path: '/report/profit-analysis',
  278. name: 'profit-analysis',
  279. component: () => import('@/views/report/ProfitAnalysisView.vue'),
  280. meta: { title: '利润分析', pageKey: 'profit-analysis', roles: ['admin', 'manager', 'finance'] }
  281. },
  282. {
  283. path: '/report/inventory-age',
  284. name: 'inventory-age',
  285. component: () => import('@/views/report/InventoryAgeAnalysisView.vue'),
  286. meta: { title: '库存库龄分析', pageKey: 'inventory-age', roles: ['admin', 'manager', 'procurement', 'warehouse'] }
  287. },
  288. {
  289. path: '/report/customer-analysis',
  290. name: 'customer-analysis',
  291. component: () => import('@/views/report/CustomerAnalysisView.vue'),
  292. meta: { title: '客户分析', pageKey: 'customer-analysis', roles: ['admin', 'manager', 'operator'] }
  293. },
  294. {
  295. path: '/report/logistics-report',
  296. name: 'logistics-report',
  297. component: () => import('@/views/report/LogisticsReportView.vue'),
  298. meta: { title: '物流报表', pageKey: 'logistics-report', roles: ['admin', 'manager', 'warehouse'] }
  299. },
  300. {
  301. path: '/report/channel-performance',
  302. name: 'channel-performance',
  303. component: () => import('@/views/report/ChannelPerformanceView.vue'),
  304. meta: { title: '渠道绩效', pageKey: 'channel-performance', roles: ['admin', 'manager', 'operator'] }
  305. },
  306. {
  307. path: '/report/procurement-report',
  308. name: 'procurement-report',
  309. component: () => import('@/views/report/ProcurementReportView.vue'),
  310. meta: { title: '采购报表', pageKey: 'procurement-report', roles: ['admin', 'manager', 'procurement'] }
  311. },
  312. {
  313. path: '/report/marketing-report',
  314. name: 'marketing-report',
  315. component: () => import('@/views/report/MarketingReportView.vue'),
  316. meta: { title: '营销报表', pageKey: 'marketing-report', roles: ['admin', 'manager', 'operator'] }
  317. }
  318. ]
  319. },
  320. {
  321. path: '/403',
  322. name: '403',
  323. component: () => import('@/views/shared/ForbiddenView.vue'),
  324. meta: { public: true, title: '无权限访问', roles: allRoles }
  325. }
  326. ];