vue2-client 1.4.59 → 1.4.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +482 -477
  2. package/index.js +30 -30
  3. package/package.json +78 -78
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1 -1
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +778 -778
  7. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +151 -151
  8. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  9. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  10. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  11. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  12. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  13. package/src/base-client/components/common/XForm/XFormItem.vue +519 -471
  14. package/src/base-client/components/common/XFormTable/XFormTable.vue +570 -570
  15. package/src/base-client/components/common/XFormTable/index.md +96 -96
  16. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -109
  17. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  18. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  19. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  20. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  21. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  22. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  23. package/src/base-client/plugins/AppData.js +73 -73
  24. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  25. package/src/base-client/plugins/PagedList.js +177 -177
  26. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  27. package/src/base-client/plugins/i18n-extend.js +32 -32
  28. package/src/components/Ellipsis/index.md +38 -38
  29. package/src/components/NumberInfo/index.md +43 -43
  30. package/src/components/STable/README.md +341 -341
  31. package/src/components/STable/index.js +318 -318
  32. package/src/components/Trend/index.md +45 -45
  33. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  34. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  35. package/src/components/exception/ExceptionPage.vue +70 -70
  36. package/src/components/form/FormRow.vue +52 -52
  37. package/src/components/index.js +36 -36
  38. package/src/components/menu/SideMenu.vue +62 -62
  39. package/src/components/menu/menu.js +273 -273
  40. package/src/components/page/header/index.less +40 -40
  41. package/src/components/setting/Setting.vue +235 -235
  42. package/src/components/table/StandardTable.vue +141 -141
  43. package/src/components/table/advance/ActionColumns.vue +158 -158
  44. package/src/components/table/advance/SearchArea.vue +355 -355
  45. package/src/components/tool/AStepItem.vue +60 -60
  46. package/src/components/tool/AvatarList.vue +68 -68
  47. package/src/components/tool/Drawer.vue +142 -142
  48. package/src/components/tool/TagSelect.vue +83 -83
  49. package/src/components/transition/PageToggleTransition.vue +97 -97
  50. package/src/config/CreateQueryConfig.js +7 -4
  51. package/src/config/default/admin.config.js +18 -18
  52. package/src/config/default/setting.config.js +44 -44
  53. package/src/config/replacer/resolve.config.js +67 -67
  54. package/src/layouts/AdminLayout.vue +174 -174
  55. package/src/layouts/CommonLayout.vue +42 -42
  56. package/src/layouts/ComponentLayoutOne.vue +47 -47
  57. package/src/layouts/PageLayout.vue +151 -151
  58. package/src/layouts/SinglePageView.vue +111 -111
  59. package/src/layouts/footer/PageFooter.vue +49 -49
  60. package/src/layouts/header/AdminHeader.vue +104 -104
  61. package/src/layouts/header/HeaderNotice.vue +167 -167
  62. package/src/layouts/header/HeaderSearch.vue +67 -67
  63. package/src/layouts/header/InstitutionDetail.vue +181 -181
  64. package/src/layouts/header/index.less +92 -92
  65. package/src/layouts/tabs/TabsHead.vue +190 -190
  66. package/src/layouts/tabs/TabsView.vue +379 -379
  67. package/src/mock/goods/index.js +108 -108
  68. package/src/pages/exception/404.vue +25 -25
  69. package/src/pages/login/Login.vue +348 -348
  70. package/src/pages/report/ReportTable.js +124 -124
  71. package/src/pages/report/ReportTableHome.vue +28 -28
  72. package/src/pages/resourceManage/orgListManage.vue +98 -98
  73. package/src/pages/system/dictionary/index.vue +43 -43
  74. package/src/pages/system/file/index.vue +317 -317
  75. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  76. package/src/pages/system/monitor/operLog/index.vue +36 -36
  77. package/src/pages/system/queryParams/index.vue +43 -43
  78. package/src/router/async/config.async.js +27 -27
  79. package/src/router/async/router.map.js +68 -68
  80. package/src/router/guards.js +104 -104
  81. package/src/router/index.js +27 -27
  82. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  83. package/src/services/api/LogDetailsViewApi.js +10 -10
  84. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  85. package/src/services/api/TicketDetailsViewApi.js +34 -34
  86. package/src/services/api/cas.js +79 -79
  87. package/src/services/api/commonTempTable.js +10 -10
  88. package/src/services/api/index.js +17 -17
  89. package/src/services/api/logininfor/index.js +6 -6
  90. package/src/services/api/manage.js +8 -8
  91. package/src/services/apiService.js +13 -13
  92. package/src/services/user.js +53 -53
  93. package/src/store/modules/index.js +4 -4
  94. package/src/theme/default/nprogress.less +76 -76
  95. package/src/theme/default/style.less +47 -47
  96. package/src/utils/colors.js +107 -107
  97. package/src/utils/excel/Blob.js +180 -180
  98. package/src/utils/excel/Export2Excel.js +141 -141
  99. package/src/utils/formatter.js +68 -68
  100. package/src/utils/i18n.js +80 -80
  101. package/src/utils/theme-color-replacer-extend.js +91 -91
  102. package/src/utils/themeUtil.js +100 -100
  103. package/src/utils/util.js +230 -230
