index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. const _import = require('./_import_' + process.env.NODE_ENV)
  4. // in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
  5. // detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
  6. Vue.use(Router)
  7. /* Layout */
  8. import Layout from '../views/layout/Layout'
  9. /** note: submenu only apppear when children.length>=1
  10. * detail see https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
  11. **/
  12. /**
  13. * hidden: true if `hidden:true` will not show in the sidebar(default is false)
  14. * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
  15. * if not set alwaysShow, only more than one route under the children
  16. * it will becomes nested mode, otherwise not show the root menu
  17. * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
  18. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  19. * meta : {
  20. roles: ['admin','editor'] will control the page roles (you can set multiple roles)
  21. title: 'title' the name show in submenu and breadcrumb (recommend set)
  22. icon: 'svg-name' the icon show in the sidebar,
  23. noCache: true if fasle ,the page will no be cached(default is false)
  24. }
  25. **/
  26. export const constantRouterMap = [
  27. { path: '/login', component: _import('login/index'), hidden: true },
  28. { path: '/authredirect', component: _import('login/authredirect'), hidden: true },
  29. { path: '/404', component: _import('error/404'), hidden: true },
  30. { path: '/401', component: _import('error/401'), hidden: true },
  31. {
  32. path: '',
  33. component: Layout,
  34. redirect: 'dashboard',
  35. children: [{
  36. path: 'dashboard',
  37. component: _import('dashboard/index'),
  38. name: 'dashboard',
  39. meta: { title: '首页', icon: 'dashboard', noCache: true }
  40. }]
  41. }
  42. ]
  43. export default new Router({
  44. // mode: 'history', // require service support
  45. scrollBehavior: () => ({ y: 0 }),
  46. routes: constantRouterMap
  47. })
  48. export const asyncRouterMap = [
  49. {
  50. path: '/goodsManage',
  51. component: Layout,
  52. redirect: 'noredirect',
  53. name: 'goodsManage',
  54. meta: {
  55. title: '商品管理',
  56. icon: 'shangpin'
  57. },
  58. children: [
  59. { path: 'goodsTypeList', component: _import('goodsManage/goodsTypeList'), name: 'goodsTypeList', meta: { title: '商品类别', noCache: true }},
  60. { path: 'goodsList', component: _import('goodsManage/goodsList'), name: 'goodsList', meta: { title: '商品列表', noCache: true }},
  61. { path: 'brand', component: _import('goodsManage/brand'), name: 'brand', meta: { title: '品牌管理', noCache: true }},
  62. ]
  63. },
  64. {
  65. path: '/basicSetting',
  66. component: Layout,
  67. redirect: 'noredirect',
  68. name: 'basicSetting',
  69. meta: {
  70. title: '基础设置',
  71. icon: 'shangpin'
  72. },
  73. children: [
  74. { path: 'supplier', component: _import('basicSetting/supplier'), name: 'supplier', meta: { title: '供应商管理', noCache: true }},
  75. { path: 'warehouse', component: _import('basicSetting/warehouse'), name: 'warehouse', meta: { title: '仓库管理', noCache: true }},
  76. { path: 'express', component: _import('basicSetting/express'), name: 'express', meta: { title: '物流公司', noCache: true }},
  77. { path: 'store', component: _import('basicSetting/store'), name: 'store', meta: { title: '门店管理', noCache: true }},
  78. ]
  79. },
  80. {
  81. path: '/stock',
  82. component: Layout,
  83. redirect: 'noredirect',
  84. name: 'stock',
  85. meta: { title: '仓库管理', icon: 'shangpin' },
  86. children: [
  87. // 入库单
  88. { path: 'warehousing', component: _import('stock/warehousing/warehousing'), name: 'warehousing', meta: { title: '入库单', noCache: true }},
  89. { path: 'warehousingAdd', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingAdd', meta: { title: '新增入库单', noCache: false, hideTag: true, hidden: true }},
  90. { path: 'warehousingEdit/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingEdit', meta: { title: '编辑入库单', noCache: false, hideTag: true, hidden: true }},
  91. { path: 'warehousingDetail/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingDetail', meta: { title: '入库单详情', noCache: false, hideTag: true, hidden: true }},
  92. // 出库单
  93. { path: 'retrieval', component: _import('stock/retrieval/retrieval'), name: 'retrieval', meta: { title: '出库单', noCache: true }},
  94. { path: 'retrievalAdd', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalAdd', meta: { title: '新增出库单', noCache: false, hideTag: true, hidden: true }},
  95. { path: 'retrievalEdit/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalEdit', meta: { title: '编辑出库单', noCache: false, hideTag: true, hidden: true }},
  96. { path: 'retrievalDetail/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalDetail', meta: { title: '出库单详情', noCache: false, hideTag: true, hidden: true }},
  97. // 调拨单
  98. { path: 'requisition', component: _import('stock/requisition/requisition'), name: 'requisition', meta: { title: '调拨单', noCache: true }},
  99. { path: 'requisitionAdd', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionAdd', meta: { title: '新增调拨单', noCache: false, hideTag: true, hidden: true }},
  100. { path: 'requisitionEdit/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionEdit', meta: { title: '编辑调拨单', noCache: false, hideTag: true, hidden: true }},
  101. { path: 'requisitionDetail/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionDetail', meta: { title: '调拨单详情', noCache: false, hideTag: true, hidden: true }},
  102. // 换货单
  103. { path: 'swap', component: _import('stock/swap/swap'), name: 'swap', meta: { title: '换货单', noCache: true }},
  104. { path: 'swapAdd', component: _import('stock/swap/swapAdd'), name: 'swapAdd', meta: { title: '新增换货单', noCache: false, hideTag: true, hidden: true }},
  105. { path: 'swapEdit/:id', component: _import('stock/swap/swapAdd'), name: 'swapEdit', meta: { title: '编辑换货单', noCache: false, hideTag: true, hidden: true }},
  106. { path: 'swapDetail/:id', component: _import('stock/swap/swapAdd'), name: 'swapDetail', meta: { title: '换货单详情', noCache: false, hideTag: true, hidden: true }},
  107. // 组装单
  108. { path: 'assembly', component: _import('stock/assembly/assembly'), name: 'assembly', meta: { title: '组装单', noCache: true }},
  109. { path: 'assemblyAdd', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyAdd', meta: { title: '新增组装单', noCache: false, hideTag: true, hidden: true }},
  110. { path: 'assemblyEdit/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyEdit', meta: { title: '编辑组装单', noCache: false, hideTag: true, hidden: true }},
  111. { path: 'assemblyDetail/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyDetail', meta: { title: '组装单详情', noCache: false, hideTag: true, hidden: true }},
  112. // 拆卸单
  113. { path: 'disassembly', component: _import('stock/disassembly/disassembly'), name: 'disassembly', meta: { title: '拆卸单', noCache: true }},
  114. { path: 'disassemblyAdd', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyAdd', meta: { title: '新增拆卸单', noCache: false, hideTag: true, hidden: true }},
  115. { path: 'disassemblyEdit/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyEdit', meta: { title: '编辑拆卸单', noCache: false, hideTag: true, hidden: true }},
  116. { path: 'disassemblyDetail/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyDetail', meta: { title: '拆卸单详情', noCache: false, hideTag: true, hidden: true }},
  117. // 报损单
  118. { path: 'breakage', component: _import('stock/breakage/breakage'), name: 'breakage', meta: { title: '报损单', noCache: true }},
  119. { path: 'breakageAdd', component: _import('stock/breakage/breakageAdd'), name: 'breakageAdd', meta: { title: '新增报损单', noCache: false, hideTag: true, hidden: true }},
  120. { path: 'breakageEdit/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageEdit', meta: { title: '编辑报损单', noCache: false, hideTag: true, hidden: true }},
  121. { path: 'breakageDetail/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageDetail', meta: { title: '报损单详情', noCache: false, hideTag: true, hidden: true }},
  122. // 盘点单
  123. { path: 'stockCount', component: _import('stock/stockCount/stockCount'), name: 'stockCount', meta: { title: '盘点单', noCache: true }},
  124. { path: 'stockCountAdd', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountAdd', meta: { title: '新增盘点单', noCache: false, hideTag: true, hidden: true }},
  125. { path: 'stockCountEdit/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountEdit', meta: { title: '编辑盘点单', noCache: false, hideTag: true, hidden: true }},
  126. { path: 'stockCountDetail/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountDetail', meta: { title: '盘点单详情', noCache: false, hideTag: true, hidden: true }},
  127. ]
  128. },
  129. {
  130. path: '/customer',
  131. component: Layout,
  132. redirect: 'noredirect',
  133. name: 'customer',
  134. meta: {
  135. title: '客户管理',
  136. icon: 'shangpin'
  137. },
  138. children: [
  139. { path: 'distributor', component: _import('customer/distributor'), name: 'distributor', meta: { title: '分销商管理', noCache: true }},
  140. { path: 'business', component: _import('customer/business'), name: 'business', meta: { title: '企业客户管理', noCache: true }},
  141. { path: 'vip', component: _import('customer/vip'), name: 'vip', meta: { title: '会员管理', noCache: true }},
  142. { path: 'guest', component: _import('customer/guest'), name: 'guest', meta: { title: '散客管理', noCache: true }},
  143. ]
  144. },
  145. {
  146. path: '/dictManage',
  147. component: Layout,
  148. redirect: 'noredirect',
  149. name: 'dictManage',
  150. meta: {
  151. title: '字典管理',
  152. icon: 'zidian'
  153. },
  154. children: [
  155. { path: 'dictList', component: _import('dictManage/dictList'), name: 'dictList', meta: { title: '字典列表', noCache: true }},
  156. { path: 'dictDataList/:id', component: _import('dictManage/dictDataList'), name: 'dictDataList', meta: { title: '字典数据', noCache: false, hideTag: true, hidden: true }},
  157. ]
  158. },
  159. {
  160. path: '/report',
  161. component: Layout,
  162. redirect: 'noredirect',
  163. name: 'report',
  164. meta: {
  165. title: '报表管理',
  166. icon: 'zidian'
  167. },
  168. children: [
  169. { path: 'stockReport', component: _import('report/stockReport'), name: 'stockReport', meta: { title: '库存报表',icon: 'dashboard', noCache: true }},
  170. ]
  171. },
  172. {
  173. path: '/sys',
  174. component: Layout,
  175. redirect: 'noredirect',
  176. name: 'sysManage',
  177. meta: {
  178. title: '系统管理',
  179. icon: 'chart'
  180. },
  181. children: [
  182. { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '用户管理', noCache: true }},
  183. { path: 'dept', component: _import('sys/dept'), name: 'dept', meta: { title: '部门管理', noCache: true }},
  184. { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }},
  185. ]
  186. },
  187. { path: '*', redirect: '/404', hidden: true }
  188. ]