index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /**
  7. * Note: 路由配置项
  8. *
  9. * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
  10. * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
  11. * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
  12. * // 若你想不管路由下面的 children 声明的个数都显示你的根路由
  13. * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
  14. * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
  15. * name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  16. * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
  17. * roles: ['admin', 'common'] // 访问路由的角色权限
  18. * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
  19. * meta : {
  20. noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  21. title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
  22. icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
  23. breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
  24. activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
  25. }
  26. */
  27. // 公共路由
  28. export const constantRoutes = [
  29. {
  30. path: '/redirect',
  31. component: Layout,
  32. hidden: true,
  33. children: [
  34. {
  35. path: '/redirect/:path(.*)',
  36. component: () => import('@/views/redirect')
  37. }
  38. ]
  39. },
  40. {
  41. path: '/login',
  42. component: () => import('@/views/login'),
  43. hidden: true
  44. },
  45. {
  46. path: '/register',
  47. component: () => import('@/views/register'),
  48. hidden: true
  49. },
  50. {
  51. path: '/404',
  52. component: () => import('@/views/error/404'),
  53. hidden: true
  54. },
  55. {
  56. path: '/401',
  57. component: () => import('@/views/error/401'),
  58. hidden: true
  59. },
  60. // {
  61. // path: '',
  62. // component: () => import('@/views/home'),
  63. // name: "Home",
  64. // hidden: true
  65. // },
  66. {
  67. path: '/project',
  68. component: Layout,
  69. hidden: true,
  70. // redirect: 'noredirect',
  71. children: [
  72. //投资机会
  73. {
  74. path: 'investOpp/edit',
  75. name: 'investOppEdit',
  76. component: () => import('@/views/project/investOpp/edit'),
  77. meta: { title: '修改投资机会' }
  78. },
  79. {
  80. path: "investOpp/audit",
  81. name: 'investOppAudit',
  82. component: () => import('@/views/project/investOpp/audit'),
  83. meta: { title: '审批投资机会' }
  84. },
  85. {
  86. path: 'investOpp/detail',
  87. name: 'investOppDetail',
  88. component: () => import('@/views/project/investOpp/detail'),
  89. meta: { title: '投资机会详情' }
  90. },
  91. //项目立项
  92. {
  93. path: "approval/edit",
  94. name: 'approvalEdit',
  95. component: () => import('@/views/project/approval/edit'),
  96. meta: { title: '修改项目立项' }
  97. },
  98. {
  99. path: "approval/audit",
  100. name: 'approvalAudit',
  101. component: () => import('@/views/project/approval/audit'),
  102. meta: { title: '审批项目立项' }
  103. },
  104. {
  105. path: "approval/detail",
  106. name: 'approvalDetail',
  107. component: () => import('@/views/project/approval/detail'),
  108. meta: { title: '项目立项详情' }
  109. },
  110. //项目投决
  111. {
  112. path: "decision/edit",
  113. name: 'decisionEdit',
  114. component: () => import('@/views/project/decision/edit'),
  115. meta: { title: '修改项目投决' }
  116. },
  117. {
  118. path: "decision/audit",
  119. name: 'decisionAudit',
  120. component: () => import('@/views/project/decision/audit'),
  121. meta: { title: '审批项目投决' }
  122. },
  123. {
  124. path: "decision/detail",
  125. name: 'decisionDetail',
  126. component: () => import('@/views/project/decision/detail'),
  127. meta: { title: '项目投决详情' }
  128. },
  129. //项目终止
  130. {
  131. path: "termination/edit",
  132. name: 'terminationEdit',
  133. component: () => import('@/views/project/termination/edit'),
  134. meta: { title: '修改项目终止' }
  135. },
  136. {
  137. path: "termination/audit",
  138. name: 'terminationAudit',
  139. component: () => import('@/views/project/termination/audit'),
  140. meta: { title: '审批项目终止' }
  141. },
  142. {
  143. path: "termination/detail",
  144. name: 'terminationDetail',
  145. component: () => import('@/views/project/termination/detail'),
  146. meta: { title: '项目终止详情' }
  147. },
  148. // {
  149. // path: "record/index",
  150. // name: 'investRecordIndex',
  151. // component: () => import('@/views/invest/record/index')
  152. // },
  153. // {
  154. // path: "channel/index",
  155. // name: 'investChannelIndex',
  156. // component: () => import('@/views/invest/channel/index')
  157. // },
  158. // {
  159. // path: "contract/index",
  160. // name: 'investContractIndex',
  161. // component: () => import('@/views/invest/contract/index')
  162. // },
  163. // {
  164. // path: "meeting/index",
  165. // name: 'investMeetingmpanyctsIndex',
  166. // component: () => import('@/views/invest/meeting/index')
  167. // },
  168. // {
  169. // path: "meeting/mark",
  170. // name: 'investMeetingmpanyctsMark',
  171. // component: () => import('@/views/invest/meeting/mark'),
  172. // meta: { title: '会议数据' }
  173. // },
  174. // {
  175. // path: 'information/index',
  176. // component: () => import('@/views/invest/information/index'),
  177. // name: 'investInformationIndex',
  178. // }
  179. ]
  180. },
  181. {
  182. path: '/invest',
  183. component: Layout,
  184. hidden: true,
  185. // redirect: 'noredirect',
  186. children: [
  187. // {
  188. // path: 'pool/index',
  189. // component: () => import('@/views/invest/pool/index'),
  190. // name: 'investPoolIndex',
  191. // },
  192. {
  193. path: "pool/add",
  194. name: 'investPoolAdd',
  195. component: () => import('@/views/invest/pool/add'),
  196. meta: { title: '项目数据' }
  197. },
  198. {
  199. path: 'pool/detail',
  200. component: () => import('@/views/invest/pool/detail'),
  201. name: 'investPoolDetail',
  202. meta: { title: '项目详情' }
  203. },
  204. {
  205. path: "pool/surveyForm",
  206. name: 'investPoolSurveyForm',
  207. component: () => import('@/views/invest/pool/surveyForm'),
  208. meta: { title: '调查数据' }
  209. },
  210. // {
  211. // path: "record/index",
  212. // name: 'investRecordIndex',
  213. // component: () => import('@/views/invest/record/index')
  214. // },
  215. // {
  216. // path: "channel/index",
  217. // name: 'investChannelIndex',
  218. // component: () => import('@/views/invest/channel/index')
  219. // },
  220. // {
  221. // path: "contract/index",
  222. // name: 'investContractIndex',
  223. // component: () => import('@/views/invest/contract/index')
  224. // },
  225. // {
  226. // path: "meeting/index",
  227. // name: 'investMeetingmpanyctsIndex',
  228. // component: () => import('@/views/invest/meeting/index')
  229. // },
  230. {
  231. path: "meeting/mark",
  232. name: 'investMeetingmpanyctsMark',
  233. component: () => import('@/views/invest/meeting/mark'),
  234. meta: { title: '会议数据' }
  235. },
  236. // {
  237. // path: 'information/index',
  238. // component: () => import('@/views/invest/information/index'),
  239. // name: 'investInformationIndex',
  240. // }
  241. ]
  242. },
  243. {
  244. path: '/study',
  245. component: Layout,
  246. hidden: true,
  247. children:[
  248. {
  249. path: 'information/index',
  250. component: () => import('@/views/study/gen/index.vue'),
  251. name: 'studyInformationIndex',
  252. },
  253. ]
  254. },
  255. {
  256. // path: '/index',
  257. path: '/',
  258. component: Layout,
  259. hidden: true,
  260. redirect: 'index',
  261. children: [
  262. {
  263. path: 'index',
  264. component: () => import('@/views/index'),
  265. name: 'Index',
  266. hidden: true,
  267. meta: { title: '首页', icon: 'dashboard' }//, affix: true
  268. }
  269. ]
  270. },
  271. {
  272. path: '/user',
  273. component: Layout,
  274. hidden: true,
  275. redirect: 'noredirect',
  276. children: [
  277. {
  278. path: 'profile',
  279. component: () => import('@/views/system/user/profile/index'),
  280. name: 'Profile',
  281. meta: { title: '个人中心', icon: 'user' }
  282. }
  283. ]
  284. },
  285. {
  286. path: '/flowable',
  287. component: Layout,
  288. hidden: true,
  289. children: [
  290. {
  291. path: 'definition/model/',
  292. component: () => import('@/views/flowable/definition/model'),
  293. name: 'Model',
  294. meta: { title: '流程设计', icon: '' }
  295. }
  296. ]
  297. },
  298. {
  299. path: '/flowable',
  300. component: Layout,
  301. hidden: true,
  302. children: [
  303. {
  304. path: 'task/finished/detail/index',
  305. component: () => import('@/views/flowable/task/finished/detail/index'),
  306. name: 'FinishedRecord',
  307. meta: { title: '流程详情', icon: '' }
  308. }
  309. ]
  310. },
  311. {
  312. path: '/flowable',
  313. component: Layout,
  314. hidden: true,
  315. children: [
  316. {
  317. path: 'task/myProcess/detail/index',
  318. component: () => import('@/views/flowable/task/myProcess/detail/index'),
  319. name: 'MyProcessRecord',
  320. meta: { title: '流程详情', icon: '' }
  321. }
  322. ]
  323. },
  324. {
  325. path: '/flowable',
  326. component: Layout,
  327. hidden: true,
  328. children: [
  329. {
  330. path: 'task/myProcess/send/index',
  331. component: () => import('@/views/flowable/task/myProcess/send/index'),
  332. name: 'SendRecord',
  333. meta: { title: '流程发起', icon: '' }
  334. }
  335. ]
  336. },
  337. {
  338. path: '/flowable',
  339. component: Layout,
  340. hidden: true,
  341. children: [
  342. {
  343. path: 'task/todo/detail/index',
  344. component: () => import('@/views/flowable/task/todo/detail/index'),
  345. name: 'TodoRecord',
  346. meta: { title: '流程处理', icon: '' }
  347. }
  348. ]
  349. },
  350. {
  351. path: '/flowable',
  352. component: Layout,
  353. hidden: true,
  354. children: [
  355. {
  356. path: 'task/flowForm/index',
  357. component: () => import('@/views/flowable/task/flowForm/index'),
  358. name: 'FlowForm',
  359. meta: { title: '流程表单', icon: '' }
  360. }
  361. ]
  362. },
  363. {
  364. path: '/tool',
  365. component: Layout,
  366. hidden: true,
  367. children: [
  368. {
  369. path: 'build/index',
  370. component: () => import('@/views/tool/build/index'),
  371. name: 'FormBuild',
  372. meta: { title: '表单配置', icon: '' }
  373. }
  374. ]
  375. },
  376. ]
  377. // 动态路由,基于用户权限动态去加载
  378. export const dynamicRoutes = [
  379. {
  380. path: '/system/user-auth',
  381. component: Layout,
  382. hidden: true,
  383. permissions: ['system:user:edit'],
  384. children: [
  385. {
  386. path: 'role/:userId(\\d+)',
  387. component: () => import('@/views/system/user/authRole'),
  388. name: 'AuthRole',
  389. meta: { title: '分配角色', activeMenu: '/system/user' }
  390. }
  391. ]
  392. },
  393. {
  394. path: '/system/role-auth',
  395. component: Layout,
  396. hidden: true,
  397. permissions: ['system:role:edit'],
  398. children: [
  399. {
  400. path: 'user/:roleId(\\d+)',
  401. component: () => import('@/views/system/role/authUser'),
  402. name: 'AuthUser',
  403. meta: { title: '分配用户', activeMenu: '/system/role' }
  404. }
  405. ]
  406. },
  407. {
  408. path: '/system/dict-data',
  409. component: Layout,
  410. hidden: true,
  411. permissions: ['system:dict:list'],
  412. children: [
  413. {
  414. path: 'index/:dictId(\\d+)',
  415. component: () => import('@/views/system/dict/data'),
  416. name: 'Data',
  417. meta: { title: '字典数据', activeMenu: '/system/dict' }
  418. }
  419. ]
  420. },
  421. {
  422. path: '/monitor/job-log',
  423. component: Layout,
  424. hidden: true,
  425. permissions: ['monitor:job:list'],
  426. children: [
  427. {
  428. path: 'index/:jobId(\\d+)',
  429. component: () => import('@/views/monitor/job/log'),
  430. name: 'JobLog',
  431. meta: { title: '调度日志', activeMenu: '/monitor/job' }
  432. }
  433. ]
  434. },
  435. {
  436. path: '/tool/gen-edit',
  437. component: Layout,
  438. hidden: true,
  439. permissions: ['tool:gen:edit'],
  440. children: [
  441. {
  442. path: 'index/:tableId(\\d+)',
  443. component: () => import('@/views/tool/gen/editTable'),
  444. name: 'GenEdit',
  445. meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
  446. }
  447. ]
  448. }
  449. ]
  450. // 防止连续点击多次路由报错
  451. let routerPush = Router.prototype.push;
  452. let routerReplace = Router.prototype.replace;
  453. // push
  454. Router.prototype.push = function push(location) {
  455. return routerPush.call(this, location).catch(err => err)
  456. }
  457. // replace
  458. Router.prototype.replace = function push(location) {
  459. return routerReplace.call(this, location).catch(err => err)
  460. }
  461. export default new Router({
  462. mode: 'history', // 去掉url中的#
  463. scrollBehavior: () => ({ y: 0 }),
  464. routes: constantRoutes
  465. })