gw-gis-standard-global-vue3 1.1.82 → 1.1.84
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 +38 -188
- 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,55 +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.gisInfoSetShowRole = true
|
|
1427
|
+
if (roleList.includes(routerList[i].meta[menuFilterKey])) {
|
|
1425
1428
|
routerList[i].meta.visible = true;
|
|
1426
1429
|
} else {
|
|
1427
|
-
// console.log('menuFilterKeycode', routerList[i].meta[menuFilterKey])
|
|
1428
1430
|
routerList[i].meta.gisInfoSetHideRole = true;
|
|
1429
1431
|
routerList[i].meta.visible = false;
|
|
1430
1432
|
}
|
|
1431
|
-
|
|
1432
|
-
// 是为了记录角色隐藏了哪些菜单
|
|
1433
|
-
// if (routerList[i].meta.hasOwnProperty('visible')) {
|
|
1434
|
-
// if (routerList[i].meta.visible) {
|
|
1435
|
-
// routerList[i].meta.gisInfoSetHideRole = true
|
|
1436
|
-
// routerList[i].meta.visible = false
|
|
1437
|
-
// } else {
|
|
1438
|
-
// routerList[i].meta.gisInfoSetHideRole = false
|
|
1439
|
-
// }
|
|
1440
|
-
// } else {
|
|
1441
|
-
// routerList[i].meta.visible = false
|
|
1442
|
-
// routerList[i].meta.gisInfoSetHideRole = true
|
|
1443
|
-
// }
|
|
1444
1433
|
}
|
|
1445
1434
|
} else {
|
|
1446
1435
|
// 为空则全部隐藏
|
|
1447
1436
|
if (!routerList[i].meta.notInLayout) {
|
|
1448
1437
|
routerList[i].meta.gisInfoSetHideRole = true;
|
|
1449
1438
|
routerList[i].meta.visible = false;
|
|
1450
|
-
// if (routerList[i].meta.hasOwnProperty('visible')) {
|
|
1451
|
-
// // 是为了记录角色隐藏了哪些菜单
|
|
1452
|
-
// if (!routerList[i].meta.visible) {
|
|
1453
|
-
// routerList[i].meta.gisInfoSetHideRole = false
|
|
1454
|
-
// }
|
|
1455
|
-
// routerList[i].meta.visible = false
|
|
1456
|
-
// } else {
|
|
1457
|
-
// routerList[i].meta.visible = false
|
|
1458
|
-
// }
|
|
1459
1439
|
// 清空文件
|
|
1460
1440
|
}
|
|
1461
1441
|
}
|
|
1462
1442
|
}
|
|
1463
1443
|
if (routerList[i].children && routerList[i].children.length > 0) {
|
|
1464
|
-
filterRolesRouterFn2(routerList[i].children,
|
|
1444
|
+
filterRolesRouterFn2(routerList[i].children, roleList, menuFilterKey);
|
|
1465
1445
|
}
|
|
1466
1446
|
}
|
|
1467
1447
|
}
|
|
@@ -2800,16 +2780,16 @@ var GisPermission = /*#__PURE__*/function () {
|
|
|
2800
2780
|
// const {getRouteTagsListFn, isHideNeedCache, removeIncludeListFn, routeTagsList} = gisRouteTags()
|
|
2801
2781
|
// window.gisRouteTags = gisRouteTags()
|
|
2802
2782
|
this.router.beforeEach(function (to, from, next) {
|
|
2783
|
+
var _window$top;
|
|
2803
2784
|
// 当前路由和跳转一样时则不跳转
|
|
2804
2785
|
// if (this.router?.currentRoute && to.path === this.router?.currentRoute?.value?.path) {
|
|
2805
2786
|
// return
|
|
2806
2787
|
// }
|
|
2807
|
-
// console.log('【to-router-from】', from)
|
|
2808
2788
|
// 仅供测试
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2789
|
+
if ((_window$top = window.top) !== null && _window$top !== void 0 && _window$top._showRouteTo) {
|
|
2790
|
+
console.log('【router-from】', from);
|
|
2791
|
+
console.log('【router-to】', to);
|
|
2792
|
+
}
|
|
2813
2793
|
// 缓存当前临时路由 - 会初次加载路由接口无需缓存
|
|
2814
2794
|
// cacheCurrentTempRouteFn(to)
|
|
2815
2795
|
// 这是判断路由变化后是否需要缓存
|
|
@@ -2909,96 +2889,32 @@ var GisPermission = /*#__PURE__*/function () {
|
|
|
2909
2889
|
// }
|
|
2910
2890
|
// }
|
|
2911
2891
|
// }
|
|
2912
|
-
|
|
2892
|
+
// -----------------------------
|
|
2913
2893
|
// 判断如果导航栏重定向的子菜单是,根据权限而隐藏的 ,则将菜单在该菜单数组中找到能显示的第一个页面 并跳转(找不到,不跳转),
|
|
2914
2894
|
// 注意:权限不足,直接跳转403
|
|
2915
|
-
// if (to.matched.length > 0) {
|
|
2916
|
-
// // const lastRouteMsg = to.matched.at(-1)
|
|
2917
|
-
// const lastRouteMsg = to
|
|
2918
|
-
// if (lastRouteMsg.meta.gisInfoSetHideRole && !lastRouteMsg.meta.visible) {
|
|
2919
|
-
// // 找整个模块第一个显示的页面
|
|
2920
|
-
// if (to.path) {
|
|
2921
|
-
// const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
|
|
2922
|
-
// if (firstPath) {
|
|
2923
|
-
// if (to.matched && to.matched.length > 0) {
|
|
2924
|
-
// let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
|
|
2925
|
-
// if (!findRoute) {
|
|
2926
|
-
// findRoute = lastRouteMsg
|
|
2927
|
-
// }
|
|
2928
|
-
// if (findRoute) {
|
|
2929
|
-
// let findRouteMsg
|
|
2930
|
-
// if (findRoute?.children?.length > 0) {
|
|
2931
|
-
// findRouteMsg = recursionRouteFn(findRoute.children)
|
|
2932
|
-
// } else {
|
|
2933
|
-
// findRouteMsg = lastRouteMsg
|
|
2934
|
-
// }
|
|
2935
|
-
// if (findRouteMsg) {
|
|
2936
|
-
// // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
|
|
2937
|
-
// if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
|
|
2938
|
-
// || (to.redirectedFrom && to.redirectedFrom.path === "/")
|
|
2939
|
-
// || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
|
|
2940
|
-
// if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
|
|
2941
|
-
// || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
|
|
2942
|
-
// || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
|
|
2943
|
-
// let hasShowHomePage = undefined
|
|
2944
|
-
// for (let i = 0; i < to.matched[0].children.length; i++) {
|
|
2945
|
-
// if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
|
|
2946
|
-
// hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
|
|
2947
|
-
// if (hasShowHomePage) {
|
|
2948
|
-
// break;
|
|
2949
|
-
// }
|
|
2950
|
-
// }
|
|
2951
|
-
// }
|
|
2952
|
-
// if (hasShowHomePage) {
|
|
2953
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2954
|
-
// next({
|
|
2955
|
-
// path: hasShowHomePage.path,
|
|
2956
|
-
// query: hasShowHomePage?.meta?.query
|
|
2957
|
-
// })
|
|
2958
|
-
// }
|
|
2959
|
-
// }
|
|
2960
|
-
// } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
|
|
2961
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2962
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2963
|
-
// } else if (from.path === findRouteMsg.path) {
|
|
2964
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
2965
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2966
|
-
// } else {
|
|
2967
|
-
// if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
|
|
2968
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
2969
|
-
// } else {
|
|
2970
|
-
// next({
|
|
2971
|
-
// path: findRouteMsg.path,
|
|
2972
|
-
// query: findRouteMsg?.meta?.query
|
|
2973
|
-
// })
|
|
2974
|
-
// }
|
|
2975
|
-
// }
|
|
2976
|
-
// } else {
|
|
2977
|
-
// next(constType.NO_IN_LAYOUT_MSG.ERROR)
|
|
2978
|
-
// }
|
|
2979
|
-
// }
|
|
2980
|
-
// }
|
|
2981
|
-
// }
|
|
2982
|
-
// }
|
|
2983
|
-
// }
|
|
2984
|
-
// }
|
|
2985
|
-
// -----------------------------
|
|
2986
2895
|
if (to.matched.length > 0) {
|
|
2987
2896
|
var _to$meta, _to$redirectedFrom, _to$meta2, _lastRouteMsg$meta;
|
|
2988
2897
|
var lastRouteMsg = to.matched.at(-1);
|
|
2989
|
-
console.log('lastRouteMsglastRouteMsg', lastRouteMsg);
|
|
2990
2898
|
// 进入主页,主页如果已被隐藏则进去第一个显示的页面
|
|
2991
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) === '/') {
|
|
2992
2900
|
var hasShowHomePage = undefined;
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
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
|
+
}
|
|
2998
2915
|
}
|
|
2999
2916
|
}
|
|
3000
2917
|
}
|
|
3001
|
-
console.log('hasShowHomePage', hasShowHomePage);
|
|
3002
2918
|
if (hasShowHomePage) {
|
|
3003
2919
|
var _hasShowHomePage;
|
|
3004
2920
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
@@ -3006,94 +2922,28 @@ var GisPermission = /*#__PURE__*/function () {
|
|
|
3006
2922
|
path: hasShowHomePage.path,
|
|
3007
2923
|
query: (_hasShowHomePage = hasShowHomePage) === null || _hasShowHomePage === void 0 || (_hasShowHomePage = _hasShowHomePage.meta) === null || _hasShowHomePage === void 0 ? void 0 : _hasShowHomePage.query
|
|
3008
2924
|
});
|
|
2925
|
+
} else {
|
|
2926
|
+
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
2927
|
+
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3009
2928
|
}
|
|
3010
2929
|
} else if ((_to$meta2 = to.meta) !== null && _to$meta2 !== void 0 && _to$meta2.gisInfoSetHideRole && to.meta.hasOwnProperty('visible') && !to.meta.visible) {
|
|
3011
|
-
// if (lastRouteMsg?.meta?.gisInfoSetHideRole && lastRouteMsg?.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
|
|
3012
2930
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
3013
2931
|
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3014
|
-
// }
|
|
3015
2932
|
} else if ((_lastRouteMsg$meta = lastRouteMsg.meta) !== null && _lastRouteMsg$meta !== void 0 && _lastRouteMsg$meta.gisInfoSetHideRole && lastRouteMsg.meta.hasOwnProperty('visible') && !lastRouteMsg.meta.visible) {
|
|
3016
2933
|
getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU);
|
|
3017
2934
|
next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN);
|
|
3018
2935
|
}
|
|
3019
|
-
|
|
3020
|
-
// if (lastRouteMsg.meta.gisInfoSetHideRole && !lastRouteMsg.meta.visible) {
|
|
3021
|
-
// // 找整个模块第一个显示的页面
|
|
3022
|
-
// if (to.path) {
|
|
3023
|
-
// const firstPath = (to.path.split('/').length > 0 && to.path.split('/')[1]) || undefined
|
|
3024
|
-
// if (firstPath) {
|
|
3025
|
-
// if (to.matched && to.matched.length > 0) {
|
|
3026
|
-
// let findRoute = to.matched.find(item => item.path === ('/' + firstPath))
|
|
3027
|
-
// if (!findRoute) {
|
|
3028
|
-
// findRoute = lastRouteMsg
|
|
3029
|
-
// }
|
|
3030
|
-
// if (findRoute) {
|
|
3031
|
-
// let findRouteMsg
|
|
3032
|
-
// if (findRoute?.children?.length > 0) {
|
|
3033
|
-
// findRouteMsg = recursionRouteFn(findRoute.children)
|
|
3034
|
-
// } else {
|
|
3035
|
-
// findRouteMsg = lastRouteMsg
|
|
3036
|
-
// }
|
|
3037
|
-
// if (findRouteMsg) {
|
|
3038
|
-
// // 进入首页 如果配置的首页该用户无法访问,则跳转到第一个显示的页面
|
|
3039
|
-
// if ((findRouteMsg?.meta?.isHomePage && (findRouteMsg.meta.visible || !findRouteMsg.meta.hasOwnProperty('visible')))
|
|
3040
|
-
// || (to.redirectedFrom && to.redirectedFrom.path === "/")
|
|
3041
|
-
// || (to.redirectedFrom && to.redirectedFrom.fullPath === "/") || to.path === "/") {
|
|
3042
|
-
// if ((to?.meta?.hasOwnProperty('visible') && !to?.meta?.visible)
|
|
3043
|
-
// || (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible)
|
|
3044
|
-
// || (lastRouteMsg?.meta?.hasOwnProperty('visible') && !lastRouteMsg?.meta?.visible)) {
|
|
3045
|
-
// let hasShowHomePage = undefined
|
|
3046
|
-
// for (let i = 0; i < to.matched[0].children.length; i++) {
|
|
3047
|
-
// if (!to.matched[0].children[i].meta.hasOwnProperty('visible') || to.matched[0].children[i].meta.visible) {
|
|
3048
|
-
// hasShowHomePage = recursionRouteFn(to.matched[0].children[i].children)
|
|
3049
|
-
// if (hasShowHomePage) {
|
|
3050
|
-
// break;
|
|
3051
|
-
// }
|
|
3052
|
-
// }
|
|
3053
|
-
// }
|
|
3054
|
-
// if (hasShowHomePage) {
|
|
3055
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3056
|
-
// next({
|
|
3057
|
-
// path: hasShowHomePage.path,
|
|
3058
|
-
// query: hasShowHomePage?.meta?.query
|
|
3059
|
-
// })
|
|
3060
|
-
// }
|
|
3061
|
-
// }
|
|
3062
|
-
// } else if (findRouteMsg?.meta?.hasOwnProperty('visible') && !findRouteMsg?.meta?.visible) {
|
|
3063
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3064
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3065
|
-
// } else if (from.path === findRouteMsg.path) {
|
|
3066
|
-
// getCache(constType.SESSION_STORAGE).remove(constType.TOP_MENU)
|
|
3067
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3068
|
-
// } else {
|
|
3069
|
-
// if (to.meta?.hasOwnProperty('visible') && !to.meta.visible) {
|
|
3070
|
-
// next(constType.NO_IN_LAYOUT_MSG.FORBIDDEN)
|
|
3071
|
-
// } else {
|
|
3072
|
-
// next({
|
|
3073
|
-
// path: findRouteMsg.path,
|
|
3074
|
-
// query: findRouteMsg?.meta?.query
|
|
3075
|
-
// })
|
|
3076
|
-
// }
|
|
3077
|
-
// }
|
|
3078
|
-
// } else {
|
|
3079
|
-
// next(constType.NO_IN_LAYOUT_MSG.ERROR)
|
|
3080
|
-
// }
|
|
3081
|
-
// }
|
|
3082
|
-
// }
|
|
3083
|
-
// }
|
|
3084
|
-
// }
|
|
3085
|
-
// }
|
|
3086
2936
|
}
|
|
3087
2937
|
|
|
3088
2938
|
// ----end----
|
|
3089
2939
|
// 判断在子应用中是否有父级token,非动态菜单才有作用,动态菜单则失效
|
|
3090
2940
|
// console.log('路由-child')
|
|
3091
2941
|
if (window.self !== window.top) {
|
|
3092
|
-
var _window$
|
|
3093
|
-
if ((_window$
|
|
3094
|
-
var _window$
|
|
2942
|
+
var _window$top2, _window$top3;
|
|
2943
|
+
if ((_window$top2 = window.top) !== null && _window$top2 !== void 0 && _window$top2.__MICRO_APP_BASE_APPLICATION__ && ((_window$top3 = window.top) === null || _window$top3 === void 0 || (_window$top3 = _window$top3.gisConfig) === null || _window$top3 === void 0 ? void 0 : _window$top3.VITE_APP_IS_MAIN_MICRO_APP) === 'true') {
|
|
2944
|
+
var _window$top4;
|
|
3095
2945
|
// 主应用是否有token
|
|
3096
|
-
if ((_window$
|
|
2946
|
+
if ((_window$top4 = window.top) !== null && _window$top4 !== void 0 && (_window$top4 = _window$top4.gisConfig) !== null && _window$top4 !== void 0 && _window$top4.VITE_APP_SET_GIS_TOKEN) {
|
|
3097
2947
|
var hasTopToken = getCache(constType.COOKIE).get(window.top.gisConfig.VITE_APP_SET_GIS_TOKEN);
|
|
3098
2948
|
if (hasTopToken) {
|
|
3099
2949
|
getCache(constType.COOKIE).set(window.gisConfig.VITE_APP_SET_GIS_TOKEN, hasTopToken);
|
|
@@ -3270,9 +3120,9 @@ function visibleIsCacheFn(to) {
|
|
|
3270
3120
|
|
|
3271
3121
|
// 进度条控制
|
|
3272
3122
|
var nProgressFn = function nProgressFn(NProgressConfigure) {
|
|
3273
|
-
var _window$
|
|
3123
|
+
var _window$top5;
|
|
3274
3124
|
// 嵌入的子应用不需要进度条
|
|
3275
|
-
if (!((_window$
|
|
3125
|
+
if (!((_window$top5 = window.top) !== null && _window$top5 !== void 0 && _window$top5.__MICRO_APP_BASE_APPLICATION__) || window.gisConfig.VITE_APP_IS_MAIN_MICRO_APP === 'true') {
|
|
3276
3126
|
// 这是进度条的一些配置项
|
|
3277
3127
|
NProgress.configure(NProgressConfigure);
|
|
3278
3128
|
NProgress.start();
|