index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. import {createRouter, createWebHistory} from 'vue-router'
  2. /* Layout */
  3. import Layout from '@/layout'
  4. /**
  5. * Note: ルート設定項目
  6. *
  7. * hidden: true // true を設定すると、そのルートはサイドバーに表示されません。例:401、loginなどのページ、または編集ページ /edit/1
  8. * alwaysShow: true // 子ルートが1つ以上のとき、自動的にネストされたモードになります - 例えばコンポーネントページ
  9. * // 子ルートが1つのとき、その子ルートがルートとしてサイドバーに表示されます - 例えばガイドページ
  10. * // どのような場合でもルートを常に表示したい場合は、alwaysShow: true を設定できます。これにより、以前に定義されたルールが無視され、常にルートが表示されます
  11. * redirect: noRedirect // noRedirect を設定すると、そのルートはパンくずナビゲーションでクリックできません
  12. * name: 'router-name' // ルートの名前を設定します。必ず設定してください。そうでないと <keep-alive> を使用する際に様々な問題が発生します
  13. * query: '{"id": 1, "name": "ry"}' // ルートにアクセスする際のデフォルトのパラメータを設定します
  14. * roles: ['admin', 'common'] // ルートにアクセスできるロール権限を設定します
  15. * permissions: ['a:a:a', 'b:b:b'] // ルートにアクセスできるメニュー権限を設定します
  16. * meta : {
  17. noCache: true // true を設定すると、<keep-alive> によってキャッシュされません (デフォルトは false)
  18. title: 'title' // そのルートがサイドバーとパンくずナビゲーションで表示される名前を設定します
  19. icon: 'svg-name' // そのルートのアイコンを設定します。対応するパスは src/assets/icons/svg
  20. breadcrumb: false // false を設定すると、パンくずナビゲーションに表示されません
  21. activeMenu: '/system/user' // このプロパティを設定すると、対応するサイドバーがハイライトされます
  22. }
  23. */
  24. // 公共ルート
  25. export const constantRoutes = [
  26. {
  27. path: '/redirect',
  28. component: Layout,
  29. hidden: true,
  30. children: [
  31. {
  32. path: '/redirect/:path(.*)',
  33. component: () => import('@/views/redirect/index.vue')
  34. }
  35. ]
  36. },
  37. {
  38. path: '/login',
  39. component: () => import('@/views/login'),
  40. hidden: true
  41. },
  42. {
  43. path: "/:pathMatch(.*)*",
  44. component: () => import('@/views/error/404'),
  45. hidden: true
  46. },
  47. {
  48. path: '/401',
  49. component: () => import('@/views/error/401'),
  50. hidden: true
  51. },
  52. {
  53. path: '',
  54. component: Layout,
  55. redirect: '/index',
  56. children: [
  57. {
  58. path: '/index',
  59. component: () => import('@/views/index'),
  60. name: 'Index',
  61. meta: {title: 'FC管理システム', icon: 'dashboard', affix: true}
  62. }
  63. ]
  64. },
  65. {
  66. path: '/user',
  67. component: Layout,
  68. hidden: true,
  69. redirect: 'noredirect',
  70. children: [
  71. {
  72. path: 'profile',
  73. component: () => import('@/views/system/user/profile/index'),
  74. name: 'Profile',
  75. meta: {title: '個人センター', icon: 'user'}
  76. }
  77. ]
  78. },
  79. {
  80. path: '/fcbi',
  81. component: Layout,
  82. hidden: true,
  83. redirect: 'noredirect',
  84. children: [
  85. {
  86. path: 'order/detail/:orderId',
  87. component: () => import('@/views/fcbi/order/detail'),
  88. name: 'OrderDetail',
  89. meta: {title: '発注詳細', icon: 'user'}
  90. },
  91. {
  92. path: 'order/compilation/:orderId/:version',
  93. component: () => import('@/views/fcbi/order/compilation'),
  94. name: 'OrderCompilation',
  95. meta: {title: '指示書編集', icon: 'user'}
  96. },
  97. {
  98. path: 'order/instruction/:orderId/:version',
  99. component: () => import('@/views/fcbi/order/instruction'),
  100. name: 'OrderInstruction',
  101. meta: {title: '指示書参照', icon: 'user'}
  102. },
  103. {
  104. path: 'result/compilation/:resultId',
  105. component: () => import('@/views/fcbi/result/compilation'),
  106. name: 'ResultCompilation',
  107. meta: {title: '実績詳細', icon: 'user'}
  108. }
  109. ]
  110. },
  111. {
  112. path: '/surveyAdmin',
  113. component: Layout,
  114. hidden: true,
  115. redirect: 'noredirect',
  116. children: [
  117. {
  118. path: 'surveyDecision',
  119. component: () => import('@/views/fcbi/survey/decision'),
  120. name: 'SurveyDecision',
  121. meta: {title: 'アンケートフォーム確定', icon: 'user'}
  122. }
  123. ]
  124. },
  125. {
  126. path: '/surveyAdmin',
  127. component: Layout,
  128. hidden: true,
  129. redirect: 'noredirect',
  130. children: [
  131. {
  132. path: 'surveyDetail/:surveyId',
  133. component: () => import('@/views/fcbi/survey/detail'),
  134. name: 'surveyDetail',
  135. meta: {title: 'アンケート照会確定', icon: 'user'}
  136. }
  137. ]
  138. },
  139. {
  140. path: '/surveyAdmin',
  141. component: Layout,
  142. hidden: true,
  143. redirect: 'noredirect',
  144. children: [
  145. {
  146. path: 'surveyResults/:surveyCode',
  147. component: () => import('@/views/fcbi/survey/results'),
  148. name: 'surveyResults',
  149. meta: {title: 'アンケート回答集計結果', icon: 'user'}
  150. }
  151. ]
  152. },
  153. {
  154. path: '/surveyAdmin',
  155. component: Layout,
  156. hidden: true,
  157. redirect: 'noredirect',
  158. children: [
  159. {
  160. path: 'surveyForm',
  161. component: () => import('@/views/fcbi/survey/form'),
  162. name: 'surveyForm',
  163. meta: {title: 'アンケートフォーム作成', icon: 'user'}
  164. }
  165. ]
  166. },
  167. {
  168. path: '/surveyAdmin',
  169. component: Layout,
  170. hidden: true,
  171. redirect: 'noredirect',
  172. children: [
  173. {
  174. path: 'surveyAnswerDetails/:surveyId',
  175. component: () => import('@/views/fcbi/survey/answer'),
  176. name: 'surveyAnswerDetails',
  177. meta: {title: 'アンケート回答詳細', icon: 'user'}
  178. }
  179. ]
  180. },
  181. {
  182. path: '/salesAdmin',
  183. component: Layout,
  184. hidden: true,
  185. redirect: 'noredirect',
  186. children: [
  187. {
  188. path: 'salesSumResult',
  189. component: () => import('@/views/fcbi/sales/sumResult'),
  190. name: 'salesSumResult',
  191. meta: {title: '売上集計結果', icon: 'user'}
  192. }
  193. ]
  194. },
  195. {
  196. path: '/customerAdmin',
  197. component: Layout,
  198. hidden: true,
  199. redirect: 'noredirect',
  200. children: [
  201. {
  202. path: 'customerDetail/:customerId',
  203. component: () => import('@/views/fcbi/customer/detail'),
  204. name: 'customerDetail',
  205. meta: {title: '顧客詳細', icon: 'user'}
  206. }
  207. ]
  208. },
  209. {
  210. path: '/customerAdmin',
  211. component: Layout,
  212. hidden: true,
  213. redirect: 'noredirect',
  214. children: [
  215. {
  216. path: 'customerHistory/:customerId',
  217. component: () => import('@/views/fcbi/customer/history'),
  218. name: 'customerHistory',
  219. meta: {title: '顧客購入履歴', icon: 'user'}
  220. }
  221. ]
  222. },
  223. {
  224. path: '/fcMemberAdmin',
  225. component: Layout,
  226. hidden: true,
  227. redirect: 'noredirect',
  228. children: [
  229. {
  230. path: 'fcMember',
  231. component: () => import('@/views/fcbi/fcMember/list'),
  232. name: 'fcMember',
  233. meta: {title: '会員一覧', icon: 'user'}
  234. }
  235. ]
  236. },
  237. {
  238. path: '/fcMemberAdmin',
  239. component: Layout,
  240. hidden: true,
  241. redirect: 'noredirect',
  242. children: [
  243. {
  244. path: 'fcMemberEdit/:fcMemberId',
  245. component: () => import('@/views/fcbi/fcMember/edit'),
  246. name: 'fcMemberEdit',
  247. meta: {title: '会員情報編集', icon: 'user'}
  248. }
  249. ]
  250. },
  251. ]
  252. // ダイナミックルート、ユーザー権限に基づいて動的に読み込みます
  253. export const dynamicRoutes = [
  254. {
  255. path: '/system/user-auth',
  256. component: Layout,
  257. hidden: true,
  258. permissions: ['system:user:edit'],
  259. children: [
  260. {
  261. path: 'role/:userId(\\d+)',
  262. component: () => import('@/views/system/user/authRole'),
  263. name: 'AuthRole',
  264. meta: {title: '役割の割り当て', activeMenu: '/system/user'}
  265. }
  266. ]
  267. },
  268. {
  269. path: '/system/role-auth',
  270. component: Layout,
  271. hidden: true,
  272. permissions: ['system:role:edit'],
  273. children: [
  274. {
  275. path: 'user/:roleId(\\d+)',
  276. component: () => import('@/views/system/role/authUser'),
  277. name: 'AuthUser',
  278. meta: {title: 'ユーザーの割り当て', activeMenu: '/system/role'}
  279. }
  280. ]
  281. },
  282. {
  283. path: '/system/dict-data',
  284. component: Layout,
  285. hidden: true,
  286. permissions: ['system:dict:list'],
  287. children: [
  288. {
  289. path: 'index/:dictId(\\d+)',
  290. component: () => import('@/views/system/dict/data'),
  291. name: 'Data',
  292. meta: {title: '辞書データ', activeMenu: '/system/dict'}
  293. }
  294. ]
  295. },
  296. {
  297. path: '/monitor/job-log',
  298. component: Layout,
  299. hidden: true,
  300. permissions: ['monitor:job:list'],
  301. children: [
  302. {
  303. path: 'index/:jobId(\\d+)',
  304. component: () => import('@/views/monitor/job/log'),
  305. name: 'JobLog',
  306. meta: {title: 'ジョブログ', activeMenu: '/monitor/job'}
  307. }
  308. ]
  309. },
  310. {
  311. path: '/tool/gen-edit',
  312. component: Layout,
  313. hidden: true,
  314. permissions: ['tool:gen:edit'],
  315. children: [
  316. {
  317. path: 'index/:tableId(\\d+)',
  318. component: () => import('@/views/tool/gen/editTable'),
  319. name: 'GenEdit',
  320. meta: {title: '生成設定の編集', activeMenu: '/tool/gen'}
  321. }
  322. ]
  323. }
  324. ]
  325. const router = createRouter({
  326. history: createWebHistory(),
  327. routes: constantRoutes,
  328. scrollBehavior(to, from, savedPosition) {
  329. if (savedPosition) {
  330. return savedPosition
  331. }
  332. return {top: 0}
  333. },
  334. });
  335. export default router;