@utogether/udp-core 1.0.1-beta.1 → 1.0.1-beta.11

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.
Files changed (147) hide show
  1. package/build/plugins.ts +39 -32
  2. package/dist/{403-Dp617CWX.js → 403-Dsgsr2M-.js} +1 -1
  3. package/dist/{404-Cz_Axb6Y.js → 404-DmPHEfqM.js} +1 -1
  4. package/dist/{500-BGCtRNse.js → 500-OYEgHR2a.js} +1 -1
  5. package/dist/{AuthorityInfo-DGGfm7IS.js → AuthorityInfo-B1H1txG-.js} +1 -1
  6. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-BUlmQtjQ.js +100 -0
  7. package/dist/{Company-IV3GTnzY.js → Company-C8ojgx93.js} +3 -3
  8. package/dist/{CompanyPanel-qV-_VtoL.js → CompanyPanel-Dageer1t.js} +16 -16
  9. package/dist/{Department-B3W-OxW8.js → Department-Dr94_85I.js} +3 -3
  10. package/dist/{DepartmentPanel-Cw3OWxE7.js → DepartmentPanel-Bc5r1HpT.js} +1 -1
  11. package/dist/{DesignPanel-BFxR2fHJ.js → DesignPanel-CcWt1Myp.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DljbeFba.js → DesignPanel.vue_vue_type_style_index_0_lang-CKA6nx1l.js} +24 -26
  13. package/dist/DictView-BHj6wexC.js +110 -0
  14. package/dist/InvOrganization-DP3Le9g-.js +72 -0
  15. package/dist/Org-BRGHTwsw.js +39 -0
  16. package/dist/{Preview-BlDMmpdR.js → Preview-CqMaUD_3.js} +1 -1
  17. package/dist/{ReportDefine-Cub_85LA.js → ReportDefine-PEQdTCOY.js} +1 -1
  18. package/dist/{ReportDesign-hFhq5UVE.js → ReportDesign-CB4bv8ba.js} +43 -43
  19. package/dist/{ReportQuery-ChkWEyxT.js → ReportQuery-B7t4lMK0.js} +1 -1
  20. package/dist/{ReportQueryFrom-KVyD_8Dj.js → ReportQueryFrom-VBxUIMRJ.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CLNODquq.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-HeLA4Qs5.js} +1 -1
  22. package/dist/{ReportTemplate-ag9NDvh2.js → ReportTemplate-DNkv7F5p.js} +28 -28
  23. package/dist/{Role-_q3lQ8CZ.js → Role-BGfTpZK4.js} +6 -6
  24. package/dist/{RoleAssign-DZb9IRsm.js → RoleAssign-DrKFWZzA.js} +8 -8
  25. package/dist/{RolePanel-CsLsz-Ds.js → RolePanel-3lvRh7aS.js} +1 -1
  26. package/dist/{RolePanel-BQb1LlhD.js → RolePanel-BRI5QYe4.js} +1 -1
  27. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-BXKZb7yt.js +132 -0
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BrnRgHEk.js → RolePanel.vue_vue_type_script_setup_true_lang-Cci_Ysty.js} +44 -38
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CaFKRwXu.js → ScrollPanel.vue_vue_type_style_index_0_lang-BmId6zzA.js} +21 -21
  30. package/dist/{Staff-BSf9Ypbk.js → Staff-Dr0dq3fW.js} +3 -3
  31. package/dist/{StaffInfo-BNKasyMF.js → StaffInfo-_N9g2hPa.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DDZ7ukd0.js → StaffInfo.vue_vue_type_script_setup_true_lang-DiTJY2ug.js} +11 -11
  33. package/dist/{StaffPanel-Bpq0WVlH.js → StaffPanel-mxJQiW3G.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BhiJ0Q-Q.js → StaffPanel.vue_vue_type_script_setup_true_lang-GRGn-5t6.js} +2 -2
  35. package/dist/{SysUser-FAABuNti.js → SysUser-DgA19hZE.js} +2 -2
  36. package/dist/{SysUserPanel-PxJeOgHm.js → SysUserPanel-Bc85z5_K.js} +1 -1
  37. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BHDrP1Pk.js +294 -0
  38. package/dist/{SystemMenu-C-7NAGon.js → SystemMenu-Be-gFIie.js} +26 -26
  39. package/dist/{UserInfo-ClXKtyGo.js → UserInfo-BCYuwFmr.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-8N7P4Hl7.js → UserInfo.vue_vue_type_style_index_0_lang-B1lgokO6.js} +39 -37
  41. package/dist/{childView-C_HmDQNd.js → childView-DhcBr1UA.js} +1 -1
  42. package/dist/{childView-uUlBcTza.js → childView-Dk4zZoXd.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-Ckjmw6wJ.js → childView.vue_vue_type_style_index_0_lang-CVnLnl03.js} +40 -40
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-y0sDvYx5.js → childView.vue_vue_type_style_index_0_lang-D4GYVhOc.js} +1 -1
  45. package/dist/{code-rule-AgCVDKFy.js → code-rule-BSwPwuAL.js} +9 -10
  46. package/dist/core.es.js +14 -11
  47. package/dist/{cron-task-C6FgQxTi.js → cron-task-T1ztyra7.js} +1 -1
  48. package/dist/{frameView-BDgISK7N.js → frameView-BDgngiBq.js} +1 -1
  49. package/dist/img/l_img.svg +1 -1
  50. package/dist/img/minicolors.png +0 -0
  51. package/dist/img/v_img.svg +1 -1
  52. package/dist/index-BSj2AtVL.js +4468 -0
  53. package/dist/{layoutView-yb3DV2DQ.js → layoutView-i7dLLBzJ.js} +1181 -1176
  54. package/dist/{login-RRpljbkm.js → login-K5Ludp8x.js} +105 -113
  55. package/dist/{login-log-CvVnyGi3.js → login-log-kqKzKTto.js} +1 -1
  56. package/dist/{lov-view-C9-rjzZR.js → lov-view-lAexiucu.js} +2 -2
  57. package/dist/{menuInfo-CzPQyFhp.js → menuInfo-BaN5YZPp.js} +1 -1
  58. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BumXunCg.js → menuInfo.vue_vue_type_style_index_0_lang-yI4QOYxG.js} +100 -97
  59. package/dist/{pda-app-Dvy3U-b6.js → pda-app-DEtDXFvM.js} +211 -197
  60. package/dist/{resource-Fy0lFkSV.js → resource-Bztmz7pn.js} +15 -15
  61. package/dist/{su-welcome-DYvSCUST.js → su-welcome-Bx8nBPi9.js} +109 -110
  62. package/dist/sys-config-nvrtYGgi.js +290 -0
  63. package/dist/udp-core.css +2 -2
  64. package/dist/{utogether-CjmJiHoE.js → utogether-yPnwDAIH.js} +1 -1
  65. package/index.ts +40 -36
  66. package/package.json +18 -18
  67. package/src/App.vue +65 -70
  68. package/src/api/index.ts +31 -31
  69. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  70. package/src/components/SuScrollTree/ScrollPanel.vue +3 -3
  71. package/src/components/udp/count-down.vue +536 -0
  72. package/src/components/udp/flip-down/FlipCard/flip-card.vue +251 -0
  73. package/src/components/udp/flip-down/FlipCard/interfaces.ts +4 -0
  74. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +113 -0
  75. package/src/components/udp/form-upload.vue +414 -64
  76. package/src/components/udp/form.vue +112 -0
  77. package/src/components/udp/grid.vue +495 -0
  78. package/src/components/udp/index.ts +10 -4
  79. package/src/components/udp/lov.vue +388 -0
  80. package/src/components/udp/modal-form.vue +13 -3
  81. package/src/components/udp/modal-grid.vue +298 -0
  82. package/src/components/udp/upload.vue +423 -0
  83. package/src/components/udp/utils.ts +447 -40
  84. package/src/directives/permission/index.ts +1 -1
  85. package/src/layout/components/lay-navbar/index.vue +239 -237
  86. package/src/layout/components/lay-panel/index.vue +150 -150
  87. package/src/layout/components/lay-search/index.vue +25 -25
  88. package/src/layout/components/lay-select-org/index.vue +64 -69
  89. package/src/layout/components/lay-sidebar/breadCrumb.vue +1 -1
  90. package/src/layout/components/lay-sidebar/horizontal.vue +190 -191
  91. package/src/layout/components/lay-sidebar/mixNav.vue +260 -258
  92. package/src/layout/components/lay-sidebar/sidebar-logo.vue +92 -98
  93. package/src/layout/components/lay-tag/index.vue +625 -625
  94. package/src/layout/hooks/useNav.ts +173 -173
  95. package/src/layout/layoutView.vue +215 -215
  96. package/src/main.ts +119 -109
  97. package/src/plugins/i18n/en.ts +302 -289
  98. package/src/plugins/i18n/zh.ts +349 -337
  99. package/src/plugins/vxe-table/index.ts +53 -46
  100. package/src/plugins/vxe-table/render.tsx +956 -817
  101. package/src/router/index.ts +177 -183
  102. package/src/router/modules/remaining.ts +58 -83
  103. package/src/store/modules/permission.ts +1 -4
  104. package/src/style/button.scss +85 -78
  105. package/src/style/tailwind.css +1 -68
  106. package/src/style/vxetable.scss +44 -11
  107. package/src/utils/authority/index.ts +1 -1
  108. package/src/utils/{http → udp/http}/index.ts +283 -297
  109. package/src/utils/{http → udp/http}/types.d.ts +8 -5
  110. package/src/utils/udp/useRender.ts +17 -6
  111. package/src/views/login/login-view.vue +300 -314
  112. package/src/views/organization/company/CompanyPanel.vue +259 -259
  113. package/src/views/organization/inv-org/InvOrganization.vue +68 -54
  114. package/src/views/organization/org/Org.vue +9 -5
  115. package/src/views/system/menu/SystemMenu.vue +183 -197
  116. package/src/views/system/menu/menuInfo.vue +363 -371
  117. package/src/views/system/role/AuthorityInfo.vue +19 -15
  118. package/src/views/system/role/Role.vue +1 -5
  119. package/src/views/system/role/RolePanel.vue +11 -2
  120. package/src/views/system/role/UserInfo.vue +195 -193
  121. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  122. package/src/views/system/role-assign/RolePanel.vue +139 -136
  123. package/src/views/system/sys/sys-config.vue +287 -291
  124. package/src/views/system/sysUser/SysUserPanel.vue +278 -278
  125. package/src/views/uapp/pda/pda-app.vue +208 -176
  126. package/src/views/udev/dict/DictView.vue +118 -106
  127. package/src/views/udev/dict/childView.vue +7 -7
  128. package/src/views/udev/lov/lov-view.vue +91 -91
  129. package/src/views/ufile/aggregation/File.vue +5 -5
  130. package/src/views/ufile/file/water-mark.vue +14 -14
  131. package/src/views/uhome/su-welcome.vue +3 -3
  132. package/src/views/ulogin/login.vue +12 -8
  133. package/src/views/upms/user/login-log.vue +1 -1
  134. package/src/views/urpt/design/DesignPanel.vue +507 -526
  135. package/src/views/urpt/design/ReportDesign.vue +15 -19
  136. package/src/views/urpt/static-resource/resource.vue +3 -3
  137. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  138. package/types/global.d.ts +2 -1
  139. package/vite.config.ts +6 -2
  140. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-BqccGW7v.js +0 -102
  141. package/dist/DictView-C-i7e4hZ.js +0 -95
  142. package/dist/InvOrganization-cfT6riGU.js +0 -260
  143. package/dist/Org-CA7vTDIF.js +0 -35
  144. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-cmW7zBLu.js +0 -126
  145. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-njefUln5.js +0 -288
  146. package/dist/index-DzOzUkf6.js +0 -3388
  147. package/dist/sys-config-DJ1vNQTy.js +0 -277