@@ -1,36 +1,36 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <x-form-table
4
- title="登录日志"
5
- :queryParamsName="queryParamsName"
6
- @action="toDetail">
7
- </x-form-table>
8
- </a-card>
9
- </template>
10
-
11
- <script>
12
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
13
-
14
- export default {
15
- name: 'loginInfor',
16
- components: {
17
- XFormTable
18
- },
19
- data () {
20
- return {
21
- // 选中的编号
22
- selectNo: undefined,
23
- // 查询配置文件名
24
- queryParamsName: 'loginInforQueryParams',
25
- // 是否显示详情抽屉
26
- detailVisible: false
27
- }
28
- },
29
- methods: {
30
- toDetail (record, id) {
31
- this.selectNo = id + ''
32
- this.detailVisible = true
33
- }
34
- }
35
- }
36
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <x-form-table
4
+ title="登录日志"
5
+ :queryParamsName="queryParamsName"
6
+ @action="toDetail">
7
+ </x-form-table>
8
+ </a-card>
9
+ </template>
10
+
11
+ <script>
12
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
13
+
14
+ export default {
15
+ name: 'loginInfor',
16
+ components: {
17
+ XFormTable
18
+ },
19
+ data () {
20
+ return {
21
+ // 选中的编号
22
+ selectNo: undefined,
23
+ // 查询配置文件名
24
+ queryParamsName: 'loginInforQueryParams',
25
+ // 是否显示详情抽屉
26
+ detailVisible: false
27
+ }
28
+ },
29
+ methods: {
30
+ toDetail (record, id) {
31
+ this.selectNo = id + ''
32
+ this.detailVisible = true
33
+ }
34
+ }
35
+ }
36
+ </script>
@@ -1,36 +1,36 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <x-form-table
4
- title="操作日志"
5
- :queryParamsName="queryParamsName"
6
- @action="toDetail">
7
- </x-form-table>
8
- </a-card>
9
- </template>
10
-
11
- <script>
12
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
13
-
14
- export default {
15
- name: 'operLog',
16
- components: {
17
- XFormTable
18
- },
19
- data () {
20
- return {
21
- // 选中的编号
22
- selectNo: undefined,
23
- // 查询配置文件名
24
- queryParamsName: 'operLogQueryParams',
25
- // 是否显示详情抽屉
26
- detailVisible: false
27
- }
28
- },
29
- methods: {
30
- toDetail (record, id) {
31
- this.selectNo = id + ''
32
- this.detailVisible = true
33
- }
34
- }
35
- }
36
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <x-form-table
4
+ title="操作日志"
5
+ :queryParamsName="queryParamsName"
6
+ @action="toDetail">
7
+ </x-form-table>
8
+ </a-card>
9
+ </template>
10
+
11
+ <script>
12
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
13
+
14
+ export default {
15
+ name: 'operLog',
16
+ components: {
17
+ XFormTable
18
+ },
19
+ data () {
20
+ return {
21
+ // 选中的编号
22
+ selectNo: undefined,
23
+ // 查询配置文件名
24
+ queryParamsName: 'operLogQueryParams',
25
+ // 是否显示详情抽屉
26
+ detailVisible: false
27
+ }
28
+ },
29
+ methods: {
30
+ toDetail (record, id) {
31
+ this.selectNo = id + ''
32
+ this.detailVisible = true
33
+ }
34
+ }
35
+ }
36
+ </script>
@@ -1,43 +1,43 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <query-params-details-view
4
- v-if="selectId"
5
- :id="selectId"
6
- :visible.sync="detailVisible"
7
- />
8
- <x-form-table
9
- :queryParamsName="queryParamsName"
10
- title="查询配置"
11
- @action="toDetail">
12
- </x-form-table>
13
- </a-card>
14
- </template>
15
-
16
- <script>
17
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
18
- import QueryParamsDetailsView from '@vue2-client/base-client/components/system/QueryParamsDetailsView'
19
-
20
- export default {
21
- name: 'QueryParams',
22
- components: {
23
- XFormTable,
24
- QueryParamsDetailsView
25
- },
26
- data () {
27
- return {
28
- // 选中的编号
29
- selectId: undefined,
30
- // 查询配置文件名
31
- queryParamsName: 'queryParams',
32
- // 是否显示详情抽屉
33
- detailVisible: false
34
- }
35
- },
36
- methods: {
37
- toDetail (record, id) {
38
- this.selectId = id + ''
39
- this.detailVisible = true
40
- }
41
- }
42
- }
43
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <query-params-details-view
4
+ v-if="selectId"
5
+ :id="selectId"
6
+ :visible.sync="detailVisible"
7
+ />
8
+ <x-form-table
9
+ :queryParamsName="queryParamsName"
10
+ title="查询配置"
11
+ @action="toDetail">
12
+ </x-form-table>
13
+ </a-card>
14
+ </template>
15
+
16
+ <script>
17
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
18
+ import QueryParamsDetailsView from '@vue2-client/base-client/components/system/QueryParamsDetailsView'
19
+
20
+ export default {
21
+ name: 'QueryParams',
22
+ components: {
23
+ XFormTable,
24
+ QueryParamsDetailsView
25
+ },
26
+ data () {
27
+ return {
28
+ // 选中的编号
29
+ selectId: undefined,
30
+ // 查询配置文件名
31
+ queryParamsName: 'queryParams',
32
+ // 是否显示详情抽屉
33
+ detailVisible: false
34
+ }
35
+ },
36
+ methods: {
37
+ toDetail (record, id) {
38
+ this.selectId = id + ''
39
+ this.detailVisible = true
40
+ }
41
+ }
42
+ }
43
+ </script>
@@ -1,27 +1,27 @@
1
- import routerMap from './router.map'
2
- import { parseRoutes } from '@vue2-client/utils/routerUtil'
3
-
4
- // 异步路由配置
5
- const routesConfig = [
6
- 'login',
7
- 'submitTicket',
8
- 'root',
9
- {
10
- router: 'exp404',
11
- path: '*',
12
- name: '404'
13
- },
14
- {
15
- router: 'exp403',
16
- path: '/403',
17
- name: '403'
18
- }
19
- ]
20
-
21
- const options = {
22
- mode: 'history',
23
- routes: parseRoutes(routesConfig, routerMap),
24
- config: routesConfig
25
- }
26
-
27
- export default options
1
+ import routerMap from './router.map'
2
+ import { parseRoutes } from '@vue2-client/utils/routerUtil'
3
+
4
+ // 异步路由配置
5
+ const routesConfig = [
6
+ 'login',
7
+ 'submitTicket',
8
+ 'root',
9
+ {
10
+ router: 'exp404',
11
+ path: '*',
12
+ name: '404'
13
+ },
14
+ {
15
+ router: 'exp403',
16
+ path: '/403',
17
+ name: '403'
18
+ }
19
+ ]
20
+
21
+ const options = {
22
+ mode: 'history',
23
+ routes: parseRoutes(routesConfig, routerMap),
24
+ config: routesConfig
25
+ }
26
+
27
+ export default options
@@ -1,68 +1,68 @@
1
- const { homePage } = require('../../config')
2
- // 视图组件
3
- const view = {
4
- tabs: () => import('@vue2-client/layouts/tabs'),
5
- blank: () => import('@vue2-client/layouts/BlankView'),
6
- page: () => import('@vue2-client/layouts/PageView')
7
- }
8
- // 动态路由对象定义
9
- const routerResource = {}
10
- // --------------------------------------基本视图组件--------------------------------------
11
- // 空白视图
12
- routerResource.blank = view.blank
13
- // 单页面视图
14
- routerResource.singlePage = view.blank
15
-
16
- // --------------------------------------仪表盘--------------------------------------
17
- routerResource.dashboard = view.blank
18
- // 工作台
19
- routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
20
- // --------------------------------------系统配置--------------------------------------
21
- routerResource.system = view.blank
22
- // 报表测试用页面
23
- routerResource.testPage = () => import('@vue2-client/pages/ReportView.vue')
24
- // 字典管理
25
- routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
26
- // 查询配置管理
27
- routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
28
- // 文件管理
29
- routerResource.fileManager = () => import('@vue2-client/pages/system/file')
30
- // 登录日志
31
- routerResource.loginInfor = () => import('@vue2-client/pages/system/monitor/loginInfor')
32
- // 操作日志
33
- routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog')
34
- // 系统问题反馈工单
35
- routerResource.submitTicket = () => import(/* webpackChunkName: "submitTicket" */ '@vue2-client/pages/system/ticket')
36
-
37
- // 基础路由组件注册
38
- const routerMap = {
39
- login: {
40
- authority: '*',
41
- path: '/login',
42
- component: () => import('@vue2-client/pages/login')
43
- },
44
- root: {
45
- path: '/',
46
- name: '首页',
47
- redirect: homePage,
48
- component: view.tabs
49
- },
50
- exp403: {
51
- authority: '*',
52
- name: 'exp403',
53
- path: '403',
54
- component: () => import('@vue2-client/pages/exception/403')
55
- },
56
- exp404: {
57
- name: 'exp404',
58
- path: '404',
59
- component: () => import('@vue2-client/pages/exception/404')
60
- },
61
- exp500: {
62
- name: 'exp500',
63
- path: '500',
64
- component: () => import('@vue2-client/pages/exception/500')
65
- }
66
- }
67
- Object.assign(routerMap, routerResource)
68
- export default routerMap
1
+ const { homePage } = require('../../config')
2
+ // 视图组件
3
+ const view = {
4
+ tabs: () => import('@vue2-client/layouts/tabs'),
5
+ blank: () => import('@vue2-client/layouts/BlankView'),
6
+ page: () => import('@vue2-client/layouts/PageView')
7
+ }
8
+ // 动态路由对象定义
9
+ const routerResource = {}
10
+ // --------------------------------------基本视图组件--------------------------------------
11
+ // 空白视图
12
+ routerResource.blank = view.blank
13
+ // 单页面视图
14
+ routerResource.singlePage = view.blank
15
+
16
+ // --------------------------------------仪表盘--------------------------------------
17
+ routerResource.dashboard = view.blank
18
+ // 工作台
19
+ routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
20
+ // --------------------------------------系统配置--------------------------------------
21
+ routerResource.system = view.blank
22
+ // 报表测试用页面
23
+ routerResource.testPage = () => import('@vue2-client/pages/ReportView.vue')
24
+ // 字典管理
25
+ routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
26
+ // 查询配置管理
27
+ routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
28
+ // 文件管理
29
+ routerResource.fileManager = () => import('@vue2-client/pages/system/file')
30
+ // 登录日志
31
+ routerResource.loginInfor = () => import('@vue2-client/pages/system/monitor/loginInfor')
32
+ // 操作日志
33
+ routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog')
34
+ // 系统问题反馈工单
35
+ routerResource.submitTicket = () => import(/* webpackChunkName: "submitTicket" */ '@vue2-client/pages/system/ticket')
36
+
37
+ // 基础路由组件注册
38
+ const routerMap = {
39
+ login: {
40
+ authority: '*',
41
+ path: '/login',
42
+ component: () => import('@vue2-client/pages/login')
43
+ },
44
+ root: {
45
+ path: '/',
46
+ name: '首页',
47
+ redirect: homePage,
48
+ component: view.tabs
49
+ },
50
+ exp403: {
51
+ authority: '*',
52
+ name: 'exp403',
53
+ path: '403',
54
+ component: () => import('@vue2-client/pages/exception/403')
55
+ },
56
+ exp404: {
57
+ name: 'exp404',
58
+ path: '404',
59
+ component: () => import('@vue2-client/pages/exception/404')
60
+ },
61
+ exp500: {
62
+ name: 'exp500',
63
+ path: '500',
64
+ component: () => import('@vue2-client/pages/exception/500')
65
+ }
66
+ }
67
+ Object.assign(routerMap, routerResource)
68
+ export default routerMap
@@ -1,104 +1,104 @@
1
- import { hasAuthority } from '@vue2-client/utils/authority-utils'
2
- import { loginIgnore } from '@vue2-client/router/index'
3
- import { checkAuthorization } from '@vue2-client/utils/request'
4
- import NProgress from 'nprogress'
5
-
6
- NProgress.configure({ showSpinner: false })
7
-
8
- /**
9
- * 进度条开始
10
- * @param to
11
- * @param form
12
- * @param next
13
- */
14
- const progressStart = (to, from, next) => {
15
- // start progress bar
16
- if (!NProgress.isStarted()) {
17
- NProgress.start()
18
- }
19
- next()
20
- }
21
-
22
- /**
23
- * 登录守卫
24
- * @param to
25
- * @param form
26
- * @param next
27
- * @param options
28
- */
29
- const loginGuard = (to, from, next, options) => {
30
- const { message } = options
31
- if ((!loginIgnore.includes(to) || to.name === '404') && !checkAuthorization()) {
32
- message.warning('登录已失效,请重新登录')
33
- next({ path: '/login' })
34
- } else {
35
- next()
36
- }
37
- }
38
-
39
- /**
40
- * 权限守卫
41
- * @param to
42
- * @param form
43
- * @param next
44
- * @param options
45
- */
46
- const authorityGuard = (to, from, next, options) => {
47
- const { store, message } = options
48
- const permissions = store.getters['account/permissions']
49
- const roles = store.getters['account/roles']
50
- if (!hasAuthority(to, permissions, roles)) {
51
- message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
52
- next({ path: '/403' })
53
- // NProgress.done()
54
- } else {
55
- next()
56
- }
57
- }
58
-
59
- /**
60
- * 混合导航模式下一级菜单跳转重定向
61
- * @param to
62
- * @param from
63
- * @param next
64
- * @param options
65
- * @returns {*}
66
- */
67
- const redirectGuard = (to, from, next, options) => {
68
- const { store } = options
69
- const getFirstChild = (routes) => {
70
- const route = routes[0]
71
- if (!route.children || route.children.length === 0) {
72
- return route
73
- }
74
- return getFirstChild(route.children)
75
- }
76
- if (store.state.setting.layout === 'mix') {
77
- const firstMenu = store.getters['setting/firstMenu']
78
- if (firstMenu.find(item => item.fullPath === to.fullPath)) {
79
- store.commit('setting/setActivatedFirst', to.fullPath)
80
- const subMenu = store.getters['setting/subMenu']
81
- if (subMenu.length > 0) {
82
- const redirect = getFirstChild(subMenu)
83
- return next({ path: redirect.fullPath })
84
- }
85
- }
86
- }
87
- next()
88
- }
89
-
90
- /**
91
- * 进度条结束
92
- * @param to
93
- * @param form
94
- * @param options
95
- */
96
- const progressDone = () => {
97
- // finish progress bar
98
- NProgress.done()
99
- }
100
-
101
- export default {
102
- beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
103
- afterEach: [progressDone]
104
- }
1
+ import { hasAuthority } from '@vue2-client/utils/authority-utils'
2
+ import { loginIgnore } from '@vue2-client/router/index'
3
+ import { checkAuthorization } from '@vue2-client/utils/request'
4
+ import NProgress from 'nprogress'
5
+
6
+ NProgress.configure({ showSpinner: false })
7
+
8
+ /**
9
+ * 进度条开始
10
+ * @param to
11
+ * @param form
12
+ * @param next
13
+ */
14
+ const progressStart = (to, from, next) => {
15
+ // start progress bar
16
+ if (!NProgress.isStarted()) {
17
+ NProgress.start()
18
+ }
19
+ next()
20
+ }
21
+
22
+ /**
23
+ * 登录守卫
24
+ * @param to
25
+ * @param form
26
+ * @param next
27
+ * @param options
28
+ */
29
+ const loginGuard = (to, from, next, options) => {
30
+ const { message } = options
31
+ if ((!loginIgnore.includes(to) || to.name === '404') && !checkAuthorization()) {
32
+ message.warning('登录已失效,请重新登录')
33
+ next({ path: '/login' })
34
+ } else {
35
+ next()
36
+ }
37
+ }
38
+
39
+ /**
40
+ * 权限守卫
41
+ * @param to
42
+ * @param form
43
+ * @param next
44
+ * @param options
45
+ */
46
+ const authorityGuard = (to, from, next, options) => {
47
+ const { store, message } = options
48
+ const permissions = store.getters['account/permissions']
49
+ const roles = store.getters['account/roles']
50
+ if (!hasAuthority(to, permissions, roles)) {
51
+ message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
52
+ next({ path: '/403' })
53
+ // NProgress.done()
54
+ } else {
55
+ next()
56
+ }
57
+ }
58
+
59
+ /**
60
+ * 混合导航模式下一级菜单跳转重定向
61
+ * @param to
62
+ * @param from
63
+ * @param next
64
+ * @param options
65
+ * @returns {*}
66
+ */
67
+ const redirectGuard = (to, from, next, options) => {
68
+ const { store } = options
69
+ const getFirstChild = (routes) => {
70
+ const route = routes[0]
71
+ if (!route.children || route.children.length === 0) {
72
+ return route
73
+ }
74
+ return getFirstChild(route.children)
75
+ }
76
+ if (store.state.setting.layout === 'mix') {
77
+ const firstMenu = store.getters['setting/firstMenu']
78
+ if (firstMenu.find(item => item.fullPath === to.fullPath)) {
79
+ store.commit('setting/setActivatedFirst', to.fullPath)
80
+ const subMenu = store.getters['setting/subMenu']
81
+ if (subMenu.length > 0) {
82
+ const redirect = getFirstChild(subMenu)
83
+ return next({ path: redirect.fullPath })
84
+ }
85
+ }
86
+ }
87
+ next()
88
+ }
89
+
90
+ /**
91
+ * 进度条结束
92
+ * @param to
93
+ * @param form
94
+ * @param options
95
+ */
96
+ const progressDone = () => {
97
+ // finish progress bar
98
+ NProgress.done()
99
+ }
100
+
101
+ export default {
102
+ beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
103
+ afterEach: [progressDone]
104
+ }