gw-gis-standard-global-vue3 1.1.80 → 1.1.83
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/gw-gis-standard-global.js +28 -177
- package/package.json +1 -1
|
@@ -555,6 +555,8 @@ var gisGlobal = /*#__PURE__*/function () {
|
|
|
555
555
|
this.tempRouteList = [];
|
|
556
556
|
// 分配角色的主页信息
|
|
557
557
|
this.roleHomeMsg = '';
|
|
558
|
+
// 获取当前角色权限信息
|
|
559
|
+
this.gisInfoRoles = [];
|
|
558
560
|
|
|
559
561
|
// 获取内容区信息 用于在业务中隐藏或显示
|
|
560
562
|
this.containerLeftWidth = null;
|
|
@@ -996,6 +998,7 @@ var gisGlobal = /*#__PURE__*/function () {
|
|
|
996
998
|
value: function showRolesMenuFn(getRouters, routerList, homePathCode) {
|
|
997
999
|
var menuFilterKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'code';
|
|
998
1000
|
if (window['gisConfig'].VITE_APP_PERMISSION === 'true') {
|
|
1001
|
+
Global.gisInfoRoles = routerList;
|
|
999
1002
|
// 初始角色还原路由显示
|
|
1000
1003
|
if (!getRouters || getRouters.getRouters.length <= 0 || !getRouters.getRouters) return console.warn('暂无角色分配');
|
|
1001
1004
|
if (getRouters.topMenuList.length > 0) {
|
|
@@ -1413,53 +1416,32 @@ var gisGlobal = /*#__PURE__*/function () {
|
|
|
1413
1416
|
}();
|
|
1414
1417
|
var Global = new gisGlobal();
|
|
1415
1418
|
function filterRolesRouterFn2(routerList) {
|
|
1416
|
-
var
|
|
1419
|
+
var roleList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1417
1420
|
var menuFilterKey = arguments.length > 2 ? arguments[2] : undefined;
|
|
1418
1421
|
for (var i = 0; i < routerList.length; i++) {
|
|
1419
1422
|
if (routerList[i].path && routerList[i].meta) {
|
|
1420
|
-
if (
|
|
1421
|
-
// if (!routerList[i].meta.notInLayout && !
|
|
1423
|
+
if (roleList.length > 0) {
|
|
1424
|
+
// if (!routerList[i].meta.notInLayout && !roleList.includes(routerList[i].meta[menuFilterKey])) {
|
|
1425
|
+
// 是为了记录角色隐藏了哪些菜单
|
|
1422
1426
|
if (!routerList[i].meta.notInLayout) {
|
|
1423
|
-
if (
|
|
1424
|
-
routerList[i].meta.
|
|
1427
|
+
if (roleList.includes(routerList[i].meta[menuFilterKey])) {
|
|
1428
|
+
routerList[i].meta.visible = true;
|
|
1425
1429
|
} else {
|
|
1426
1430
|
routerList[i].meta.gisInfoSetHideRole = true;
|
|
1427
1431
|
routerList[i].meta.visible = false;
|
|
1428
1432
|
}
|
|
1429
|
-
|
|
1430
|
-
// 是为了记录角色隐藏了哪些菜单
|
|
1431
|
-
// if (routerList[i].meta.hasOwnProperty('visible')) {
|
|
1432
|
-
// if (routerList[i].meta.visible) {
|
|
1433
|
-
// routerList[i].meta.gisInfoSetHideRole = true
|
|
1434
|
-
// routerList[i].meta.visible = false
|
|
1435
|
-
// } else {
|
|
1436
|
-
// routerList[i].meta.gisInfoSetHideRole = false
|
|
1437
|
-
// }
|
|
1438
|
-
// } else {
|
|
1439
|
-
// routerList[i].meta.visible = false
|
|
1440
|
-
// routerList[i].meta.gisInfoSetHideRole = true
|
|
1441
|
-
// }
|
|
1442
1433
|
}
|
|
1443
1434
|
} else {
|
|
1444
1435
|
// 为空则全部隐藏
|
|
1445
1436
|
if (!routerList[i].meta.notInLayout) {
|
|
1446
1437
|
routerList[i].meta.gisInfoSetHideRole = true;
|
|
1447
1438
|
routerList[i].meta.visible = false;
|
|
1448
|
-
// if (routerList[i].meta.hasOwnProperty('visible')) {
|
|
1449
|
-
// // 是为了记录角色隐藏了哪些菜单
|
|
1450
|
-
// if (!routerList[i].meta.visible) {
|
|
1451
|
-
// routerList[i].meta.gisInfoSetHideRole = false
|
|
1452
|
-
// }
|
|
1453
|
-
// routerList[i].meta.visible = false
|
|
1454
|
-
// } else {
|
|
1455
|
-
// routerList[i].meta.visible = false
|
|
1456
|
-
// }
|
|
1457
1439
|
// 清空文件
|
|
1458
1440
|
}
|
|
1459
1441
|
}
|
|
1460
1442
|
}
|
|
1461
1443
|
if (routerList[i].children && routerList[i].children.length > 0) {
|
|
1462
|
-
filterRolesRouterFn2(routerList[i].children,
|
|
1444
|
+
filterRolesRouterFn2(routerList[i].children, roleList, menuFilterKey);
|
|
1463
1445
|
}
|
|
1464
1446
|
}
|
|
1465
1447
|
}
|
|
@@ -2907,97 +2889,32 @@ var GisPermission = /*#__PURE__*/function () {
|
|
|
2907
2889
|
// }
|
|
2908
2890
|
// }
|
|
2909
2891
|
// }
|
|
2910
|
-
|
|
2892
|
+
// -----------------------------
|
|
2911
2893
|
// 判断如果导航栏重定向的子菜单是,根据权限而隐藏的 ,则将菜单在该菜单数组中找到能显示的第一个页面 并跳转(找不到,不跳转),
|
|
2912
2894
|
// 注意:权限不足,直接跳转403
|
|
2913
|
-
// if (to.matched.length > 0) {
|
|
2914
|
-
// // const lastRouteMsg = to.matched.at(-1)
|
|
2915
|
-
// const lastRouteMsg = to
|
|
2916
|
-
// if (lastRouteMsg.meta.gisInfoSetHideRole && !lastRouteMsg.meta.visible) {
|
|
2917
|
-
// // 找整个模块第一个显示的页面
|
|
2918
|
-
// if (to.path) {
|
|
2919
|
-
// const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
|
|
2920
|
-
// if (firstPath) {
|
|
2921
|
-
// if (to.matched && to.matched.length > 0) {
|
|
2922
|
-
// let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
|
|
2923
|
-
// if (!findRoute) {
|
|
2924
|
-
// findRoute = lastRouteMsg
|
|
2925
|
-
// }
|
|
2926
|
-
// if (findRoute) {
|
|
2927
|
-
// let findRouteMsg
|
|
2928
|
-
// if (findRoute?.children?.length > 0) {
|
|
2929
|
-
// findRouteMsg = recursionRouteFn(findRoute.children)
|
|
2930
|
-
// } else {
|
|
2931
|
-
// findRouteMsg = lastRouteMsg
|
|
2932
|
-
// }
|
|
2933
|
-
// if (findRouteMsg) {
|
|
2934
|
-
// // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
|
|
2935
|
-
// if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
|
|
2936
|
-
// || (to.redirectedFrom && to.redirectedFrom.path === "/")
|
|
2937
|
-
// || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
|
|
2938
|
-
// if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
|
|
2939
|
-
// || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
|
|
2940
|
-
// || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
|
|
2941
|
-
// let hasShowHomePage = undefined
|
|
2942
|
-
// for (let i = 0; i < to.matched[0].children.length; i++) {
|
|
2943
|
-
// if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
|
|
2944
|
-
// hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
|
|
2945
|
-
// if (hasShowHomePage) {
|
|
2946
|
-
// break;
|
|
2947
|
-
// }
|
|
2948
|
-
// }
|
|
2949
|
-
// }
|
|
2950
|
-
// if (hasShowHomePage) {
|
|
2951
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2952
|
-
// next({
|
|
2953
|
-
// path: hasShowHomePage.path,
|
|
2954
|
-
// query: hasShowHomePage?.meta?.query
|
|
2955
|
-
// })
|
|
2956
|
-
// }
|
|
2957
|
-
// }
|
|
2958
|
-
// } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
|
|
2959
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2960
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2961
|
-
// } else if (from.path === findRouteMsg.path) {
|
|
2962
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2963
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2964
|
-
// } else {
|
|
2965
|
-
// if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
|
|
2966
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2967
|
-
// } else {
|
|
2968
|
-
// next({
|
|
2969
|
-
// path: findRouteMsg.path,
|
|
2970
|
-
// query: findRouteMsg?.meta?.query
|
|
2971
|
-
// })
|
|
2972
|
-
// }
|
|
2973
|
-
// }
|
|
2974
|
-
// } else {
|
|
2975
|
-
// next(constType.NO_IN_LAYOUT_MSG.ERROR)
|
|
2976
|
-
// }
|
|
2977
|
-
// }
|
|
2978
|
-
// }
|
|
2979
|
-
// }
|
|
2980
|
-
// }
|
|
2981
|
-
// }
|
|
2982
|
-
// }
|
|
2983
|
-
// -----------------------------
|
|
2984
2895
|
if (to.matched.length > 0) {
|
|
2985
2896
|
var _to$meta, _to$redirectedFrom, _to$meta2, _lastRouteMsg$meta;
|
|
2986
2897
|
var lastRouteMsg = to.matched.at(-1);
|
|
2987
|
-
// const lastRouteMsg = to
|
|
2988
|
-
console.log('lastRouteMsglastRouteMsg', lastRouteMsg);
|
|
2989
2898
|
// 进入主页,主页如果已被隐藏则进去第一个显示的页面
|
|
2990
2899
|
if ((_to$meta = to.meta) !== null && _to$meta !== void 0 && _to$meta.isHomePage && (to === null || to === void 0 || (_to$redirectedFrom = to.redirectedFrom) === null || _to$redirectedFrom === void 0 ? void 0 : _to$redirectedFrom.path) === '/') {
|
|
2991
2900
|
var hasShowHomePage = undefined;
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2901
|
+
var childList = to.matched[0].children;
|
|
2902
|
+
for (var i = 0; i < childList.length; i++) {
|
|
2903
|
+
if (!childList[i].meta.hasOwnProperty('visible') || childList[i].meta.visible) {
|
|
2904
|
+
var _childList$i;
|
|
2905
|
+
if (((_childList$i = childList[i]) === null || _childList$i === void 0 || (_childList$i = _childList$i.children) === null || _childList$i === void 0 ? void 0 : _childList$i.length) > 0) {
|
|
2906
|
+
hasShowHomePage = recursionRouteFn(childList[i].children);
|
|
2907
|
+
if (hasShowHomePage) {
|
|
2908
|
+
break;
|
|
2909
|
+
}
|
|
2910
|
+
} else {
|
|
2911
|
+
hasShowHomePage = childList[i];
|
|
2912
|
+
if (hasShowHomePage) {
|
|
2913
|
+
break;
|
|
2914
|
+
}
|
|
2997
2915
|
}
|
|
2998
2916
|
}
|
|
2999
2917
|
}
|
|
3000
|
-
console.log('hasShowHomePage', hasShowHomePage);
|
|
3001
2918
|
if (hasShowHomePage) {
|
|
3002
2919
|
var _hasShowHomePage;
|
|
3003
2920
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
@@ -3005,83 +2922,17 @@ var GisPermission = /*#__PURE__*/function () {
|
|
|
3005
2922
|
path: hasShowHomePage.path,
|
|
3006
2923
|
query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
|
|
3007
2924
|
});
|
|
2925
|
+
} else {
|
|
2926
|
+
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
2927
|
+
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3008
2928
|
}
|
|
3009
2929
|
} else if ((_to$meta2 = to.meta) !== null && _to$meta2 !== void 0 && _to$meta2.gisInfoSetHideRole && to.meta.hasOwnProperty('visible') && !to.meta.visible) {
|
|
3010
|
-
// if (lastRouteMsg?.meta?.gisInfoSetHideRole && lastRouteMsg?.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
|
|
3011
2930
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
3012
2931
|
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3013
|
-
// }
|
|
3014
2932
|
} else if ((_lastRouteMsg$meta = lastRouteMsg.meta) !== null && _lastRouteMsg$meta !== void 0 && _lastRouteMsg$meta.gisInfoSetHideRole && lastRouteMsg.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
|
|
3015
2933
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
3016
2934
|
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3017
2935
|
}
|
|
3018
|
-
|
|
3019
|
-
// if (lastRouteMsg.meta.gisInfoSetHideRole && !lastRouteMsg.meta.visible) {
|
|
3020
|
-
// // 找整个模块第一个显示的页面
|
|
3021
|
-
// if (to.path) {
|
|
3022
|
-
// const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
|
|
3023
|
-
// if (firstPath) {
|
|
3024
|
-
// if (to.matched && to.matched.length > 0) {
|
|
3025
|
-
// let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
|
|
3026
|
-
// if (!findRoute) {
|
|
3027
|
-
// findRoute = lastRouteMsg
|
|
3028
|
-
// }
|
|
3029
|
-
// if (findRoute) {
|
|
3030
|
-
// let findRouteMsg
|
|
3031
|
-
// if (findRoute?.children?.length > 0) {
|
|
3032
|
-
// findRouteMsg = recursionRouteFn(findRoute.children)
|
|
3033
|
-
// } else {
|
|
3034
|
-
// findRouteMsg = lastRouteMsg
|
|
3035
|
-
// }
|
|
3036
|
-
// if (findRouteMsg) {
|
|
3037
|
-
// // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
|
|
3038
|
-
// if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
|
|
3039
|
-
// || (to.redirectedFrom && to.redirectedFrom.path === "/")
|
|
3040
|
-
// || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
|
|
3041
|
-
// if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
|
|
3042
|
-
// || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
|
|
3043
|
-
// || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
|
|
3044
|
-
// let hasShowHomePage = undefined
|
|
3045
|
-
// for (let i = 0; i < to.matched[0].children.length; i++) {
|
|
3046
|
-
// if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
|
|
3047
|
-
// hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
|
|
3048
|
-
// if (hasShowHomePage) {
|
|
3049
|
-
// break;
|
|
3050
|
-
// }
|
|
3051
|
-
// }
|
|
3052
|
-
// }
|
|
3053
|
-
// if (hasShowHomePage) {
|
|
3054
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3055
|
-
// next({
|
|
3056
|
-
// path: hasShowHomePage.path,
|
|
3057
|
-
// query: hasShowHomePage?.meta?.query
|
|
3058
|
-
// })
|
|
3059
|
-
// }
|
|
3060
|
-
// }
|
|
3061
|
-
// } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
|
|
3062
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3063
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3064
|
-
// } else if (from.path === findRouteMsg.path) {
|
|
3065
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3066
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3067
|
-
// } else {
|
|
3068
|
-
// if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
|
|
3069
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3070
|
-
// } else {
|
|
3071
|
-
// next({
|
|
3072
|
-
// path: findRouteMsg.path,
|
|
3073
|
-
// query: findRouteMsg?.meta?.query
|
|
3074
|
-
// })
|
|
3075
|
-
// }
|
|
3076
|
-
// }
|
|
3077
|
-
// } else {
|
|
3078
|
-
// next(constType.NO_IN_LAYOUT_MSG.ERROR)
|
|
3079
|
-
// }
|
|
3080
|
-
// }
|
|
3081
|
-
// }
|
|
3082
|
-
// }
|
|
3083
|
-
// }
|
|
3084
|
-
// }
|
|
3085
2936
|
}
|
|
3086
2937
|
|
|
3087
2938
|
// ----end----
|