@@ -1,183 +1,177 @@
1
- import { findIndexOf, isEmpty } from 'xe-utils';
2
- import {
3
- type Router,
4
- createRouter,
5
- type RouteRecordRaw,
6
- type RouteComponent,
7
- createWebHistory
8
- } from 'vue-router';
9
- import { cookies, NProgress, openLink, isUrl, buildHierarchyTree } from '@utogether/utils';
10
- import { useMultiTagsStoreHook } from '../store/modules/multiTags';
11
- import { usePermissionStoreHook } from '../store/modules/permission';
12
- import {
13
- ascending,
14
- initRouter,
15
- findRouteByPath,
16
- handleAliveRoute,
17
- formatTwoStageRoutes,
18
- formatFlatteningRoutes
19
- } from './utils';
20
- import { getEnv } from '../config';
21
- import { kLOGINER } from '../contant';
22
-
23
- import homeRouter from './modules/home';
24
- import errorRouter from './modules/error';
25
- import remainingRouter from './modules/remaining';
26
-
27
- const systemRouter = import.meta.glob([
28
- '../views/system/**/*.{vue,tsx}',
29
- '../views/uapp/**/*.{vue,tsx}',
30
- '../views/upms/**/*.{vue,tsx}',
31
- '../views/ufile/**/*.{vue}',
32
- '../views/urpt/**/*.{vue,tsx}',
33
- '../views/organization/**/*.{vue,tsx}',
34
- '../views/udev/**/*.{vue, tsx}'
35
- ]);
36
-
37
- // 原始静态路由(未做任何处理)
38
- const routes = [homeRouter, errorRouter];
39
- /** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
40
- export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
41
- formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
42
- );
43
-
44
- /** 用于渲染菜单,保持原始层级 */
45
- export const constantMenus: Array<RouteComponent> = ascending(routes).concat(...remainingRouter);
46
-
47
- /** 不参与菜单的路由 */
48
- export const remainingPaths = Object.keys(remainingRouter).map(v => {
49
- return remainingRouter[v].path;
50
- });
51
-
52
- /** 创建路由实例 */
53
- export const router: Router = createRouter({
54
- history: createWebHistory(getEnv().VITE_ROUTER_HISTORY),
55
- routes: constantRoutes.concat(...(remainingRouter as any)),
56
- strict: true,
57
- scrollBehavior(to, from, savedPosition) {
58
- return new Promise(resolve => {
59
- if (savedPosition) {
60
- return savedPosition;
61
- } else {
62
- if (from.meta.saveSrollTop) {
63
- const top: number = document.documentElement.scrollTop || document.body.scrollTop;
64
- resolve({ left: 0, top });
65
- }
66
- }
67
- });
68
- }
69
- });
70
-
71
- /** 重置路由 */
72
- export function resetRouter() {
73
- router.getRoutes().forEach(route => {
74
- const { name, meta } = route;
75
- if (name && router.hasRoute(name) && meta?.backstage) {
76
- router.removeRoute(name);
77
- router.options.routes = formatTwoStageRoutes(
78
- formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
79
- );
80
- }
81
- });
82
- usePermissionStoreHook().clearAllCachePage();
83
- }
84
-
85
- let views = null;
86
- export function setViews(cviews) {
87
- views = cviews;
88
- Object.assign(views, systemRouter);
89
- }
90
-
91
- export function getViews() {
92
- return views;
93
- }
94
-
95
- /** 路由白名单 */
96
- const whiteList = ['/login'];
97
-
98
- router.beforeEach((to: ToRouteType, _from, next) => {
99
- if (to.meta?.keepAlive) {
100
- handleAliveRoute(to, 'add');
101
- // 页面整体刷新和点击标签页刷新
102
- if (_from.name === undefined || _from.name === 'redirect') {
103
- handleAliveRoute(to);
104
- }
105
- }
106
- const userName = cookies.get(kLOGINER);
107
- NProgress.start();
108
- const externalLink = isUrl(to?.name as string);
109
- /** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
110
- function toCorrectRoute() {
111
- whiteList.includes(to.fullPath) ? next(_from.fullPath) : next();
112
- }
113
- if (userName) {
114
- // TODO 无权限跳转403页面
115
- // if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
116
- // next({ path: "/error/403" });
117
- // }
118
- if (_from?.name && _from?.name !== 'login') {
119
- // m.name === to.name 判断param路由跳转
120
- const cmp = to.matched.find(
121
- m => m.path === to.path || (m.name === to.name && to.params)
122
- )?.components;
123
- // 如果路由包含http 则是超链接 反之是普通路由
124
- if (externalLink) {
125
- openLink(to?.name as string);
126
- NProgress?.done();
127
- } else if (cmp?.default || to.name === 'redirect') {
128
- toCorrectRoute();
129
- } else {
130
- next({ path: '/error/404' });
131
- }
132
- } else {
133
- // 刷新
134
- if (usePermissionStoreHook().wholeMenus.length === 0) {
135
- initRouter(userName).then((router: Router) => {
136
- if (!useMultiTagsStoreHook().getMultiTagsCache) {
137
- const { path } = to;
138
- const index = findIndexOf(remainingRouter, v => v.path === path);
139
- const routes: any = index === -1 ? router.options.routes[0].children : router.options.routes;
140
- const route = findRouteByPath(path, routes);
141
- if (route && route.meta?.title) {
142
- const { path, name, meta } = route;
143
- useMultiTagsStoreHook().handleTags('push', { path, name, meta });
144
- }
145
- }
146
- // 确保动态路由完全加入路由列表并且不影响静态路由
147
- // (注意:动态路由刷新时router.beforeEach可能会触发两次,
148
- // 第一次触发动态路由还未完全添加,第二次动态路由才完全添加到路由列表,
149
- // 如果需要在router.beforeEach做一些判断可以在to.name存在的条件下去判断,这样就只会触发一次)
150
- if (isEmpty(to.name)) router.push(to.fullPath);
151
- });
152
- }
153
- if (_from.fullPath === '/' && to.fullPath === '/login' && !to.query?.tokenExpire) {
154
- to.path = '/welcome';
155
- to.fullPath = '/welcome';
156
- to.name = 'SuHome';
157
- } else if (_from.fullPath === '/' && to.path === '/workflow/approve/index') {
158
- to.path = '/welcome';
159
- to.fullPath = '/welcome';
160
- to.name = 'SuHome';
161
- to.query = {};
162
- }
163
- // next();
164
- toCorrectRoute();
165
- }
166
- } else {
167
- if (to.path !== '/login') {
168
- if (whiteList.indexOf(to.path) !== -1) {
169
- next();
170
- } else {
171
- next({ path: '/login' });
172
- }
173
- } else {
174
- next();
175
- }
176
- }
177
- });
178
-
179
- router.afterEach(() => {
180
- NProgress?.done();
181
- });
182
-
183
- export default router;
1
+ import { findIndexOf, isEmpty } from 'xe-utils';
2
+ import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router';
3
+ import { cookies, NProgress, openLink, isUrl, buildHierarchyTree } from '@utogether/utils';
4
+ import { useMultiTagsStoreHook } from '../store/modules/multiTags';
5
+ import { usePermissionStoreHook } from '../store/modules/permission';
6
+ import { ascending, initRouter, findRouteByPath, formatTwoStageRoutes, formatFlatteningRoutes } from './utils';
7
+ // import { getEnv } from '../config';
8
+ import { kLOGINER } from '../contant';
9
+
10
+ import homeRouter from './modules/home';
11
+ import errorRouter from './modules/error';
12
+ import remainingRouter from './modules/remaining';
13
+
14
+ const systemRouter = import.meta.glob([
15
+ '../views/system/**/*.{vue,tsx}',
16
+ '../views/uapp/**/*.{vue,tsx}',
17
+ '../views/upms/**/*.{vue,tsx}',
18
+ '../views/ufile/**/*.{vue}',
19
+ '../views/urpt/**/*.{vue,tsx}',
20
+ '../views/organization/**/*.{vue,tsx}',
21
+ '../views/udev/**/*.{vue, tsx}'
22
+ ]);
23
+
24
+ export const remainingRouters = remainingRouter;
25
+
26
+ // 原始静态路由(未做任何处理)
27
+ const routes = [homeRouter, errorRouter];
28
+ /** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
29
+ export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
30
+ formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
31
+ );
32
+
33
+ /** 用于渲染菜单,保持原始层级 */
34
+ export const constantMenus: Array<RouteComponent> = ascending(routes).concat(...remainingRouter);
35
+
36
+ /** 不参与菜单的路由 */
37
+ export const remainingPaths = Object.keys(remainingRouter).map(v => {
38
+ return remainingRouter[v].path;
39
+ });
40
+
41
+ /** 创建路由实例 */
42
+ // export const router: Router = createRouter({
43
+ // history: createWebHistory(window.__HISTORY_PATH__),
44
+ // routes: constantRoutes.concat(...(remainingRouter as any)),
45
+ // strict: true,
46
+ // scrollBehavior(to, from, savedPosition) {
47
+ // return new Promise(resolve => {
48
+ // if (savedPosition) {
49
+ // return savedPosition;
50
+ // } else {
51
+ // if (from.meta.saveSrollTop) {
52
+ // const top: number = document.documentElement.scrollTop || document.body.scrollTop;
53
+ // resolve({ left: 0, top });
54
+ // }
55
+ // }
56
+ // });
57
+ // }
58
+ // });
59
+
60
+ /** 重置路由 */
61
+ export function resetRouter() {
62
+ router.getRoutes().forEach(route => {
63
+ const { name, meta } = route;
64
+ if (name && router.hasRoute(name) && meta?.backstage) {
65
+ router.removeRoute(name);
66
+ router.options.routes = formatTwoStageRoutes(formatFlatteningRoutes(buildHierarchyTree(ascending(routes))));
67
+ }
68
+ });
69
+ usePermissionStoreHook().clearAllCachePage();
70
+ }
71
+
72
+ let views = null;
73
+ export let router = null;
74
+ export function setViews(cviews, crouter) {
75
+ views = cviews;
76
+ router = crouter;
77
+ Object.assign(views, systemRouter);
78
+ }
79
+
80
+ export function getViews() {
81
+ return views;
82
+ }
83
+
84
+ /** 路由白名单 */
85
+ const whiteList = ['/login'];
86
+ /*
87
+ router.beforeEach((to: ToRouteType, _from, next) => {
88
+ if (to.meta?.keepAlive) {
89
+ handleAliveRoute(to, 'add');
90
+ // 页面整体刷新和点击标签页刷新
91
+ if (_from.name === undefined || _from.name === 'redirect') {
92
+ handleAliveRoute(to);
93
+ }
94
+ }
95
+ const userName = cookies.get(kLOGINER);
96
+ NProgress.start();
97
+ if (userName) {
98
+ routerBefore(to, _from, next);
99
+ } else {
100
+ if (to.path !== '/login') {
101
+ if (whiteList.indexOf(to.path) !== -1) {
102
+ next();
103
+ } else {
104
+ next({ path: '/login' });
105
+ }
106
+ } else {
107
+ next();
108
+ }
109
+ }
110
+ });
111
+
112
+ router.afterEach(() => {
113
+ NProgress?.done();
114
+ });
115
+
116
+ */
117
+ export const routerBefore = (to, _from, next) => {
118
+ // TODO 无权限跳转403页面
119
+ // if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
120
+ // next({ path: "/error/403" });
121
+ // }
122
+ const userName = cookies.get(kLOGINER);
123
+
124
+ const externalLink = isUrl(to?.name as string);
125
+ /** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
126
+ function toCorrectRoute() {
127
+ whiteList.includes(to.fullPath) ? next(_from.fullPath) : next();
128
+ }
129
+ if (_from?.name && _from?.name !== 'login') {
130
+ // m.name === to.name 判断param路由跳转
131
+ const cmp = to.matched.find(m => m.path === to.path || (m.name === to.name && to.params))?.components;
132
+ // 如果路由包含http 则是超链接 反之是普通路由
133
+ if (externalLink) {
134
+ openLink(to?.name as string);
135
+ NProgress?.done();
136
+ } else if (cmp?.default || to.name === 'redirect') {
137
+ toCorrectRoute();
138
+ } else {
139
+ next({ path: '/error/404' });
140
+ }
141
+ } else {
142
+ // 刷新
143
+ if (usePermissionStoreHook().wholeMenus.length === 0) {
144
+ initRouter(userName).then((router: Router) => {
145
+ if (!useMultiTagsStoreHook().getMultiTagsCache) {
146
+ const { path } = to;
147
+ const index = findIndexOf(remainingRouter, v => v.path === path);
148
+ const routes: any = index === -1 ? router.options.routes[0].children : router.options.routes;
149
+ const route = findRouteByPath(path, routes);
150
+ if (route && route.meta?.title) {
151
+ const { path, name, meta } = route;
152
+ useMultiTagsStoreHook().handleTags('push', { path, name, meta });
153
+ }
154
+ }
155
+ // 确保动态路由完全加入路由列表并且不影响静态路由
156
+ // (注意:动态路由刷新时router.beforeEach可能会触发两次,
157
+ // 第一次触发动态路由还未完全添加,第二次动态路由才完全添加到路由列表,
158
+ // 如果需要在router.beforeEach做一些判断可以在to.name存在的条件下去判断,这样就只会触发一次)
159
+ if (isEmpty(to.name)) router.push(to.fullPath);
160
+ });
161
+ }
162
+ if (_from.fullPath === '/' && to.fullPath === '/login' && !to.query?.tokenExpire) {
163
+ to.path = '/welcome';
164
+ to.fullPath = '/welcome';
165
+ to.name = 'SuHome';
166
+ } else if (_from.fullPath === '/' && to.path === '/workflow/approve/index') {
167
+ to.path = '/welcome';
168
+ to.fullPath = '/welcome';
169
+ to.name = 'SuHome';
170
+ to.query = {};
171
+ }
172
+ // next();
173
+ toCorrectRoute();
174
+ }
175
+ };
176
+
177
+ // export default router;
@@ -1,83 +1,58 @@
1
- /*
2
- * @Author: wei.li
3
- * @Date: 2021-11-17 16:02:30
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2024-12-18 08:44:24
6
- * @Description: file content
7
- */
8
- const Layout = () => import('../../layout/layoutView.vue');
9
-
10
- const remainingRouter: Array<any> = [
11
- {
12
- path: '/login',
13
- name: 'login',
14
- component: () => import('../../views/ulogin/login.vue'),
15
- meta: {
16
- title: 'message.udp.login',
17
- showLink: false
18
- }
19
- },
20
- {
21
- path: '/error/404',
22
- name: '404',
23
- component: () => import('../../views/error/404.vue'),
24
- meta: {
25
- title: 'message.udp.fourZeroFour',
26
- showLink: false
27
- }
28
- },
29
- {
30
- path: '/error/500',
31
- name: '500',
32
- component: () => import('../../views/error/500.vue'),
33
- meta: {
34
- title: 'message.udp.five',
35
- showLink: false
36
- }
37
- },
38
- // {
39
- // path: '/print/checkcard',
40
- // name: 'checkcard',
41
- // component: () => import('../../views/print/check-card.vue'),
42
- // meta: {
43
- // title: 'message.checkCard',
44
- // showLink: false
45
- // }
46
- // },
47
- // {
48
- // path: '/lowcode-design-platform',
49
- // name: 'LowcodeDesigin',
50
- // component: () => import('/src/views/udev/gantt/lcd-design.vue'),
51
- // meta: {
52
- // showLink: false
53
- // }
54
- // },
55
- // {
56
- // path: '/ulcd-app-menu',
57
- // name: 'AppMenu',
58
- // component: () => import('/src/views/udev/gantt/app-menu.vue'),
59
- // meta: {
60
- // showLink: false
61
- // }
62
- // },
63
- {
64
- path: '/redirect',
65
- name: 'redirect',
66
- component: Layout,
67
- meta: {
68
- icon: 'home-filled',
69
- title: 'message.udp.home',
70
- showLink: false,
71
- rank: 104
72
- },
73
- children: [
74
- {
75
- path: '/redirect/:path(.*)',
76
- // 2024-12-17
77
- name: 'redirectView',
78
- component: () => import('../../layout/redirect.vue')
79
- }
80
- ]
81
- }
82
- ];
83
- export default remainingRouter;
1
+ /*
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-17 16:02:30
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-27 11:10:39
6
+ * @Description: file content
7
+ */
8
+ const Layout = () => import('../../layout/layoutView.vue');
9
+
10
+ const remainingRouter: Array<any> = [
11
+ {
12
+ path: '/login',
13
+ name: 'login',
14
+ component: () => import('../../views/ulogin/login.vue'),
15
+ meta: {
16
+ title: 'message.udp.login',
17
+ showLink: false
18
+ }
19
+ },
20
+ {
21
+ path: '/error/404',
22
+ name: '404',
23
+ component: () => import('../../views/error/404.vue'),
24
+ meta: {
25
+ title: 'message.udp.fourZeroFour',
26
+ showLink: false
27
+ }
28
+ },
29
+ {
30
+ path: '/error/500',
31
+ name: '500',
32
+ component: () => import('../../views/error/500.vue'),
33
+ meta: {
34
+ title: 'message.udp.five',
35
+ showLink: false
36
+ }
37
+ },
38
+ {
39
+ path: '/redirect',
40
+ name: 'redirect',
41
+ component: Layout,
42
+ meta: {
43
+ icon: 'home-filled',
44
+ title: 'message.udp.home',
45
+ showLink: false,
46
+ rank: 104
47
+ },
48
+ children: [
49
+ {
50
+ path: '/redirect/:path(.*)',
51
+ // 2024-12-17
52
+ name: 'redirectView',
53
+ component: () => import('../../layout/redirect.vue')
54
+ }
55
+ ]
56
+ }
57
+ ];
58
+ export default remainingRouter;
@@ -80,10 +80,7 @@ export const usePermissionStore = defineStore('udp-permission', {
80
80
  const nameList = getKeyList(useMultiTagsStoreHook().multiTags, 'name');
81
81
  while (cacheLength > 0) {
82
82
  nameList.findIndex(v => v === this.cachePageList[cacheLength - 1]) === -1 &&
83
- this.cachePageList.splice(
84
- this.cachePageList.indexOf(this.cachePageList[cacheLength - 1]),
85
- 1
86
- );
83
+ this.cachePageList.splice(this.cachePageList.indexOf(this.cachePageList[cacheLength - 1]), 1);
87
84
  cacheLength--;
88
85
  }
89
86
  }, 500)();