imatrix-ui 0.0.15 → 0.1.1-up
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.
- package/.vscode/extensions.json +3 -0
- package/README.md +7 -0
- package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
- package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
- package/components/dynamic-source-select/events.js +77 -0
- package/components/fs-preview/fs-preview.vue +287 -0
- package/components/index.js +26 -0
- package/components/plugins/export-data-new.js +623 -0
- package/components/plugins/export-data.js +431 -0
- package/components/plugins/index.js +15 -0
- package/components/plugins/public-method.js +47 -0
- package/components/rich-editor/index-bak.vue +306 -0
- package/components/rich-editor/index.vue +236 -0
- package/components/rich-editor/langs/zh-Hans.js +438 -0
- package/components/rich-editor/viewer.vue +105 -0
- package/components/super-grid/apis.js +1065 -0
- package/components/super-grid/columns-config.vue +430 -0
- package/components/super-grid/custom-formatter.js +330 -0
- package/components/super-grid/dynamic-input.vue +1706 -0
- package/components/super-grid/eventBus.js +2 -0
- package/components/super-grid/events.js +56 -0
- package/components/super-grid/formValidatorUtil.js +300 -0
- package/components/super-grid/formatter.js +190 -0
- package/components/super-grid/group-column.vue +100 -0
- package/components/super-grid/header-context-menu.vue +82 -0
- package/components/super-grid/index-column.vue +69 -0
- package/components/super-grid/normal-column.vue +1148 -0
- package/components/super-grid/public-methods.js +30 -0
- package/components/super-grid/row-operation.vue +193 -0
- package/components/super-grid/search-button.vue +74 -0
- package/components/super-grid/search-condition-input.vue +73 -0
- package/components/super-grid/search-condition-list.vue +68 -0
- package/components/super-grid/search-form-advancedQuery.vue +820 -0
- package/components/super-grid/search-form-dialog.vue +77 -0
- package/components/super-grid/search-form-item.vue +470 -0
- package/components/super-grid/search-form-number.vue +111 -0
- package/components/super-grid/search-form-open.vue +178 -0
- package/components/super-grid/search-form-ordinarySearch.vue +218 -0
- package/components/super-grid/search-form.vue +756 -0
- package/components/super-grid/search-methods.js +484 -0
- package/components/super-grid/selection-column.vue +46 -0
- package/components/super-grid/store.js +3 -0
- package/components/super-grid/super-grid-service.js +682 -0
- package/components/super-grid/super-grid.vue +2893 -0
- package/components/super-grid/utils.js +851 -0
- package/components/super-grid/view-image-dialog.vue +173 -0
- package/components/utils/gogocodeTransfer.js +59 -0
- package/components/utils/utils.js +180 -0
- package/components/utils/value-set.js +98 -0
- package/components/z-test-utton/index.vue +82 -0
- package/package.json +29 -40
- package/public/index.html +13 -0
- package/public/vite.svg +1 -0
- package/src/api/sso-service.js +172 -19
- package/src/api/tab.js +36 -0
- package/src/api/user-service.js +11 -11
- package/src/assets/401/401.gif +0 -0
- package/src/assets/404/404-cloud.png +0 -0
- package/src/assets/404/404.png +0 -0
- package/src/assets/cloud.png +0 -0
- package/src/directives/permission/index.js +13 -13
- package/src/directives/permission/permission.js +20 -15
- package/src/i18n/i18n.js +16 -0
- package/src/i18n/langs/cn.js +254 -0
- package/src/i18n/langs/en.js +264 -0
- package/src/permission.js +157 -71
- package/src/plugins.js +18 -18
- package/src/router/index.js +96 -69
- package/src/store/getters.js +15 -10
- package/src/store/index.js +19 -19
- package/src/store/modules/app.js +54 -42
- package/src/store/modules/permission.js +137 -73
- package/src/store/modules/tab-content.js +36 -0
- package/src/store/modules/user.js +293 -80
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/element-ui.scss +29 -29
- package/src/styles/index.scss +157 -78
- package/src/styles/mixin.scss +27 -27
- package/src/styles/theme/black/font-style.scss +70 -0
- package/src/styles/theme/black/index.scss +306 -0
- package/src/styles/theme/black/sidebar.scss +189 -0
- package/src/styles/theme/blue/font-style.scss +46 -0
- package/src/styles/theme/blue/index.scss +172 -0
- package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
- package/src/styles/theme/blue2/font-style.scss +70 -0
- package/src/styles/theme/blue2/index.scss +188 -0
- package/src/styles/theme/blue2/sidebar.scss +201 -0
- package/src/styles/theme/dark-blue/button.scss +9 -0
- package/src/styles/theme/dark-blue/card.scss +62 -0
- package/src/styles/theme/dark-blue/checkbox.scss +10 -0
- package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
- package/src/styles/theme/dark-blue/dialog.scss +21 -0
- package/src/styles/theme/dark-blue/element-variables.scss +7 -0
- package/src/styles/theme/dark-blue/font.scss +71 -0
- package/src/styles/theme/dark-blue/form.scss +51 -0
- package/src/styles/theme/dark-blue/index.scss +269 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/message.scss +8 -0
- package/src/styles/theme/dark-blue/pagination.scss +14 -0
- package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
- package/src/styles/theme/dark-blue/sidebar.scss +266 -0
- package/src/styles/theme/dark-blue/tab.scss +83 -0
- package/src/styles/theme/dark-blue/table.scss +60 -0
- package/src/styles/theme/dark-blue/tree.scss +31 -0
- package/src/styles/theme/dark-blue/var.scss +1028 -0
- package/src/styles/theme/gray/card-style.scss +54 -0
- package/src/styles/theme/gray/font-style.scss +70 -0
- package/src/styles/theme/gray/index.scss +172 -0
- package/src/styles/theme/gray/input-style.scss +19 -0
- package/src/styles/theme/gray/scrollbar-style.scss +32 -0
- package/src/styles/theme/gray/sidebar.scss +231 -0
- package/src/styles/theme/gray/tab-style.scss +81 -0
- package/src/styles/transition.scss +47 -46
- package/src/utils/auth-api.js +159 -0
- package/src/utils/auth.js +61 -15
- package/src/utils/calculator/calculator-factory-wf.js +558 -0
- package/src/utils/calculator/calculator-factory.js +145 -0
- package/src/utils/calculator/calculator-util.js +166 -0
- package/src/utils/common-util.js +305 -0
- package/src/utils/eventBus.js +2 -0
- package/src/utils/iconUtils.js +28 -0
- package/src/utils/index.js +102 -86
- package/src/utils/jump-page-utils.js +814 -0
- package/src/utils/local-storage.js +33 -31
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +31 -26
- package/src/utils/permissionAuth.js +90 -0
- package/src/utils/range-selector.js +188 -0
- package/src/utils/request.js +270 -116
- package/src/utils/restful-interface-utils.js +57 -0
- package/src/utils/util.js +698 -0
- package/src/utils/validate.js +34 -33
- package/src/utils/watermark.js +108 -0
- package/src/utils/workflow-util.js +93 -0
- package/src/views/404.vue +248 -228
- package/src/views/dsc-component/Sidebar/Item.vue +84 -0
- package/src/views/dsc-component/Sidebar/Link.vue +38 -0
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
- package/src/views/dsc-component/Sidebar/index.vue +220 -0
- package/src/views/dsc-component/tabs/tab-content.vue +199 -0
- package/src/views/error-page/401.vue +106 -91
- package/src/views/error-page/404.vue +248 -228
- package/src/views/layout/EmptyLayout.vue +3 -0
- package/src/views/layout/Layout.vue +81 -68
- package/src/views/layout/NewLayout.vue +18 -0
- package/src/views/layout/components/AppMain.vue +39 -29
- package/src/views/layout/components/Breadcrumb/index.vue +156 -0
- package/src/views/layout/components/Menubar/Item.vue +57 -0
- package/src/views/layout/components/Menubar/Link.vue +38 -0
- package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
- package/src/views/layout/components/Menubar/index.vue +210 -0
- package/src/views/layout/components/Sidebar/Item.vue +53 -29
- package/src/views/layout/components/Sidebar/Link.vue +38 -39
- package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
- package/src/views/layout/components/Sidebar/index.vue +141 -48
- package/src/views/layout/components/iframe-page.vue +38 -0
- package/src/views/layout/components/index.js +4 -3
- package/src/views/layout/components/tabs/tab-content.vue +207 -0
- package/src/views/layout/mixin/ResizeHandler.js +41 -41
- package/src/views/layout/tab-content-iframe-index.vue +38 -0
- package/src/views/layout/tab-content-index.vue +93 -0
- package/src/views/login/authredirect.vue +10 -10
- package/src/views/login/index.vue +296 -203
- package/src/views/login/update-password.vue +243 -0
- package/src/views/redirect/index.vue +14 -12
- package/src/views/wf-history/tache-subprocess-history.vue +45 -0
- package/vite.config.js +31 -0
- package/lib/super-ui.css +0 -1
- package/lib/super-ui.umd.min.js +0 -2
- package/src/styles/variables.scss +0 -4
- package/src/views/layout/components/Navbar.vue +0 -92
package/src/router/index.js
CHANGED
|
@@ -1,69 +1,96 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import * as Vue from 'vue'
|
|
2
|
+
import * as VueRouter from 'vue-router'
|
|
3
|
+
|
|
4
|
+
/* Layout */
|
|
5
|
+
import Layout from '../views/layout/NewLayout.vue'
|
|
6
|
+
|
|
7
|
+
export const publicRouterMap = [
|
|
8
|
+
{
|
|
9
|
+
path: '/redirect',
|
|
10
|
+
component: Layout,
|
|
11
|
+
hidden: true,
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
path: '/redirect/:path*',
|
|
15
|
+
component: Vue.defineAsyncComponent(
|
|
16
|
+
() => import('../views/redirect/index.vue')
|
|
17
|
+
),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
path: '/iframe-page',
|
|
23
|
+
component: Layout,
|
|
24
|
+
hidden: true,
|
|
25
|
+
children: [
|
|
26
|
+
{
|
|
27
|
+
path: 'page',
|
|
28
|
+
component: Vue.defineAsyncComponent(
|
|
29
|
+
() => import('../views/layout/components/iframe-page.vue')
|
|
30
|
+
),
|
|
31
|
+
hidden: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
// {
|
|
36
|
+
// path: '/login',
|
|
37
|
+
// component: () => import('../views/login/index'),
|
|
38
|
+
// hidden: true
|
|
39
|
+
// },
|
|
40
|
+
{
|
|
41
|
+
path: '/auth-redirect',
|
|
42
|
+
component: Vue.defineAsyncComponent(
|
|
43
|
+
() => import('../views/login/authredirect.vue')
|
|
44
|
+
),
|
|
45
|
+
hidden: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
path: '/404',
|
|
49
|
+
component: Vue.defineAsyncComponent(
|
|
50
|
+
() => import('../views/error-page/404.vue')
|
|
51
|
+
),
|
|
52
|
+
hidden: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
path: '/401',
|
|
56
|
+
component: Vue.defineAsyncComponent(
|
|
57
|
+
() => import('../views/error-page/401.vue')
|
|
58
|
+
),
|
|
59
|
+
hidden: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
path: '/show-sub-wf-history',
|
|
63
|
+
component: Vue.defineAsyncComponent(
|
|
64
|
+
() => import('../views/wf-history/tache-subprocess-history.vue')
|
|
65
|
+
),
|
|
66
|
+
hidden: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
path: '/tab-content-index',
|
|
70
|
+
component: Vue.defineAsyncComponent(
|
|
71
|
+
() => import('../views/layout/tab-content-index.vue')
|
|
72
|
+
),
|
|
73
|
+
hidden: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
path: '/tab-content-iframe-index',
|
|
77
|
+
component: Vue.defineAsyncComponent(
|
|
78
|
+
() => import('../views/layout/tab-content-iframe-index.vue')
|
|
79
|
+
),
|
|
80
|
+
hidden: true,
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
export const protectedRouterMap = []
|
|
84
|
+
// 404的映射必须是最后一个
|
|
85
|
+
export const errorRouterMap = [
|
|
86
|
+
{ path: '*', redirect: '/404', hidden: true }
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
export default VueRouter.createRouter({
|
|
91
|
+
history: VueRouter.createWebHashHistory(),
|
|
92
|
+
routes: publicRouterMap, // mode: 'history', //后端支持可开
|
|
93
|
+
scrollBehavior: () => ({
|
|
94
|
+
top: 0,
|
|
95
|
+
}),
|
|
96
|
+
})
|
package/src/store/getters.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
const getters = {
|
|
2
|
-
sidebar: state => state.app.sidebar,
|
|
3
|
-
device: state => state.app.device,
|
|
4
|
-
token: state => state.user.token,
|
|
5
|
-
name: state => state.user.name,
|
|
6
|
-
// routers: state => state.permission.routers,
|
|
7
|
-
protectedRouters: state => state.permission.protectedRouters,
|
|
8
|
-
currentUserPermissions: state => state.permission.currentUserPermissions
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const getters = {
|
|
2
|
+
sidebar: (state) => state.app.sidebar,
|
|
3
|
+
device: (state) => state.app.device,
|
|
4
|
+
token: (state) => state.user.token,
|
|
5
|
+
name: (state) => state.user.name,
|
|
6
|
+
// routers: state => state.permission.routers,
|
|
7
|
+
protectedRouters: (state) => state.permission.protectedRouters,
|
|
8
|
+
currentUserPermissions: (state) => state.permission.currentUserPermissions,
|
|
9
|
+
preventReclick: (state) => state.app.preventReclick,
|
|
10
|
+
menus: (state) => state.user.menus,
|
|
11
|
+
openTab: (state) => state.tabContent.openTab,
|
|
12
|
+
activeIndex: (state) => state.tabContent.activeIndex,
|
|
13
|
+
whiteList: (state) => state.app.whiteList,
|
|
14
|
+
}
|
|
15
|
+
export default getters
|
package/src/store/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import Vuex from 'vuex'
|
|
3
|
-
import app from './modules/app'
|
|
4
|
-
import user from './modules/user'
|
|
5
|
-
import permission from './modules/permission'
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
getters
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export default store
|
|
1
|
+
import * as Vue from 'vue'
|
|
2
|
+
import * as Vuex from 'vuex'
|
|
3
|
+
import app from './modules/app'
|
|
4
|
+
import user from './modules/user'
|
|
5
|
+
import permission from './modules/permission'
|
|
6
|
+
import tabContent from './modules/tab-content'
|
|
7
|
+
import getters from './getters'
|
|
8
|
+
|
|
9
|
+
const store = Vuex.createStore({
|
|
10
|
+
modules: {
|
|
11
|
+
app,
|
|
12
|
+
user,
|
|
13
|
+
permission,
|
|
14
|
+
tabContent,
|
|
15
|
+
},
|
|
16
|
+
getters,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export default store
|
package/src/store/modules/app.js
CHANGED
|
@@ -1,42 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
state.sidebar.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
state.sidebar.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
const app = {
|
|
2
|
+
state: {
|
|
3
|
+
sidebar: {
|
|
4
|
+
opened: !+window.sessionStorage.getItem('sidebarStatus'),
|
|
5
|
+
withoutAnimation: false,
|
|
6
|
+
},
|
|
7
|
+
device: 'desktop',
|
|
8
|
+
preventReclick: false,
|
|
9
|
+
whiteList: [],
|
|
10
|
+
},
|
|
11
|
+
mutations: {
|
|
12
|
+
toggleSidebar: (state) => {
|
|
13
|
+
if (state.sidebar.opened) {
|
|
14
|
+
window.sessionStorage.setItem('sidebarStatus', 1)
|
|
15
|
+
} else {
|
|
16
|
+
window.sessionStorage.setItem('sidebarStatus', 0)
|
|
17
|
+
}
|
|
18
|
+
state.sidebar.opened = !state.sidebar.opened
|
|
19
|
+
state.sidebar.withoutAnimation = false
|
|
20
|
+
},
|
|
21
|
+
closeSidebar: (state, withoutAnimation) => {
|
|
22
|
+
window.sessionStorage.setItem('sidebarStatus', 1)
|
|
23
|
+
state.sidebar.opened = false
|
|
24
|
+
state.sidebar.withoutAnimation = withoutAnimation
|
|
25
|
+
},
|
|
26
|
+
toggleDevice: (state, device) => {
|
|
27
|
+
state.device = device
|
|
28
|
+
},
|
|
29
|
+
togglePreventReclick: (state, preventReclick) => {
|
|
30
|
+
state.preventReclick = preventReclick
|
|
31
|
+
},
|
|
32
|
+
setWhiteList: (state, whiteList) => {
|
|
33
|
+
if (whiteList instanceof Array) {
|
|
34
|
+
state.whiteList = whiteList
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
actions: {
|
|
39
|
+
toggleSidebar: ({ commit }) => {
|
|
40
|
+
commit('toggleSidebar')
|
|
41
|
+
},
|
|
42
|
+
closeSidebar({ commit }, { withoutAnimation }) {
|
|
43
|
+
commit('closeSidebar', withoutAnimation)
|
|
44
|
+
},
|
|
45
|
+
toggelDevice({ commit }, device) {
|
|
46
|
+
commit('toggleDevice', device)
|
|
47
|
+
},
|
|
48
|
+
addWhiteList({ commit }, whiteList) {
|
|
49
|
+
commit('setWhiteList', whiteList)
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default app
|
|
@@ -1,73 +1,137 @@
|
|
|
1
|
-
import { protectedRouterMap } from '../../router'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 通过meta.role判断是否与当前用户权限匹配
|
|
5
|
-
* @param roles
|
|
6
|
-
* @param route
|
|
7
|
-
*/
|
|
8
|
-
function hasPermission(currentUserPermissions, route) {
|
|
9
|
-
let result =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { protectedRouterMap } from '../../router'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 通过meta.role判断是否与当前用户权限匹配
|
|
5
|
+
* @param roles
|
|
6
|
+
* @param route
|
|
7
|
+
*/
|
|
8
|
+
function hasPermission(currentUserPermissions, route) {
|
|
9
|
+
let result = true
|
|
10
|
+
const orgPermission = route.meta.permission
|
|
11
|
+
if (orgPermission) {
|
|
12
|
+
result = false
|
|
13
|
+
const currentPermission = orgPermission.replace(/\./g, '__')
|
|
14
|
+
const permissionResult = currentUserPermissions[currentPermission]
|
|
15
|
+
if (permissionResult !== undefined && permissionResult === true) {
|
|
16
|
+
result = true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 递归过滤受权限保护的路由表,返回符合用户权限的路由表
|
|
24
|
+
* @param allRoutes 即protectedRouterMap
|
|
25
|
+
* @param currentUserPermissions 后台返回的当前用户具有的权限
|
|
26
|
+
*/
|
|
27
|
+
function filterProtectedRouter(allRoutes, currentUserPermissions) {
|
|
28
|
+
// console.log('filterProtectedRouter--', allRoutes)
|
|
29
|
+
const res = []
|
|
30
|
+
const menuRouters = []
|
|
31
|
+
|
|
32
|
+
allRoutes.forEach((route) => {
|
|
33
|
+
const tmp = { ...route }
|
|
34
|
+
|
|
35
|
+
if (tmp.children && tmp.children.length > 0) {
|
|
36
|
+
const routerResult = filterProtectedRouter(
|
|
37
|
+
tmp.children,
|
|
38
|
+
currentUserPermissions
|
|
39
|
+
)
|
|
40
|
+
// 所有有权限的路由,包括不是菜单的路由
|
|
41
|
+
tmp.children = routerResult.allRouters
|
|
42
|
+
// 所有菜单路由
|
|
43
|
+
tmp.menuChildren = routerResult.menuRouters
|
|
44
|
+
if (tmp.menuChildren && tmp.menuChildren.length > 0) {
|
|
45
|
+
if (tmp.redirectTmp) {
|
|
46
|
+
tmp.redirectTmp = tmp.redirectTmp + '/' + tmp.menuChildren[0].path
|
|
47
|
+
} else {
|
|
48
|
+
tmp.redirectTmp = tmp.path + '/' + tmp.menuChildren[0].path
|
|
49
|
+
}
|
|
50
|
+
res.push(tmp)
|
|
51
|
+
menuRouters.push(tmp)
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
if (tmp.path === '') {
|
|
55
|
+
// 表示是空路由,即系统路由
|
|
56
|
+
res.push(tmp)
|
|
57
|
+
} else {
|
|
58
|
+
if (hasPermission(currentUserPermissions, tmp)) {
|
|
59
|
+
if (
|
|
60
|
+
typeof tmp.hidden === 'undefined' ||
|
|
61
|
+
(typeof tmp.hidden !== 'undefined' && tmp.hidden === false)
|
|
62
|
+
) {
|
|
63
|
+
menuRouters.push(tmp)
|
|
64
|
+
}
|
|
65
|
+
res.push(tmp)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
return { allRouters: res, menuRouters: menuRouters }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const permission = {
|
|
75
|
+
state: {
|
|
76
|
+
// routers: publicRouterMap,
|
|
77
|
+
protectedRouters: [],
|
|
78
|
+
currentUserPermissions: [],
|
|
79
|
+
},
|
|
80
|
+
mutations: {
|
|
81
|
+
setCurrentUserPermissions: (state, currentUserPermissions) => {
|
|
82
|
+
state.currentUserPermissions = currentUserPermissions
|
|
83
|
+
},
|
|
84
|
+
setRouters: (state, routers) => {
|
|
85
|
+
state.protectedRouters = routers
|
|
86
|
+
// 把公共路由,用户有权限的路由,错误路由合并后就是当前用户的完整路由表
|
|
87
|
+
// state.routers = publicRouterMap.concat(routers).concat(errorRouterMap)
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
actions: {
|
|
91
|
+
generateRoutes({ commit }, data) {
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
const currentUserPermissions = data
|
|
94
|
+
// commit('setCurrentUserPermissions', currentUserPermissions)
|
|
95
|
+
const accessableRoutersResult = filterProtectedRouter(
|
|
96
|
+
protectedRouterMap,
|
|
97
|
+
currentUserPermissions
|
|
98
|
+
)
|
|
99
|
+
const accessableRouters = accessableRoutersResult.allRouters
|
|
100
|
+
const allMenuRoutes = accessableRoutersResult.menuRouters
|
|
101
|
+
// console.log('有权限的路由表结果==', accessableRouters)
|
|
102
|
+
// 动态添加空路由(即系统路由)
|
|
103
|
+
if (accessableRouters.length > 0) {
|
|
104
|
+
// 获得所有菜单路由
|
|
105
|
+
// console.log('allMenuRoutes==', allMenuRoutes)
|
|
106
|
+
const emptyPathRouter = {
|
|
107
|
+
path: '',
|
|
108
|
+
}
|
|
109
|
+
if (allMenuRoutes.length > 0) {
|
|
110
|
+
if (accessableRouters[0].path !== '') {
|
|
111
|
+
// 表示不包含空路由,需要添加空路由
|
|
112
|
+
if (allMenuRoutes[0].redirectTmp) {
|
|
113
|
+
emptyPathRouter.redirect = allMenuRoutes[0].redirectTmp
|
|
114
|
+
}
|
|
115
|
+
accessableRouters.push(emptyPathRouter)
|
|
116
|
+
} else if (
|
|
117
|
+
allMenuRoutes.length > 0 &&
|
|
118
|
+
accessableRouters[0].path === '' &&
|
|
119
|
+
(!allMenuRoutes[0].children ||
|
|
120
|
+
allMenuRoutes[0].children.length === 0)
|
|
121
|
+
) {
|
|
122
|
+
// 表示自己配置了空路由,且没有子路由
|
|
123
|
+
if (allMenuRoutes[0].redirectTmp) {
|
|
124
|
+
accessableRouters[0].redirect = allMenuRoutes[0].redirectTmp
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// console.log('更新后的有权限的路由表结果,更新了根路由跳转的地址==', accessableRouters)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
commit('setRouters', accessableRouters)
|
|
131
|
+
resolve()
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export default permission
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const tabContent = {
|
|
2
|
+
state: {
|
|
3
|
+
openTab: [], // 所有打开的路由
|
|
4
|
+
activeIndex: null, // 激活状态
|
|
5
|
+
},
|
|
6
|
+
mutations: {
|
|
7
|
+
// 添加tabs
|
|
8
|
+
add_tabs(state, data) {
|
|
9
|
+
state.openTab.push(data)
|
|
10
|
+
},
|
|
11
|
+
// 删除tabs
|
|
12
|
+
delete_tabs(state, route) {
|
|
13
|
+
let index = 0
|
|
14
|
+
for (const option of state.openTab) {
|
|
15
|
+
if (option.code === route.code) {
|
|
16
|
+
break
|
|
17
|
+
}
|
|
18
|
+
index++
|
|
19
|
+
}
|
|
20
|
+
state.openTab.splice(index, 1)
|
|
21
|
+
},
|
|
22
|
+
// 设置当前激活的tab
|
|
23
|
+
set_active_index(state, index) {
|
|
24
|
+
state.activeIndex = index
|
|
25
|
+
},
|
|
26
|
+
// 清空tabs
|
|
27
|
+
clear_tabs(state, route) {
|
|
28
|
+
if (state.openTab.length > 0) {
|
|
29
|
+
state.openTab.splice(0, state.openTab.length)
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
actions: {},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default tabContent
|