@lambo-design/shared 1.0.0-beta.361 → 1.0.0-beta.362
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/nstyles/components/table.less +3 -0
- package/package.json +1 -1
- package/utils/base64.js +126 -126
- package/utils/getChild.js +87 -87
- package/utils/menu/generatorDynamicRouter.js +304 -301
- package/utils/menu/index.js +4 -1
- package/config/themes/atrovirens/var.css +0 -29
- package/config/themes/atrovirens/var.css.map +0 -1
- package/config/themes/gold/var.css +0 -0
- package/config/themes/gold/var.css.map +0 -0
- package/nstyles/index.css +0 -2676
- package/nstyles/index.css.map +0 -1
|
@@ -1,301 +1,304 @@
|
|
|
1
|
-
import config from "../../config/config"
|
|
2
|
-
import { deepCopy } from '../assist'
|
|
3
|
-
import { getUrlParams } from '../platform'
|
|
4
|
-
|
|
5
|
-
const ROUTE_PERMISSION_TYPES = new Set([1, 2, 4])
|
|
6
|
-
|
|
7
|
-
function isAppMatched(itemAppId, appIds) {
|
|
8
|
-
if (!appIds) {
|
|
9
|
-
return true
|
|
10
|
-
}
|
|
11
|
-
if (itemAppId === appIds) {
|
|
12
|
-
return true
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(appIds)) {
|
|
15
|
-
return appIds.indexOf(itemAppId) > -1
|
|
16
|
-
}
|
|
17
|
-
if (typeof appIds === 'string') {
|
|
18
|
-
return appIds.indexOf(itemAppId) > -1
|
|
19
|
-
}
|
|
20
|
-
return false
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function shouldIncludePermission(item, appIds, generateType) {
|
|
24
|
-
const appIdCondition = isAppMatched(item.appId, appIds)
|
|
25
|
-
if (generateType === 'menu') {
|
|
26
|
-
const hideInMenuCondition = !(Object.prototype.hasOwnProperty.call(item, 'hideInMenu') && item.hideInMenu)
|
|
27
|
-
return appIdCondition && hideInMenuCondition
|
|
28
|
-
}
|
|
29
|
-
if (generateType && generateType === 'router') {
|
|
30
|
-
return appIdCondition
|
|
31
|
-
}
|
|
32
|
-
return false
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function buildChildrenMap(permissionList, appIds, generateType) {
|
|
36
|
-
const childrenMap = new Map()
|
|
37
|
-
|
|
38
|
-
permissionList.forEach((item) => {
|
|
39
|
-
if (!item || !ROUTE_PERMISSION_TYPES.has(item.type)) {
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
if (!shouldIncludePermission(item, appIds, generateType)) {
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const pid = item.pid
|
|
47
|
-
if (!childrenMap.has(pid)) {
|
|
48
|
-
childrenMap.set(pid, [])
|
|
49
|
-
}
|
|
50
|
-
childrenMap.get(pid).push(item)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
return childrenMap
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function createCrumb(item) {
|
|
57
|
-
return {
|
|
58
|
-
icon: item.icon,
|
|
59
|
-
name: item.name,
|
|
60
|
-
title: item.label,
|
|
61
|
-
type: item.type
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function buildMenuTree(childrenMap, parentId, crumbs, root, pageChildren) {
|
|
66
|
-
const siblings = childrenMap.get(parentId) || []
|
|
67
|
-
const menuTree = []
|
|
68
|
-
|
|
69
|
-
siblings.forEach((item) => {
|
|
70
|
-
if (item.type === 1 || item.type === 2) {
|
|
71
|
-
const node = {
|
|
72
|
-
meta: {
|
|
73
|
-
data: deepCopy(item),
|
|
74
|
-
appId: item.appId,
|
|
75
|
-
title: item.label,
|
|
76
|
-
icon: item.icon,
|
|
77
|
-
crumbs: [...crumbs],
|
|
78
|
-
activeName: item.name,
|
|
79
|
-
notCache: Boolean(item.notCache),
|
|
80
|
-
hideInMenu: Boolean(item.hideInMenu)
|
|
81
|
-
},
|
|
82
|
-
permissionId: item.permissionId,
|
|
83
|
-
type: item.type,
|
|
84
|
-
pid: item.pid,
|
|
85
|
-
component: item.name,
|
|
86
|
-
name: item.name,
|
|
87
|
-
uri: item.uri,
|
|
88
|
-
children: []
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
node.meta.crumbs.push(createCrumb(item))
|
|
92
|
-
|
|
93
|
-
if (item.type === 1) {
|
|
94
|
-
node.component = root ? 'Main' : 'parentView'
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
node.children = buildMenuTree(childrenMap, item.permissionId, node.meta.crumbs, false, pageChildren)
|
|
98
|
-
if (!node.children.length) {
|
|
99
|
-
delete node.children
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
menuTree.push(node)
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (item.type === 4) {
|
|
107
|
-
const child = {
|
|
108
|
-
meta: {
|
|
109
|
-
data: deepCopy(item),
|
|
110
|
-
appId: item.appId,
|
|
111
|
-
title: item.label,
|
|
112
|
-
hideInMenu: true,
|
|
113
|
-
notCache: true,
|
|
114
|
-
crumbs: [...crumbs],
|
|
115
|
-
type: item.type
|
|
116
|
-
},
|
|
117
|
-
permissionId: item.permissionId,
|
|
118
|
-
type: item.type,
|
|
119
|
-
pid: item.pid,
|
|
120
|
-
component: item.name,
|
|
121
|
-
name: item.name,
|
|
122
|
-
uri: item.uri
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
child.meta.crumbs.push(createCrumb(item))
|
|
126
|
-
pageChildren.push(child)
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
return menuTree
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function generatorMenuRouter(permissionList, appIds, generateType = 'router') {
|
|
134
|
-
const pageNode = {
|
|
135
|
-
path: '/page',
|
|
136
|
-
name: 'page',
|
|
137
|
-
meta: {
|
|
138
|
-
hideInMenu: true,
|
|
139
|
-
notCache: true
|
|
140
|
-
},
|
|
141
|
-
component: 'Main',
|
|
142
|
-
children: []
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const childrenMap = buildChildrenMap(permissionList || [], appIds, generateType)
|
|
146
|
-
const menuData = buildMenuTree(childrenMap, '0', [], true, pageNode.children)
|
|
147
|
-
return { menuData, pageNode }
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function generator(menuData, constantRouterComponents) {
|
|
151
|
-
for (const item of menuData) {
|
|
152
|
-
if (item.component && typeof item.component === 'string') {
|
|
153
|
-
const target = constantRouterComponents[item.component]
|
|
154
|
-
if (target) {
|
|
155
|
-
if (target.component) {
|
|
156
|
-
if (typeof target.component === 'string') {
|
|
157
|
-
try {
|
|
158
|
-
item.component = resolve =>
|
|
159
|
-
require(['@/view/' + target.component], data => {
|
|
160
|
-
data.default.name = item.name
|
|
161
|
-
resolve(data)
|
|
162
|
-
})
|
|
163
|
-
} catch (e) {
|
|
164
|
-
delete item.component
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
item.component = target.component
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (target.url) {
|
|
171
|
-
let path = target.url
|
|
172
|
-
let query = {}
|
|
173
|
-
if (path.indexOf('?') > -1) {
|
|
174
|
-
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
175
|
-
item.query = query
|
|
176
|
-
path = path.substr(0, path.indexOf('?'))
|
|
177
|
-
}
|
|
178
|
-
item.path = path
|
|
179
|
-
}
|
|
180
|
-
if (item.uri) {
|
|
181
|
-
item.meta.uriParam = item.uri
|
|
182
|
-
}
|
|
183
|
-
if (target.notCache) {
|
|
184
|
-
item.meta.notCache = target.notCache
|
|
185
|
-
}
|
|
186
|
-
if (target.hideInMenu) {
|
|
187
|
-
item.meta.hideInMenu = target.hideInMenu
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (item.uri) {
|
|
191
|
-
if (item.uri.startsWith('/')) {
|
|
192
|
-
item.uri = item.uri.substr(1)
|
|
193
|
-
}
|
|
194
|
-
let uri = item.uri
|
|
195
|
-
if (uri.startsWith(config.routerBase + '/')) {
|
|
196
|
-
uri = uri.replace(config.routerBase + '/', '')
|
|
197
|
-
}
|
|
198
|
-
if (uri.startsWith('dida/')) {
|
|
199
|
-
item.meta.notCache = true
|
|
200
|
-
let path = uri
|
|
201
|
-
let query = {}
|
|
202
|
-
if (path.indexOf('?') > -1) {
|
|
203
|
-
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
204
|
-
item.query = query
|
|
205
|
-
path = path.substr(0, path.indexOf('?'))
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
item.component = resolve => {
|
|
209
|
-
require(['@/view/dida/dida-page'], data => {
|
|
210
|
-
data.default.name = item.name
|
|
211
|
-
resolve(data)
|
|
212
|
-
})
|
|
213
|
-
}
|
|
214
|
-
} catch (e) {
|
|
215
|
-
delete item.component
|
|
216
|
-
}
|
|
217
|
-
item.path = '/' + path
|
|
218
|
-
} else if (uri.startsWith('dareport/')) {
|
|
219
|
-
item.meta.notCache = true
|
|
220
|
-
let path = uri
|
|
221
|
-
let query = {}
|
|
222
|
-
if (path.indexOf('?') > -1) {
|
|
223
|
-
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
224
|
-
item.query = query
|
|
225
|
-
path = path.substr(0, path.indexOf('?'))
|
|
226
|
-
}
|
|
227
|
-
try {
|
|
228
|
-
item.component = resolve => {
|
|
229
|
-
require(['@/view/dida/dida-page'], data => {
|
|
230
|
-
data.default.name = item.name
|
|
231
|
-
resolve(data)
|
|
232
|
-
})
|
|
233
|
-
}
|
|
234
|
-
} catch (e) {
|
|
235
|
-
delete item.component
|
|
236
|
-
}
|
|
237
|
-
item.path = '/' + path
|
|
238
|
-
} else {
|
|
239
|
-
try {
|
|
240
|
-
let path = item.uri
|
|
241
|
-
if (item.uri.startsWith(config.routerBase + '/')) {
|
|
242
|
-
path = path.replace(config.routerBase + '/', '')
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
if (item.
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
if (item.
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
1
|
+
import config from "../../config/config"
|
|
2
|
+
import { deepCopy } from '../assist'
|
|
3
|
+
import { getUrlParams } from '../platform'
|
|
4
|
+
|
|
5
|
+
const ROUTE_PERMISSION_TYPES = new Set([1, 2, 4])
|
|
6
|
+
|
|
7
|
+
function isAppMatched(itemAppId, appIds) {
|
|
8
|
+
if (!appIds) {
|
|
9
|
+
return true
|
|
10
|
+
}
|
|
11
|
+
if (itemAppId === appIds) {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(appIds)) {
|
|
15
|
+
return appIds.indexOf(itemAppId) > -1
|
|
16
|
+
}
|
|
17
|
+
if (typeof appIds === 'string') {
|
|
18
|
+
return appIds.indexOf(itemAppId) > -1
|
|
19
|
+
}
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function shouldIncludePermission(item, appIds, generateType) {
|
|
24
|
+
const appIdCondition = isAppMatched(item.appId, appIds)
|
|
25
|
+
if (generateType === 'menu') {
|
|
26
|
+
const hideInMenuCondition = !(Object.prototype.hasOwnProperty.call(item, 'hideInMenu') && item.hideInMenu)
|
|
27
|
+
return appIdCondition && hideInMenuCondition
|
|
28
|
+
}
|
|
29
|
+
if (generateType && generateType === 'router') {
|
|
30
|
+
return appIdCondition
|
|
31
|
+
}
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function buildChildrenMap(permissionList, appIds, generateType) {
|
|
36
|
+
const childrenMap = new Map()
|
|
37
|
+
|
|
38
|
+
permissionList.forEach((item) => {
|
|
39
|
+
if (!item || !ROUTE_PERMISSION_TYPES.has(item.type)) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (!shouldIncludePermission(item, appIds, generateType)) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const pid = item.pid
|
|
47
|
+
if (!childrenMap.has(pid)) {
|
|
48
|
+
childrenMap.set(pid, [])
|
|
49
|
+
}
|
|
50
|
+
childrenMap.get(pid).push(item)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return childrenMap
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function createCrumb(item) {
|
|
57
|
+
return {
|
|
58
|
+
icon: item.icon,
|
|
59
|
+
name: item.name,
|
|
60
|
+
title: item.label,
|
|
61
|
+
type: item.type
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function buildMenuTree(childrenMap, parentId, crumbs, root, pageChildren) {
|
|
66
|
+
const siblings = childrenMap.get(parentId) || []
|
|
67
|
+
const menuTree = []
|
|
68
|
+
|
|
69
|
+
siblings.forEach((item) => {
|
|
70
|
+
if (item.type === 1 || item.type === 2) {
|
|
71
|
+
const node = {
|
|
72
|
+
meta: {
|
|
73
|
+
data: deepCopy(item),
|
|
74
|
+
appId: item.appId,
|
|
75
|
+
title: item.label,
|
|
76
|
+
icon: item.icon,
|
|
77
|
+
crumbs: [...crumbs],
|
|
78
|
+
activeName: item.name,
|
|
79
|
+
notCache: Boolean(item.notCache),
|
|
80
|
+
hideInMenu: Boolean(item.hideInMenu)
|
|
81
|
+
},
|
|
82
|
+
permissionId: item.permissionId,
|
|
83
|
+
type: item.type,
|
|
84
|
+
pid: item.pid,
|
|
85
|
+
component: item.name,
|
|
86
|
+
name: item.name,
|
|
87
|
+
uri: item.uri,
|
|
88
|
+
children: []
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
node.meta.crumbs.push(createCrumb(item))
|
|
92
|
+
|
|
93
|
+
if (item.type === 1) {
|
|
94
|
+
node.component = root ? 'Main' : 'parentView'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
node.children = buildMenuTree(childrenMap, item.permissionId, node.meta.crumbs, false, pageChildren)
|
|
98
|
+
if (!node.children.length) {
|
|
99
|
+
delete node.children
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
menuTree.push(node)
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (item.type === 4) {
|
|
107
|
+
const child = {
|
|
108
|
+
meta: {
|
|
109
|
+
data: deepCopy(item),
|
|
110
|
+
appId: item.appId,
|
|
111
|
+
title: item.label,
|
|
112
|
+
hideInMenu: true,
|
|
113
|
+
notCache: true,
|
|
114
|
+
crumbs: [...crumbs],
|
|
115
|
+
type: item.type
|
|
116
|
+
},
|
|
117
|
+
permissionId: item.permissionId,
|
|
118
|
+
type: item.type,
|
|
119
|
+
pid: item.pid,
|
|
120
|
+
component: item.name,
|
|
121
|
+
name: item.name,
|
|
122
|
+
uri: item.uri
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
child.meta.crumbs.push(createCrumb(item))
|
|
126
|
+
pageChildren.push(child)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
return menuTree
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function generatorMenuRouter(permissionList, appIds, generateType = 'router') {
|
|
134
|
+
const pageNode = {
|
|
135
|
+
path: '/page',
|
|
136
|
+
name: 'page',
|
|
137
|
+
meta: {
|
|
138
|
+
hideInMenu: true,
|
|
139
|
+
notCache: true
|
|
140
|
+
},
|
|
141
|
+
component: 'Main',
|
|
142
|
+
children: []
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const childrenMap = buildChildrenMap(permissionList || [], appIds, generateType)
|
|
146
|
+
const menuData = buildMenuTree(childrenMap, '0', [], true, pageNode.children)
|
|
147
|
+
return { menuData, pageNode }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function generator(menuData, constantRouterComponents) {
|
|
151
|
+
for (const item of menuData) {
|
|
152
|
+
if (item.component && typeof item.component === 'string') {
|
|
153
|
+
const target = constantRouterComponents[item.component]
|
|
154
|
+
if (target) {
|
|
155
|
+
if (target.component) {
|
|
156
|
+
if (typeof target.component === 'string') {
|
|
157
|
+
try {
|
|
158
|
+
item.component = resolve =>
|
|
159
|
+
require(['@/view/' + target.component], data => {
|
|
160
|
+
data.default.name = item.name
|
|
161
|
+
resolve(data)
|
|
162
|
+
})
|
|
163
|
+
} catch (e) {
|
|
164
|
+
delete item.component
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
item.component = target.component
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (target.url) {
|
|
171
|
+
let path = target.url
|
|
172
|
+
let query = {}
|
|
173
|
+
if (path.indexOf('?') > -1) {
|
|
174
|
+
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
175
|
+
item.query = query
|
|
176
|
+
path = path.substr(0, path.indexOf('?'))
|
|
177
|
+
}
|
|
178
|
+
item.path = path
|
|
179
|
+
}
|
|
180
|
+
if (item.uri) {
|
|
181
|
+
item.meta.uriParam = item.uri
|
|
182
|
+
}
|
|
183
|
+
if (target.notCache) {
|
|
184
|
+
item.meta.notCache = target.notCache
|
|
185
|
+
}
|
|
186
|
+
if (target.hideInMenu) {
|
|
187
|
+
item.meta.hideInMenu = target.hideInMenu
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (item.uri) {
|
|
191
|
+
if (item.uri.startsWith('/')) {
|
|
192
|
+
item.uri = item.uri.substr(1)
|
|
193
|
+
}
|
|
194
|
+
let uri = item.uri
|
|
195
|
+
if (uri.startsWith(config.routerBase + '/')) {
|
|
196
|
+
uri = uri.replace(config.routerBase + '/', '')
|
|
197
|
+
}
|
|
198
|
+
if (uri.startsWith('dida/')) {
|
|
199
|
+
item.meta.notCache = true
|
|
200
|
+
let path = uri
|
|
201
|
+
let query = {}
|
|
202
|
+
if (path.indexOf('?') > -1) {
|
|
203
|
+
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
204
|
+
item.query = query
|
|
205
|
+
path = path.substr(0, path.indexOf('?'))
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
item.component = resolve => {
|
|
209
|
+
require(['@/view/dida/dida-page'], data => {
|
|
210
|
+
data.default.name = item.name
|
|
211
|
+
resolve(data)
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {
|
|
215
|
+
delete item.component
|
|
216
|
+
}
|
|
217
|
+
item.path = '/' + path
|
|
218
|
+
} else if (uri.startsWith('dareport/')) {
|
|
219
|
+
item.meta.notCache = true
|
|
220
|
+
let path = uri
|
|
221
|
+
let query = {}
|
|
222
|
+
if (path.indexOf('?') > -1) {
|
|
223
|
+
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
224
|
+
item.query = query
|
|
225
|
+
path = path.substr(0, path.indexOf('?'))
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
item.component = resolve => {
|
|
229
|
+
require(['@/view/dida/dida-page'], data => {
|
|
230
|
+
data.default.name = item.name
|
|
231
|
+
resolve(data)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
} catch (e) {
|
|
235
|
+
delete item.component
|
|
236
|
+
}
|
|
237
|
+
item.path = '/' + path
|
|
238
|
+
} else {
|
|
239
|
+
try {
|
|
240
|
+
let path = item.uri
|
|
241
|
+
/*if (item.uri.startsWith(config.routerBase + '/')) {
|
|
242
|
+
path = path.replace(config.routerBase + '/', '')
|
|
243
|
+
}*/
|
|
244
|
+
if (item.uri.indexOf(config.routerBase + "/") > -1) {
|
|
245
|
+
path = path.substr(item.uri.indexOf(config.routerBase + "/") + (config.routerBase + "/").length)
|
|
246
|
+
}
|
|
247
|
+
let query = {}
|
|
248
|
+
if (path.indexOf('?') > -1) {
|
|
249
|
+
query = getUrlParams(path.substr(path.indexOf('?')))
|
|
250
|
+
path = path.substr(0, path.indexOf('?'))
|
|
251
|
+
}
|
|
252
|
+
if (target && target.component) {
|
|
253
|
+
// target.component already overrides uri-based component resolution.
|
|
254
|
+
} else {
|
|
255
|
+
const component = require('@/view/' + path)
|
|
256
|
+
if (component) {
|
|
257
|
+
item.component = resolve => {
|
|
258
|
+
require(['@/view/' + path], data => {
|
|
259
|
+
data.default.name = item.name
|
|
260
|
+
resolve(data)
|
|
261
|
+
})
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
delete item.component
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (target && target.url) {
|
|
268
|
+
// target.url already overrides uri-based path/query resolution.
|
|
269
|
+
} else {
|
|
270
|
+
item.path = '/' + path
|
|
271
|
+
item.query = query
|
|
272
|
+
}
|
|
273
|
+
} catch (e) {
|
|
274
|
+
delete item.component
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (item.path == null) {
|
|
279
|
+
item.path = ''
|
|
280
|
+
}
|
|
281
|
+
if (item.component && typeof item.component === 'string') {
|
|
282
|
+
delete item.component
|
|
283
|
+
}
|
|
284
|
+
if (item.children && item.children.length > 0) {
|
|
285
|
+
generator(item.children, constantRouterComponents)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return menuData
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export function generatorDynamicRouter(permissionList, constantRouterComponents, appIds = null, generateType = 'router') {
|
|
293
|
+
const allMenu = generatorMenuRouter(permissionList, appIds, generateType)
|
|
294
|
+
const menuData = allMenu.menuData
|
|
295
|
+
const pageNode = allMenu.pageNode
|
|
296
|
+
|
|
297
|
+
if (menuData && pageNode && pageNode.children.length > 0) {
|
|
298
|
+
menuData.push(pageNode)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return generator(menuData, constantRouterComponents)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export default generatorDynamicRouter
|
package/utils/menu/index.js
CHANGED
|
@@ -329,8 +329,11 @@ const generator = (menuData,constantRouterComponents) => {
|
|
|
329
329
|
} else {
|
|
330
330
|
try{
|
|
331
331
|
let path = item.uri;
|
|
332
|
-
if (item.uri.startsWith(config.routerBase + "/")) {
|
|
332
|
+
/*if (item.uri.startsWith(config.routerBase + "/")) {
|
|
333
333
|
path = path.replace(config.routerBase + "/","")
|
|
334
|
+
}*/
|
|
335
|
+
if (item.uri.indexOf(config.routerBase + "/") > -1) {
|
|
336
|
+
path = path.substr(item.uri.indexOf(config.routerBase + "/") + (config.routerBase + "/").length)
|
|
334
337
|
}
|
|
335
338
|
let query = {};
|
|
336
339
|
if (path.indexOf("?") > -1) {
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
vxe-table
|
|
3
|
-
*/
|
|
4
|
-
/*font*/
|
|
5
|
-
/*size*/
|
|
6
|
-
/*icon*/
|
|
7
|
-
/*color*/
|
|
8
|
-
/*input/radio/checkbox*/
|
|
9
|
-
/*popup*/
|
|
10
|
-
/*table*/
|
|
11
|
-
/*filter*/
|
|
12
|
-
/*menu*/
|
|
13
|
-
/*loading*/
|
|
14
|
-
/*validate*/
|
|
15
|
-
/*grid*/
|
|
16
|
-
/*toolbar*/
|
|
17
|
-
/*tooltip*/
|
|
18
|
-
/*pager*/
|
|
19
|
-
/*modal*/
|
|
20
|
-
/*checkbox*/
|
|
21
|
-
/*radio*/
|
|
22
|
-
/*button*/
|
|
23
|
-
/*input*/
|
|
24
|
-
/*textarea*/
|
|
25
|
-
/*form*/
|
|
26
|
-
/*select*/
|
|
27
|
-
/*switch*/
|
|
28
|
-
/*pulldown*/
|
|
29
|
-
/*# sourceMappingURL=var.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"var.css"}
|
|
File without changes
|
|
File without changes
|