综合办公系统
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.js 11KB

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