index.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router';
  2. /* Layout */
  3. import Layout from '@/layout/index.vue';
  4. /**
  5. * Note: 路由配置项
  6. *
  7. * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
  8. * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
  9. * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
  10. * // 若你想不管路由下面的 children 声明的个数都显示你的根路由
  11. * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
  12. * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
  13. * name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  14. * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
  15. * roles: ['admin', 'common'] // 访问路由的角色权限
  16. * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
  17. * meta : {
  18. noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  19. title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
  20. icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
  21. breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
  22. activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
  23. }
  24. */
  25. // 公共路由
  26. export const constantRoutes: RouteRecordRaw[] = [
  27. {
  28. path: '/redirect',
  29. component: Layout,
  30. hidden: true,
  31. children: [
  32. {
  33. path: '/redirect/:path(.*)',
  34. component: () => import('@/views/redirect/index.vue')
  35. }
  36. ]
  37. },
  38. {
  39. path: '/login',
  40. component: () => import('@/views/login.vue'),
  41. hidden: true
  42. },
  43. {
  44. path: '/register',
  45. component: () => import('@/views/register.vue'),
  46. hidden: true
  47. },
  48. {
  49. path: '/:pathMatch(.*)*',
  50. component: () => import('@/views/error/404.vue'),
  51. hidden: true
  52. },
  53. {
  54. path: '/401',
  55. component: () => import('@/views/error/401.vue'),
  56. hidden: true
  57. },
  58. {
  59. path: '',
  60. component: Layout,
  61. redirect: '/index',
  62. children: [
  63. {
  64. path: '/index',
  65. component: () => import('@/views/home/index.vue'),
  66. name: 'Index',
  67. meta: { title: '优易365', affix: true, nav: true }
  68. },
  69. {
  70. path: '/indexDiy',
  71. component: () => import('@/views/home/indexDiy.vue'),
  72. name: 'IndexDiy',
  73. meta: { title: '优易365Diy', diy: true, search: 'hide' }
  74. },
  75. {
  76. path: '/indexB',
  77. component: () => import('@/views/home/index-b.vue'),
  78. name: 'IndexB',
  79. meta: { title: '企业购商城', affix: true, nav: true }
  80. },
  81. {
  82. path: '/indexMro',
  83. component: () => import('@/views/home/index-mro.vue'),
  84. name: 'IndexMro',
  85. meta: { title: '工业品商城', affix: true, nav: true }
  86. },
  87. {
  88. path: '/indexMroDiy',
  89. component: () => import('@/views/home/index-mroDiy.vue'),
  90. name: 'IndexMroDiy',
  91. meta: { title: '工业品商城Diy', diy: true, search: 'hide' }
  92. },
  93. {
  94. path: '/indexFuli',
  95. component: () => import('@/views/home/index-fuli.vue'),
  96. name: 'IndexFuli',
  97. meta: { title: '福礼商城', icon: 'dashboard', affix: true, nav: true }
  98. },
  99. {
  100. path: '/indexFuliDiy',
  101. component: () => import('@/views/home/index-fuliDiy.vue'),
  102. name: 'IndexFuliDiy',
  103. meta: { title: '福礼商城Diy', diy: true, search: 'hide' }
  104. },
  105. {
  106. path: '/indexData',
  107. component: () => import('@/views/home/index-data.vue'),
  108. name: 'indexData',
  109. meta: { title: '大客户站点', icon: 'dashboard', affix: true, nav: true }
  110. },
  111. {
  112. path: '/indexDataDiy',
  113. component: () => import('@/views/home/index-dataDiy.vue'),
  114. name: 'IndexDataDiy',
  115. meta: { title: '大客户站点Diy', diy: true, search: 'hide' }
  116. },
  117. {
  118. path: '/theme',
  119. component: () => import('@/views/home/theme.vue'),
  120. name: 'IndexTheme',
  121. meta: { title: '详情', icon: 'dashboard', affix: true, nav: true }
  122. },
  123. {
  124. path: '/reg',
  125. component: () => import('@/views/reg/index.vue'),
  126. name: 'Reg',
  127. meta: { title: '个人注册', icon: 'dashboard', affix: true, nav: true }
  128. },
  129. {
  130. path: '/breg',
  131. component: () => import('@/views/breg/index.vue'),
  132. name: 'Breg',
  133. meta: { title: '企业注册', header: 'hide', search: 'hide' }
  134. },
  135. {
  136. path: '/greg',
  137. component: () => import('@/views/greg/index.vue'),
  138. name: 'Greg',
  139. meta: { title: '供应商注册', header: 'hide', search: 'hide' }
  140. },
  141. {
  142. path: '/search',
  143. component: () => import('@/views/search/index.vue'),
  144. name: 'Search',
  145. meta: { title: '搜索', icon: 'dashboard', affix: true, nav: true }
  146. },
  147. {
  148. path: '/search/special',
  149. component: () => import('@/views/search/special.vue'),
  150. name: 'SearchSpecial',
  151. meta: { title: '特价专区', icon: 'dashboard', affix: true, nav: true }
  152. },
  153. {
  154. path: '/search/brand',
  155. component: () => import('@/views/search/brand.vue'),
  156. name: 'SearchBrand',
  157. meta: { title: '品牌闪购', icon: 'dashboard', affix: true, nav: true }
  158. },
  159. {
  160. path: '/item',
  161. component: () => import('@/views/item/index.vue'),
  162. name: 'Item',
  163. meta: { title: '商品详情', nav: true, breadcrumb: true, breadcrumbColor: '#F4F4F4' }
  164. },
  165. {
  166. path: '/cart',
  167. component: () => import('@/views/cart/index.vue'),
  168. name: 'Cart',
  169. meta: { title: '我的购物车', nav: true }
  170. },
  171. {
  172. path: '/trad',
  173. component: () => import('@/views/trad/index.vue'),
  174. name: 'Trad',
  175. meta: { title: '确认订单信息', nav: true }
  176. },
  177. {
  178. path: '/payc',
  179. component: () => import('@/views/payc/index.vue'),
  180. name: 'shopPay',
  181. meta: { title: '支付订单', nav: true }
  182. },
  183. {
  184. path: '/solve/real',
  185. component: () => import('@/views/solve/real.vue'),
  186. name: 'solveReal',
  187. meta: { title: '资讯详情', nav: true, breadcrumb: true, breadcrumbColor: '#F4F4F4' }
  188. },
  189. {
  190. path: '/order/orderManage',
  191. name: 'OrderManage',
  192. component: () => import('@/views/order/orderManage/index.vue'),
  193. meta: { title: '订单管理', workbench: true }
  194. },
  195. {
  196. path: '/order/orderManage/detail',
  197. name: 'OrderDetail',
  198. component: () => import('@/views/order/orderManage/detail.vue'),
  199. meta: { title: '订单详情', hidden: true, workbench: true }
  200. },
  201. {
  202. path: '/order/orderManage/applyAfter',
  203. component: () => import('@/views/order/orderManage/applyAfter.vue'),
  204. name: 'ApplyAfter',
  205. meta: { title: '申请售后', hidden: true, workbench: true }
  206. },
  207. {
  208. path: '/order/orderAudit',
  209. name: 'OrderAudit',
  210. component: () => import('@/views/order/orderAudit/index.vue'),
  211. meta: { title: '审核订单', workbench: true }
  212. },
  213. {
  214. path: '/order/afterSale',
  215. name: 'AfterSale',
  216. component: () => import('@/views/order/afterSale/index.vue'),
  217. meta: { title: '售后服务', workbench: true }
  218. },
  219. {
  220. path: '/order/batchOrder',
  221. name: 'BatchOrder',
  222. component: () => import('@/views/order/batchOrder/index.vue'),
  223. meta: { title: '批量下单', workbench: true }
  224. },
  225. {
  226. path: '/order/orderEvaluation',
  227. name: 'OrderEvaluation',
  228. component: () => import('@/views/order/orderEvaluation/index.vue'),
  229. meta: { title: '订单评价', workbench: true }
  230. },
  231. {
  232. path: '/order/orderEvaluation/evaluation',
  233. name: 'EvaluationAdd',
  234. component: () => import('@/views/order/orderEvaluation/evaluation.vue'),
  235. meta: { title: '新增评价', workbench: true }
  236. },
  237. {
  238. path: '/plan',
  239. component: () => import('@/views/plan/index.vue'),
  240. name: 'Plan',
  241. meta: { title: '解决方案', nav: true, breadcrumb: true }
  242. },
  243. {
  244. path: '/plan_info',
  245. component: () => import('@/views/plan_info/index.vue'),
  246. name: 'PlanInfo',
  247. meta: { title: '解决方案详情', nav: true, breadcrumb: true, navList: [{ title: '解决方案', url: '/plan' }] }
  248. },
  249. {
  250. path: '/plan/procure',
  251. component: () => import('@/views/plan/procure.vue'),
  252. name: 'PlanProcure',
  253. meta: { title: '场景采购', nav: true, breadcrumb: true }
  254. },
  255. {
  256. path: '/plan_info/procure',
  257. component: () => import('@/views/plan_info/procure.vue'),
  258. name: 'PlanInfoProcure',
  259. meta: { title: '场景采购详情', nav: true, breadcrumb: true, navList: [{ title: '场景采购', url: '/plan/procure' }] }
  260. },
  261. {
  262. path: '/plan/guide',
  263. component: () => import('@/views/plan/guide.vue'),
  264. name: 'PlanGuide',
  265. meta: { title: '采购指南', nav: true, breadcrumb: true }
  266. },
  267. {
  268. path: '/plan_info/guide',
  269. component: () => import('@/views/plan_info/guide.vue'),
  270. name: 'PlanInfoGuide',
  271. meta: { title: '采购指南详情', nav: true, breadcrumb: true, breadcrumbColor: '#F4F4F4', navList: [{ title: '采购指南', url: '/plan/guide' }] }
  272. },
  273. {
  274. path: '/plan/project',
  275. component: () => import('@/views/plan/project.vue'),
  276. name: 'PlanProject',
  277. meta: { title: '项目案例', nav: true, breadcrumb: true }
  278. },
  279. {
  280. path: '/plan_info/project',
  281. component: () => import('@/views/plan_info/project.vue'),
  282. name: 'PlanInfoProject',
  283. meta: {
  284. title: '项目案例详情',
  285. nav: true,
  286. breadcrumb: true,
  287. breadcrumbColor: '#F4F4F4',
  288. navList: [{ title: '采购指南', url: '/plan/project' }]
  289. }
  290. },
  291. {
  292. path: '/i',
  293. name: 'I',
  294. component: () => import('@/views/i/index.vue'),
  295. meta: { title: '个人信息', workbench: true }
  296. },
  297. {
  298. path: '/easybuv',
  299. name: 'Easybuv',
  300. component: () => import('@/views/easybuv/index.vue'),
  301. meta: { title: '地址管理', workbench: true }
  302. },
  303. {
  304. path: 'enterprise/companyInfo',
  305. name: 'CompanyInfo',
  306. component: () => import('@/views/enterprise/companyInfo/index.vue'),
  307. meta: { title: '企业信息', workbench: true }
  308. },
  309. {
  310. path: 'enterprise/companyInfo/edit',
  311. name: 'CompanyInfoEdit',
  312. component: () => import('@/views/enterprise/companyInfo/edit.vue'),
  313. meta: { title: '完善企业信息', hidden: true, workbench: true }
  314. },
  315. {
  316. path: 'enterprise/securitySetting',
  317. name: 'SecuritySetting',
  318. component: () => import('@/views/enterprise/securitySetting/index.vue'),
  319. meta: { title: '安全设置', hidden: true, workbench: true }
  320. },
  321. {
  322. path: 'enterprise/securitySetting/resetPassword',
  323. name: 'ResetPassword',
  324. component: () => import('@/views/enterprise/securitySetting/resetPassword.vue'),
  325. meta: { title: '重置密码', hidden: true, workbench: true }
  326. },
  327. {
  328. path: 'enterprise/securitySetting/changePhone',
  329. name: 'ChangePhone',
  330. component: () => import('@/views/enterprise/securitySetting/changePhone.vue'),
  331. meta: { title: '更换手机号码', hidden: true, workbench: true }
  332. },
  333. {
  334. path: 'enterprise/purchaseHabit',
  335. name: 'PurchaseHabit',
  336. component: () => import('@/views/enterprise/purchaseHabit/index.vue'),
  337. meta: { title: '采购习惯', hidden: true, workbench: true }
  338. },
  339. {
  340. path: 'enterprise/changePerson',
  341. name: 'PurchaseHabit',
  342. component: () => import('@/views/enterprise/changePerson/index.vue'),
  343. meta: { title: '更换负责人', hidden: true, workbench: true }
  344. },
  345. {
  346. path: 'enterprise/messageNotice',
  347. name: 'MessageNotice',
  348. component: () => import('@/views/enterprise/messageNotice/index.vue'),
  349. meta: { title: '消息通知', workbench: true }
  350. },
  351. {
  352. path: 'enterprise/invoiceManage',
  353. name: 'InvoiceManage',
  354. component: () => import('@/views/enterprise/invoiceManage/index.vue'),
  355. meta: { title: '发票抬头管理', workbench: true }
  356. },
  357. {
  358. path: 'enterprise/purchasePlan',
  359. name: 'PurchasePlan',
  360. component: () => import('@/views/enterprise/purchasePlan/index.vue'),
  361. meta: { title: '专属采购方案', workbench: true }
  362. },
  363. {
  364. path: 'enterprise/agreementSupply',
  365. name: 'AgreementSupply',
  366. component: () => import('@/views/enterprise/agreementSupply/index.vue'),
  367. meta: { title: '协议供货', workbench: true }
  368. },
  369. {
  370. path: 'enterprise/myCollection',
  371. name: 'MyCollection',
  372. component: () => import('@/views/enterprise/myCollection/index.vue'),
  373. meta: { title: '我的收藏', workbench: true }
  374. },
  375. {
  376. path: 'enterprise/purchaseHistory',
  377. name: 'PurchaseHistory',
  378. component: () => import('@/views/enterprise/purchaseHistory/index.vue'),
  379. meta: { title: '历史购买', workbench: true }
  380. },
  381. {
  382. path: 'enterprise/myFootprint',
  383. name: 'MyFootprint',
  384. component: () => import('@/views/enterprise/myFootprint/index.vue'),
  385. meta: { title: '我的足迹', workbench: true }
  386. },
  387. {
  388. path: 'organization/deptManage',
  389. name: 'DeptManage',
  390. component: () => import('@/views/organization/deptManage/index.vue'),
  391. meta: { title: '部门管理', workbench: true }
  392. },
  393. {
  394. path: 'organization/staffManage',
  395. name: 'StaffManage',
  396. component: () => import('@/views/organization/staffManage/index.vue'),
  397. meta: { title: '人员管理', workbench: true }
  398. },
  399. {
  400. path: 'organization/roleManage',
  401. name: 'RoleManage',
  402. component: () => import('@/views/organization/roleManage/index.vue'),
  403. meta: { title: '角色管理', workbench: true }
  404. },
  405. {
  406. path: 'organization/approvalFlow',
  407. name: 'ApprovalFlow',
  408. component: () => import('@/views/organization/approvalFlow/index.vue'),
  409. meta: { title: '审批流程', workbench: true }
  410. },
  411. {
  412. path: 'organization/approvalFlow/create',
  413. name: 'ApprovalFlowCreate',
  414. component: () => import('@/views/organization/approvalFlow/create.vue'),
  415. meta: { title: '新建审批', hidden: true, workbench: true }
  416. },
  417. {
  418. path: 'organization/groupEnterprise',
  419. name: 'GroupEnterprise',
  420. component: () => import('@/views/organization/groupEnterprise/index.vue'),
  421. meta: { title: '集团关联企业', workbench: true }
  422. },
  423. {
  424. path: 'cost/itemExpense',
  425. name: 'ItemExpense',
  426. component: () => import('@/views/cost/itemExpense/index.vue'),
  427. meta: { title: '分项费用', workbench: true }
  428. },
  429. {
  430. path: 'cost/quotaControl',
  431. name: 'QuotaControl',
  432. component: () => import('@/views/cost/quotaControl/index.vue'),
  433. meta: { title: '额度控制', workbench: true }
  434. },
  435. {
  436. path: 'cost/quotaControl/apply',
  437. name: 'QuotaApply',
  438. component: () => import('@/views/cost/quotaControl/apply.vue'),
  439. meta: { title: '额度申请', hidden: true, workbench: true }
  440. },
  441. {
  442. path: 'reconciliation/billManage',
  443. name: 'BillManage',
  444. component: () => import('@/views/reconciliation/billManage/index.vue'),
  445. meta: { title: '对账单管理', workbench: true }
  446. },
  447. {
  448. path: 'reconciliation/invoiceManage',
  449. name: 'ReconciliationInvoiceManage',
  450. component: () => import('@/views/reconciliation/invoiceManage/index.vue'),
  451. meta: { title: '开票管理', workbench: true }
  452. },
  453. {
  454. path: 'valueAdded/maintenance',
  455. name: 'Maintenance',
  456. component: () => import('@/views/valueAdded/maintenance/index.vue'),
  457. meta: { title: '维保服务', workbench: true }
  458. },
  459. {
  460. path: 'valueAdded/maintenanceApply',
  461. name: 'MaintenanceApply',
  462. component: () => import('@/views/valueAdded/maintenance/apply.vue'),
  463. meta: { title: '维保申请', workbench: true }
  464. },
  465. {
  466. path: 'valueAdded/complaint',
  467. name: 'Complaint',
  468. component: () => import('@/views/valueAdded/complaint/index.vue'),
  469. meta: { title: '投诉与建议', workbench: true }
  470. },
  471. {
  472. path: 'analysis/orderAnalysis',
  473. name: 'OrderAnalysis',
  474. component: () => import('@/views/analysis/orderAnalysis/index.vue'),
  475. meta: { title: '订单交易分析', workbench: true }
  476. },
  477. {
  478. path: 'analysis/purchaseDetail',
  479. name: 'PurchaseDetail',
  480. component: () => import('@/views/analysis/purchaseDetail/index.vue'),
  481. meta: { title: '商品采购明细', workbench: true }
  482. },
  483. {
  484. path: 'analysis/orderStatus',
  485. name: 'OrderStatus',
  486. component: () => import('@/views/analysis/orderStatus/index.vue'),
  487. meta: { title: '订单执行状态', workbench: true }
  488. },
  489. {
  490. path: 'analysis/settlementStatus',
  491. name: 'SettlementStatus',
  492. component: () => import('@/views/analysis/settlementStatus/index.vue'),
  493. meta: { title: '对账结算状况', workbench: true }
  494. },
  495. {
  496. path: 'analysis/deptPurchase',
  497. name: 'DeptPurchase',
  498. component: () => import('@/views/analysis/deptPurchase/index.vue'),
  499. meta: { title: '部门采购金额', workbench: true }
  500. }
  501. ]
  502. }
  503. ];
  504. // 动态路由,基于用户权限动态去加载
  505. export const dynamicRoutes: RouteRecordRaw[] = [];
  506. /**
  507. * 创建路由
  508. */
  509. const router = createRouter({
  510. history: createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH),
  511. routes: constantRoutes,
  512. // 刷新时,滚动条位置还原
  513. scrollBehavior(to, from, savedPosition) {
  514. if (savedPosition) {
  515. return savedPosition;
  516. }
  517. return { top: 0 };
  518. }
  519. });
  520. export default router;