index.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. import { createWebHistory, createRouter } from "vue-router";
  2. /* Layout */
  3. import Layout from "/src/layout";
  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 = [
  27. {
  28. path: "/redirect",
  29. component: Layout,
  30. hidden: true,
  31. children: [
  32. {
  33. path: "/redirect/:path(.*)",
  34. component: () => import("/src/views/redirect/index.vue"),
  35. },
  36. ],
  37. },
  38. {
  39. path: "/login",
  40. component: () => import("/src/views/login.vue"),
  41. hidden: true,
  42. },
  43. {
  44. path: "/register",
  45. component: () => import("/src/views/register.vue"),
  46. hidden: true,
  47. },
  48. {
  49. path: "/:pathMatch(.*)*",
  50. component: () => import("/src/views/error/404.vue"),
  51. hidden: true,
  52. },
  53. {
  54. path: "/401",
  55. component: () => import("/src/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("/src/views/index.vue"),
  66. name: "Index",
  67. meta: { title: "首页", icon: "dashboard", affix: true },
  68. },
  69. {
  70. path: "/platform_manage/process/processApproval",
  71. component: () => import("/src/views/process/processApproval/index.vue"),
  72. name: "ProcessApproval",
  73. meta: { title: "流程审批", icon: "dashboard", affix: false },
  74. },
  75. ],
  76. },
  77. {
  78. path: "/user",
  79. component: Layout,
  80. hidden: true,
  81. redirect: "noredirect",
  82. children: [
  83. {
  84. path: "profile",
  85. component: () => import("/src/views/system/user/profile/index.vue"),
  86. name: "Profile",
  87. meta: { title: "个人中心", icon: "user" },
  88. },
  89. ],
  90. },
  91. {
  92. path: "/hisMsg",
  93. component: Layout,
  94. redirect: "/hisMsg",
  95. children: [
  96. {
  97. path: "/hisMsg",
  98. name: "hisMsg",
  99. component: () => import(/* webpackChunkName: "page" */ "@/views/system/msg/hisMsg.vue"),
  100. props: true,
  101. meta: { title: "历史消息" },
  102. },
  103. ],
  104. },
  105. {
  106. path: "/addOrder",
  107. component: Layout,
  108. redirect: "/addOrder",
  109. children: [
  110. {
  111. path: "/addOrder",
  112. name: "add-order",
  113. component: () => import(/* webpackChunkName: "page" */ "@/views/subsidiary/order/management/add.vue"),
  114. props: true,
  115. meta: { title: "新建订单" },
  116. },
  117. ],
  118. },
  119. {
  120. path: "/design-draft",
  121. component: Layout,
  122. redirect: "/design-draft",
  123. children: [
  124. {
  125. path: "/design-draft",
  126. name: "design-draft",
  127. component: () => import(/* webpackChunkName: "page" */ "@/views/subsidiary/order/management/design.vue"),
  128. props: true,
  129. meta: { title: "上传设计稿" },
  130. },
  131. ],
  132. },
  133. {
  134. path: "/order-detail",
  135. component: Layout,
  136. redirect: "/order-detail",
  137. children: [
  138. {
  139. path: "/order-detail",
  140. name: "order-detail",
  141. component: () => import(/* webpackChunkName: "page" */ "@/views/group/order/management/detail.vue"),
  142. props: true,
  143. meta: { title: "订单详情" },
  144. },
  145. ],
  146. },
  147. {
  148. path: "/already-removed-order-detail",
  149. component: Layout,
  150. redirect: "/already-removed-order-detail",
  151. children: [
  152. {
  153. path: "/already-removed-order-detail",
  154. name: "already-removed-order-detail",
  155. component: () => import(/* webpackChunkName: "page" */ "@/views/group/order/already-removed/detail.vue"),
  156. props: true,
  157. meta: { title: "订单详情" },
  158. },
  159. ],
  160. },
  161. {
  162. path: "/charging-standard/addOrModify",
  163. component: Layout,
  164. redirect: "/charging-standard/addOrModify",
  165. children: [
  166. {
  167. path: "/charging-standard/addOrModify",
  168. name: "add-or-modify-charging-standard",
  169. component: () => import(/* webpackChunkName: "page" */ "@/views/group/selling-price/charging-standard/addOrModify.vue"),
  170. props: true,
  171. meta: { title: "计费标准新增/修改" },
  172. },
  173. ],
  174. },
  175. {
  176. path: "/putInStorage/add",
  177. component: Layout,
  178. redirect: "/putInStorage/add",
  179. children: [
  180. {
  181. path: "/putInStorage/add",
  182. name: "add-putInStorage",
  183. component: () => import(/* webpackChunkName: "page" */ "@/views/production/warehouse/putInStorage/add.vue"),
  184. props: true,
  185. meta: { title: "入库登记" },
  186. },
  187. ],
  188. },
  189. {
  190. path: "/outbound/add",
  191. component: Layout,
  192. redirect: "/outbound/add",
  193. children: [
  194. {
  195. path: "/outbound/add",
  196. name: "add-outbound",
  197. component: () => import(/* webpackChunkName: "page" */ "@/views/production/warehouse/outbound/add.vue"),
  198. props: true,
  199. meta: { title: "出库登记" },
  200. },
  201. ],
  202. },
  203. {
  204. path: "/outbound/packing-materials/add",
  205. component: Layout,
  206. redirect: "/outbound/packing-materials/add",
  207. children: [
  208. {
  209. path: "/outbound/packing-materials/add",
  210. name: "add-outbound",
  211. component: () => import(/* webpackChunkName: "page" */ "@/views/production/warehouse/outbound/packing-materials/add.vue"),
  212. props: true,
  213. meta: { title: "包材出库" },
  214. },
  215. ],
  216. },
  217. {
  218. path: "/check/add",
  219. component: Layout,
  220. redirect: "/check/add",
  221. children: [
  222. {
  223. path: "/check/add",
  224. name: "add-check",
  225. component: () => import(/* webpackChunkName: "page" */ "@/views/production/warehouse/check/add.vue"),
  226. props: true,
  227. meta: { title: "盘点登记" },
  228. },
  229. ],
  230. },
  231. {
  232. path: "/order/after-sale/initiate",
  233. component: Layout,
  234. redirect: "/order/after-sale/initiate",
  235. children: [
  236. {
  237. path: "/order/after-sale/initiate",
  238. name: "initiate",
  239. component: () => import(/* webpackChunkName: "page" */ "@/views/group/order/after-sale/initiate.vue"),
  240. props: true,
  241. meta: { title: "售后" },
  242. },
  243. ],
  244. },
  245. {
  246. path: "/production/shipment/unpack",
  247. component: Layout,
  248. redirect: "/production/shipment/unpack",
  249. children: [
  250. {
  251. path: "/production/shipment/unpack",
  252. name: "unpack",
  253. component: () => import(/* webpackChunkName: "page" */ "@/views/production/shipment/print-order/unpack.vue"),
  254. props: true,
  255. meta: { title: "添加装箱" },
  256. },
  257. ],
  258. },
  259. ];
  260. // 动态路由,基于用户权限动态去加载
  261. export const dynamicRoutes = [
  262. {
  263. path: "/system/user-auth",
  264. component: Layout,
  265. hidden: true,
  266. permissions: ["system:user:edit"],
  267. children: [
  268. {
  269. path: "role/:userId(\\d+)",
  270. component: () => import("/src/views/system/user/authRole.vue"),
  271. name: "AuthRole",
  272. meta: { title: "分配角色", activeMenu: "/system/user" },
  273. },
  274. ],
  275. },
  276. {
  277. path: "/system/role-auth",
  278. component: Layout,
  279. hidden: true,
  280. permissions: ["system:role:edit"],
  281. children: [
  282. {
  283. path: "user/:roleId(\\d+)",
  284. component: () => import("/src/views/system/role/authUser.vue"),
  285. name: "AuthUser",
  286. meta: { title: "分配用户", activeMenu: "/system/role" },
  287. },
  288. ],
  289. },
  290. {
  291. path: "/system/dict-data",
  292. component: Layout,
  293. hidden: true,
  294. permissions: ["system:dict:list"],
  295. children: [
  296. {
  297. path: "index/:dictId(\\d+)",
  298. component: () => import("/src/views/system/dict/data.vue"),
  299. name: "Data",
  300. meta: { title: "字典数据", activeMenu: "/system/dict" },
  301. },
  302. ],
  303. },
  304. {
  305. path: "/monitor/job-log",
  306. component: Layout,
  307. hidden: true,
  308. permissions: ["monitor:job:list"],
  309. children: [
  310. {
  311. path: "index/:jobId(\\d+)",
  312. component: () => import("/src/views/monitor/job/log.vue"),
  313. name: "JobLog",
  314. meta: { title: "调度日志", activeMenu: "/monitor/job" },
  315. },
  316. ],
  317. },
  318. {
  319. path: "/tool/gen-edit",
  320. component: Layout,
  321. hidden: true,
  322. permissions: ["tool:gen:edit"],
  323. children: [
  324. {
  325. path: "index/:tableId(\\d+)",
  326. component: () => import("/src/views/tool/gen/editTable.vue"),
  327. name: "GenEdit",
  328. meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
  329. },
  330. ],
  331. },
  332. ];
  333. const router = createRouter({
  334. history: createWebHistory(),
  335. routes: constantRoutes,
  336. scrollBehavior(to, from, savedPosition) {
  337. if (savedPosition) {
  338. return savedPosition;
  339. } else {
  340. return { top: 0 };
  341. }
  342. },
  343. });
  344. export default router;