mooho-base-admin-plus 2.0.27 → 2.0.29
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/package/mooho-base-admin-plus.min.esm.js +115 -313
- package/package/mooho-base-admin-plus.min.js +13 -13
- package/package.json +1 -1
- package/public/setting.js +1 -1
- package/src/api/customModel.js +0 -1
- package/src/components/view/view-table.vue +4 -3
- package/src/index.js +2 -2
- package/src/layouts/basic-layout/index.vue +2 -3
- package/src/layouts/basic-layout/menu-head/title.vue +2 -3
- package/src/layouts/basic-layout/menu-side/index.vue +2 -2
- package/src/layouts/basic-layout/menu-side/menu-title.vue +0 -1
- package/src/layouts/basic-layout/menu-side/submenu.vue +1 -1
- package/src/layouts/basic-layout/tabs/index.vue +2 -3
- package/src/libs/util.js +0 -44
- package/src/menu/sider.js +1 -1
- package/src/pages/template/viewPage.vue +1 -1
- package/src/router/dynamic.js +38 -145
- package/src/router/index.js +11 -8
- package/src/router/routes.js +89 -0
- package/src/store/modules/admin/modules/account.js +5 -9
- package/src/store/modules/admin/modules/cache.js +13 -13
- package/src/store/modules/admin/modules/i18n.js +1 -3
- package/src/store/modules/admin/modules/menu.js +2 -21
- package/src/store/modules/admin/modules/page.js +37 -60
- package/test/router/routes.js +3 -2
- package/src/layouts/basic-layout/mixins/translate-title.js +0 -11
|
@@ -31,9 +31,9 @@ export default {
|
|
|
31
31
|
try {
|
|
32
32
|
let res = await modelApi.query(type, {});
|
|
33
33
|
|
|
34
|
-
state.caches = {
|
|
35
|
-
|
|
36
|
-
};
|
|
34
|
+
// state.caches = {
|
|
35
|
+
// ...state.caches
|
|
36
|
+
// };
|
|
37
37
|
|
|
38
38
|
state.caches[type] = res.data;
|
|
39
39
|
} catch (err) {
|
|
@@ -53,9 +53,9 @@ export default {
|
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
55
|
let res = await modelApi.query('Dict', { type: type });
|
|
56
|
-
state.dicts = {
|
|
57
|
-
|
|
58
|
-
};
|
|
56
|
+
// state.dicts = {
|
|
57
|
+
// ...state.dicts
|
|
58
|
+
// };
|
|
59
59
|
|
|
60
60
|
res.data.forEach(item => {
|
|
61
61
|
state.dicts[type][item.id] = item.displayName;
|
|
@@ -77,9 +77,9 @@ export default {
|
|
|
77
77
|
|
|
78
78
|
try {
|
|
79
79
|
let res = await enumApi.query(type);
|
|
80
|
-
state.enums = {
|
|
81
|
-
|
|
82
|
-
};
|
|
80
|
+
// state.enums = {
|
|
81
|
+
// ...state.enums
|
|
82
|
+
// };
|
|
83
83
|
|
|
84
84
|
res.forEach(item => {
|
|
85
85
|
state.enums[type][item.id] = item.name;
|
|
@@ -97,15 +97,15 @@ export default {
|
|
|
97
97
|
*/
|
|
98
98
|
async loadUserName({ state }, id) {
|
|
99
99
|
if (id && !(id in state.userNames)) {
|
|
100
|
-
state.userNames[id] =
|
|
100
|
+
state.userNames[id] = '-';
|
|
101
101
|
|
|
102
102
|
try {
|
|
103
103
|
let res = await userApi.get(id);
|
|
104
104
|
|
|
105
105
|
if (res) {
|
|
106
|
-
state.userNames = {
|
|
107
|
-
|
|
108
|
-
};
|
|
106
|
+
// state.userNames = {
|
|
107
|
+
// ...state.userNames
|
|
108
|
+
// };
|
|
109
109
|
|
|
110
110
|
state.userNames[id] = res.name;
|
|
111
111
|
}
|
|
@@ -17,25 +17,6 @@ import {
|
|
|
17
17
|
import router from '../../../../router';
|
|
18
18
|
import permissionApi from '../../../../api/permission';
|
|
19
19
|
|
|
20
|
-
// 根据 menu 配置的权限,过滤菜单
|
|
21
|
-
function filterMenu(menuList, access, lastList) {
|
|
22
|
-
menuList.forEach(menu => {
|
|
23
|
-
let menuAccess = menu.auth;
|
|
24
|
-
|
|
25
|
-
if (!menuAccess || includeArray(menuAccess, access)) {
|
|
26
|
-
let newMenu = {};
|
|
27
|
-
for (let i in menu) {
|
|
28
|
-
if (i !== 'children') newMenu[i] = cloneDeep(menu[i]);
|
|
29
|
-
}
|
|
30
|
-
if (menu.children && menu.children.length) newMenu.children = [];
|
|
31
|
-
|
|
32
|
-
lastList.push(newMenu);
|
|
33
|
-
menu.children && filterMenu(menu.children, access, newMenu.children);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return lastList;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
20
|
// 转换菜单
|
|
40
21
|
function convertMenu(source) {
|
|
41
22
|
if (!source) {
|
|
@@ -90,8 +71,8 @@ export default {
|
|
|
90
71
|
/**
|
|
91
72
|
* @description 根据 user 里登录用户权限,对侧边菜单进行鉴权过滤
|
|
92
73
|
* */
|
|
93
|
-
filterSider(state
|
|
94
|
-
return
|
|
74
|
+
filterSider(state) {
|
|
75
|
+
return state.sider;
|
|
95
76
|
},
|
|
96
77
|
/**
|
|
97
78
|
* @description 根据 user 里登录用户权限,对顶栏菜单进行鉴权过滤
|
|
@@ -83,6 +83,7 @@ export default {
|
|
|
83
83
|
}
|
|
84
84
|
return state;
|
|
85
85
|
});
|
|
86
|
+
|
|
86
87
|
// 根据 opened 数据生成缓存设置
|
|
87
88
|
commit('keepAliveRefresh');
|
|
88
89
|
// end
|
|
@@ -113,13 +114,14 @@ export default {
|
|
|
113
114
|
* @description 更新页面列表上的某一项
|
|
114
115
|
* @param {Object} param { index, params, query, fullPath } 路由信息
|
|
115
116
|
*/
|
|
116
|
-
openedUpdate({ state, dispatch }, { index, params, query, fullPath, meta, keepMeta = false }) {
|
|
117
|
+
openedUpdate({ state, dispatch }, { index, params, query, fullPath, pageName, meta, keepMeta = false }) {
|
|
117
118
|
return new Promise(async resolve => {
|
|
118
119
|
// 更新页面列表某一项
|
|
119
120
|
let page = state.opened[index];
|
|
120
121
|
page.params = params || page.params;
|
|
121
122
|
page.query = query || page.query;
|
|
122
123
|
page.fullPath = fullPath || page.fullPath;
|
|
124
|
+
page.pageName = pageName || page.pageName;
|
|
123
125
|
page.meta = meta || page.meta;
|
|
124
126
|
page.keepMeta = keepMeta;
|
|
125
127
|
state.opened.splice(index, 1, page);
|
|
@@ -133,7 +135,7 @@ export default {
|
|
|
133
135
|
* @description 更新页面当前项
|
|
134
136
|
* @param {Object} param { params, query, fullPath } 路由信息
|
|
135
137
|
*/
|
|
136
|
-
currentUpdate({ state, dispatch }, { params, query, fullPath, meta, keepMeta = false }) {
|
|
138
|
+
currentUpdate({ state, dispatch }, { params, query, fullPath, pageName, meta, keepMeta = false }) {
|
|
137
139
|
return new Promise(async resolve => {
|
|
138
140
|
setTimeout(async () => {
|
|
139
141
|
// 更新当前项
|
|
@@ -142,6 +144,7 @@ export default {
|
|
|
142
144
|
page.params = params || page.params;
|
|
143
145
|
page.query = query || page.query;
|
|
144
146
|
page.fullPath = fullPath || page.fullPath;
|
|
147
|
+
page.pageName = pageName || page.pageName;
|
|
145
148
|
page.meta = meta || page.meta;
|
|
146
149
|
page.keepMeta = keepMeta;
|
|
147
150
|
state.opened.splice(index, 1, page);
|
|
@@ -156,18 +159,19 @@ export default {
|
|
|
156
159
|
* @description 新增一个 tag (打开一个页面)
|
|
157
160
|
* @param {Object} param new tag info
|
|
158
161
|
*/
|
|
159
|
-
add({ state, commit, dispatch }, { tag, params, query, fullPath }) {
|
|
162
|
+
add({ state, commit, dispatch }, { tag, params, query, fullPath, pageName }) {
|
|
160
163
|
return new Promise(async resolve => {
|
|
161
164
|
// 设置新的 tag 在新打开一个以前没打开过的页面时使用
|
|
162
165
|
let newTag = tag;
|
|
163
166
|
newTag.params = params || newTag.params;
|
|
164
167
|
newTag.query = query || newTag.query;
|
|
165
168
|
newTag.fullPath = fullPath || newTag.fullPath;
|
|
169
|
+
newTag.pageName = pageName || newTag.pageName;
|
|
166
170
|
// 添加进当前显示的页面数组
|
|
167
171
|
state.opened.push(newTag);
|
|
168
172
|
// 如果这个页面需要缓存 将其添加到缓存设置
|
|
169
173
|
if (isKeepAlive(newTag)) {
|
|
170
|
-
commit('
|
|
174
|
+
commit('keepAliveRefresh');
|
|
171
175
|
}
|
|
172
176
|
// 持久化
|
|
173
177
|
await dispatch('opened2db');
|
|
@@ -179,7 +183,8 @@ export default {
|
|
|
179
183
|
* @description 打开一个新的页面
|
|
180
184
|
* @param {Object} param 从路由钩子的 to 对象上获取 { name, params, query, fullPath } 路由信息
|
|
181
185
|
*/
|
|
182
|
-
open({ state, commit, dispatch }, { name, params, query, fullPath }) {
|
|
186
|
+
open({ state, commit, dispatch }, { name, params, query, path, fullPath }) {
|
|
187
|
+
const pageName = router.getRoutes().find(item => item.path == path).components.default.name;
|
|
183
188
|
return new Promise(async resolve => {
|
|
184
189
|
setTimeout(async () => {
|
|
185
190
|
// 已经打开的页面
|
|
@@ -197,7 +202,8 @@ export default {
|
|
|
197
202
|
index: pageOpenedIndex,
|
|
198
203
|
params,
|
|
199
204
|
query,
|
|
200
|
-
fullPath
|
|
205
|
+
fullPath,
|
|
206
|
+
pageName
|
|
201
207
|
});
|
|
202
208
|
} else {
|
|
203
209
|
// 页面以前没有打开过
|
|
@@ -208,7 +214,8 @@ export default {
|
|
|
208
214
|
tag: Object.assign({}, page),
|
|
209
215
|
params,
|
|
210
216
|
query,
|
|
211
|
-
fullPath
|
|
217
|
+
fullPath,
|
|
218
|
+
pageName
|
|
212
219
|
});
|
|
213
220
|
}
|
|
214
221
|
}
|
|
@@ -252,11 +259,13 @@ export default {
|
|
|
252
259
|
// 找到这个页面在已经打开的数据里是第几个
|
|
253
260
|
const index = state.opened.findIndex(page => page.fullPath === tagName);
|
|
254
261
|
if (index >= 0) {
|
|
255
|
-
// 如果这个页面是缓存的页面 将其在缓存设置中删除
|
|
256
|
-
commit('keepAliveRemove', state.opened[index].name);
|
|
257
262
|
// 更新数据 删除关闭的页面
|
|
258
263
|
state.opened.splice(index, 1);
|
|
259
264
|
}
|
|
265
|
+
|
|
266
|
+
// 根据 opened 数据生成缓存设置
|
|
267
|
+
commit('keepAliveRefresh');
|
|
268
|
+
|
|
260
269
|
// 持久化
|
|
261
270
|
await dispatch('opened2db');
|
|
262
271
|
// 最后需要判断是否需要跳到首页
|
|
@@ -288,8 +297,10 @@ export default {
|
|
|
288
297
|
});
|
|
289
298
|
if (currentIndex > 0) {
|
|
290
299
|
// 删除打开的页面 并在缓存设置中删除
|
|
291
|
-
state.opened.splice(1, currentIndex - 1)
|
|
300
|
+
state.opened.splice(1, currentIndex - 1);
|
|
292
301
|
}
|
|
302
|
+
// 根据 opened 数据生成缓存设置
|
|
303
|
+
commit('keepAliveRefresh');
|
|
293
304
|
state.current = pageAim;
|
|
294
305
|
if (router.currentRoute.value.fullPath !== pageAim) {
|
|
295
306
|
router.push(pageAim);
|
|
@@ -314,7 +325,9 @@ export default {
|
|
|
314
325
|
}
|
|
315
326
|
});
|
|
316
327
|
// 删除打开的页面 并在缓存设置中删除
|
|
317
|
-
state.opened.splice(currentIndex + 1)
|
|
328
|
+
state.opened.splice(currentIndex + 1);
|
|
329
|
+
// 根据 opened 数据生成缓存设置
|
|
330
|
+
commit('keepAliveRefresh');
|
|
318
331
|
// 设置当前的页面
|
|
319
332
|
state.current = pageAim;
|
|
320
333
|
if (router.currentRoute.value.fullPath !== pageAim) {
|
|
@@ -341,11 +354,13 @@ export default {
|
|
|
341
354
|
});
|
|
342
355
|
// 删除打开的页面数据 并更新缓存设置
|
|
343
356
|
if (currentIndex === 0) {
|
|
344
|
-
state.opened.splice(1)
|
|
357
|
+
state.opened.splice(1);
|
|
345
358
|
} else {
|
|
346
|
-
state.opened.splice(currentIndex + 1)
|
|
347
|
-
state.opened.splice(1, currentIndex - 1)
|
|
359
|
+
state.opened.splice(currentIndex + 1);
|
|
360
|
+
state.opened.splice(1, currentIndex - 1);
|
|
348
361
|
}
|
|
362
|
+
// 根据 opened 数据生成缓存设置
|
|
363
|
+
commit('keepAliveRefresh');
|
|
349
364
|
// 设置新的页面
|
|
350
365
|
state.current = pageAim;
|
|
351
366
|
if (router.currentRoute.value.fullPath !== pageAim) {
|
|
@@ -364,7 +379,9 @@ export default {
|
|
|
364
379
|
closeAll({ state, commit, dispatch }) {
|
|
365
380
|
return new Promise(async resolve => {
|
|
366
381
|
// 删除打开的页面 并在缓存设置中删除
|
|
367
|
-
state.opened.splice(1)
|
|
382
|
+
state.opened.splice(1);
|
|
383
|
+
// 根据 opened 数据生成缓存设置
|
|
384
|
+
commit('keepAliveRefresh');
|
|
368
385
|
// 持久化
|
|
369
386
|
await dispatch('opened2db');
|
|
370
387
|
// 关闭所有的标签页后需要判断一次现在是不是在首页
|
|
@@ -400,38 +417,7 @@ export default {
|
|
|
400
417
|
* @param {Object} state vuex state
|
|
401
418
|
*/
|
|
402
419
|
keepAliveRefresh(state) {
|
|
403
|
-
state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.
|
|
404
|
-
},
|
|
405
|
-
/**
|
|
406
|
-
* @description 删除一个页面的缓存设置
|
|
407
|
-
* @param {Object} state vuex state
|
|
408
|
-
* @param {String} name name
|
|
409
|
-
*/
|
|
410
|
-
keepAliveRemove(state, name) {
|
|
411
|
-
const list = [...state.keepAlive];
|
|
412
|
-
const index = list.findIndex(item => item === name);
|
|
413
|
-
|
|
414
|
-
if (index !== -1) {
|
|
415
|
-
list.splice(index, 1);
|
|
416
|
-
state.keepAlive = list;
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
/**
|
|
420
|
-
* @description 增加一个页面的缓存设置
|
|
421
|
-
* @param {Object} state vuex state
|
|
422
|
-
* @param {String} name name
|
|
423
|
-
*/
|
|
424
|
-
keepAlivePush(state, name) {
|
|
425
|
-
const keep = [...state.keepAlive];
|
|
426
|
-
keep.push(name);
|
|
427
|
-
state.keepAlive = keep;
|
|
428
|
-
},
|
|
429
|
-
/**
|
|
430
|
-
* @description 清空页面缓存设置
|
|
431
|
-
* @param {Object} state vuex state
|
|
432
|
-
*/
|
|
433
|
-
keepAliveClean(state) {
|
|
434
|
-
state.keepAlive = [];
|
|
420
|
+
state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.pageName);
|
|
435
421
|
},
|
|
436
422
|
/**
|
|
437
423
|
* @class current
|
|
@@ -450,19 +436,10 @@ export default {
|
|
|
450
436
|
*/
|
|
451
437
|
init(state, routes) {
|
|
452
438
|
const pool = [];
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
} else {
|
|
458
|
-
if (!route.hidden) {
|
|
459
|
-
const { meta, name, path } = route;
|
|
460
|
-
pool.push({ meta, name, path });
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
push(routes);
|
|
439
|
+
routes.forEach(route => {
|
|
440
|
+
const { meta, name, path } = route;
|
|
441
|
+
pool.push({ meta, name, path });
|
|
442
|
+
});
|
|
466
443
|
state.pool = pool;
|
|
467
444
|
}
|
|
468
445
|
}
|
package/test/router/routes.js
CHANGED
|
@@ -10,7 +10,7 @@ const frameOut = [
|
|
|
10
10
|
path: '/login',
|
|
11
11
|
name: 'login',
|
|
12
12
|
meta: {
|
|
13
|
-
title: '
|
|
13
|
+
title: 'Front_Label_Login'
|
|
14
14
|
},
|
|
15
15
|
component: () => {
|
|
16
16
|
return new Promise(resolve => {
|
|
@@ -26,6 +26,7 @@ const frameOut = [
|
|
|
26
26
|
const frameIn = [
|
|
27
27
|
{
|
|
28
28
|
path: '/',
|
|
29
|
+
name: 'root',
|
|
29
30
|
redirect: {
|
|
30
31
|
name: 'login'
|
|
31
32
|
},
|
|
@@ -43,7 +44,7 @@ const frameIn = [
|
|
|
43
44
|
path: '/home',
|
|
44
45
|
name: 'home',
|
|
45
46
|
meta: {
|
|
46
|
-
title: '
|
|
47
|
+
title: 'Front_Label_Home',
|
|
47
48
|
description: 'Home',
|
|
48
49
|
closable: false
|
|
49
50
|
},
|