@utogether/udp-core 1.0.1-beta.12 → 1.0.1-beta.14
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/dist/{403-D7L5zm05.js → 403-pRpb9luy.js} +1 -1
- package/dist/{404-BQKzkK5W.js → 404-Bsowhpja.js} +1 -1
- package/dist/{500-BM6k8XR5.js → 500-DZuJN9lQ.js} +1 -1
- package/dist/{AuthorityInfo-Dc-7W4L_.js → AuthorityInfo-DsSMdxQ1.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-CKvlh3lm.js → AuthorityInfo.vue_vue_type_style_index_0_lang-DCRZ7hKU.js} +1 -1
- package/dist/{Company-BgwMUr-I.js → Company-JFHxazkc.js} +3 -3
- package/dist/{CompanyPanel-CDfVCPKC.js → CompanyPanel-Bt-5OX8x.js} +1 -1
- package/dist/{Department-CFvEB4Ys.js → Department-B1bTl93X.js} +3 -3
- package/dist/{DepartmentPanel-11Ytcj2u.js → DepartmentPanel-CVIvI8sf.js} +1 -1
- package/dist/{DesignPanel-CP8z6teZ.js → DesignPanel-snVLq3Gi.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-Cp-WR8yE.js → DesignPanel.vue_vue_type_style_index_0_lang-Cvb54DDl.js} +2 -2
- package/dist/{DictView-13NoDgPW.js → DictView-OoNA8vMb.js} +1 -1
- package/dist/{InvOrganization-DOD4QdEX.js → InvOrganization-CINznAuo.js} +4 -2
- package/dist/{Org-cezJs-6P.js → Org-BA3ZHIpa.js} +1 -1
- package/dist/{Preview-DzOKwnp8.js → Preview-C9rFs95x.js} +1 -1
- package/dist/{ReportDefine-DWJq2q0f.js → ReportDefine-D2CXXxZp.js} +1 -1
- package/dist/{ReportDesign-f_ed8u_q.js → ReportDesign-DWmFLxO_.js} +2 -2
- package/dist/{ReportQuery-D58gv_yZ.js → ReportQuery-BBMEls-l.js} +1 -1
- package/dist/{ReportQueryFrom-R0R6EbYv.js → ReportQueryFrom-CIeGY6UD.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CIFpgUAH.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-qtLKZPIW.js} +1 -1
- package/dist/{ReportTemplate-BTknctTT.js → ReportTemplate-CWxGNxLg.js} +1 -1
- package/dist/{Role-QTDJ16h8.js → Role-CF93718B.js} +3 -3
- package/dist/{RoleAssign-7aZ3ufp5.js → RoleAssign-BjoNSr6O.js} +3 -3
- package/dist/{RolePanel-XXwmaAgy.js → RolePanel-DmQaKkm5.js} +1 -1
- package/dist/{RolePanel-CSe-UoR5.js → RolePanel-qBGK6Ilt.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BsNhkvFo.js → RolePanel.vue_vue_type_script_setup_true_lang-BeNdAkYp.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-kConrKpo.js → RolePanel.vue_vue_type_script_setup_true_lang-DdK59XHp.js} +3 -3
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DtaqM_iA.js → ScrollPanel.vue_vue_type_style_index_0_lang-LU6W_QVY.js} +1 -1
- package/dist/{Staff-BsREgfrQ.js → Staff-BrjfdZU2.js} +3 -3
- package/dist/{StaffInfo-CQtVXfvS.js → StaffInfo-DYmftNDC.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-BRRtcGIH.js → StaffInfo.vue_vue_type_script_setup_true_lang-DVLhL8tz.js} +1 -1
- package/dist/{StaffPanel-cQTAulcP.js → StaffPanel-DJERIwT_.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BLeXlrI1.js → StaffPanel.vue_vue_type_script_setup_true_lang-D_leV5A8.js} +2 -2
- package/dist/{SysUser-DN5_46io.js → SysUser-WO0whf-F.js} +2 -2
- package/dist/{SysUserPanel-DTBNR42y.js → SysUserPanel-C64mSt4O.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-CF2pHcPP.js → SysUserPanel.vue_vue_type_script_setup_true_lang-B19FuxOZ.js} +1 -1
- package/dist/{SystemMenu-D9TKZwgb.js → SystemMenu-CY1EDfzl.js} +2 -2
- package/dist/{UserInfo-DJ5LRTMe.js → UserInfo-DWXmMOD1.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-CIpPef_S.js → UserInfo.vue_vue_type_style_index_0_lang-pjHVXRtK.js} +1 -1
- package/dist/{childView-CGZSd19y.js → childView-CMBPpTyj.js} +1 -1
- package/dist/{childView-DrL_Qi-q.js → childView-Czd4yk_A.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-D2AzjPNV.js → childView.vue_vue_type_style_index_0_lang-C9wXL52o.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-B8wEeuFX.js → childView.vue_vue_type_style_index_0_lang-CaMQbFZm.js} +1 -1
- package/dist/{code-rule-DVEoh1Z4.js → code-rule-kHfdPgGA.js} +1 -1
- package/dist/core.es.js +1 -1
- package/dist/{cron-task-BBpccUV_.js → cron-task-D1bbdvVP.js} +1 -1
- package/dist/{frameView-Cw6_EqfJ.js → frameView-B5JStsSt.js} +1 -1
- package/dist/index-Ce51XQgg.js +2618 -0
- package/dist/{layoutView-CL2Ef3bw.js → layoutView-DR39l27s.js} +2 -2
- package/dist/{login-BDocwo7t.js → login-d5LMP32l.js} +37 -36
- package/dist/{lov-view-R8nnUEbA.js → lov-view-wdnYE7wy.js} +2 -2
- package/dist/{menuInfo-B-nGOcSv.js → menuInfo-D0746839.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-1VuzxMb0.js → menuInfo.vue_vue_type_style_index_0_lang-p_yYtGl2.js} +1 -1
- package/dist/{pda-app-D5wBClj0.js → pda-app-zzzZfBj5.js} +1 -1
- package/dist/{resource-BXGSsXzw.js → resource-B7wnjBVW.js} +1 -1
- package/dist/{su-welcome-DISZAkBB.js → su-welcome-CeajjyWS.js} +1 -1
- package/dist/{sys-config-DuyYdzXL.js → sys-config-CpfSg66g.js} +1 -1
- package/dist/udp-core.css +2 -2
- package/dist/{utogether-C2KGHvut.js → utogether-B_dUqXea.js} +1 -1
- package/package.json +18 -18
- package/src/api/http.ts +1 -4
- package/src/api/index.ts +33 -31
- package/src/api/user.ts +2 -2
- package/src/main.ts +113 -119
- package/src/router/index.ts +177 -177
- package/src/style/vxetable.scss +1 -1
- package/src/utils/propTypes.ts +42 -42
- package/src/utils/udp/http/index.ts +19 -8
- package/src/views/login/login-view.vue +300 -300
- package/src/views/organization/inv-org/InvOrganization.vue +68 -68
- package/src/views/ulogin/login.vue +3 -2
- package/dist/index-BAkwQh8m.js +0 -4467
package/src/router/index.ts
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
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
|
+
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;
|
package/src/style/vxetable.scss
CHANGED
package/src/utils/propTypes.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: levi7754 levi7754@163.com
|
|
3
|
-
* @Date: 2023-06-19 09:14:18
|
|
4
|
-
* @LastEditors: wei.li
|
|
5
|
-
* @LastEditTime: 2024-07-02 08:57:49
|
|
6
|
-
* @FilePath: /sitzone-mes/src/utils/propTypes.ts
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/
|
|
9
|
-
import type { CSSProperties, VNodeChild } from 'vue';
|
|
10
|
-
import { createTypes, toValidableType, type VueTypesInterface, type VueTypeValidableDef } from 'vue-types';
|
|
11
|
-
|
|
12
|
-
export type VueNode = VNodeChild | JSX.Element;
|
|
13
|
-
|
|
14
|
-
type PropTypes = VueTypesInterface & {
|
|
15
|
-
readonly style: VueTypeValidableDef<CSSProperties>;
|
|
16
|
-
readonly VNodeChild: VueTypeValidableDef<VueNode>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const newPropTypes = createTypes({
|
|
20
|
-
func: undefined,
|
|
21
|
-
bool: undefined,
|
|
22
|
-
string: undefined,
|
|
23
|
-
number: undefined,
|
|
24
|
-
object: undefined,
|
|
25
|
-
integer: undefined
|
|
26
|
-
}) as PropTypes;
|
|
27
|
-
|
|
28
|
-
// 从 vue-types v5.0 开始,extend()方法已经废弃,当前已改为官方推荐的ES6+方法 https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
|
|
29
|
-
export default class propTypes extends newPropTypes {
|
|
30
|
-
// a native-like validator that supports the `.validable` method
|
|
31
|
-
static get style() {
|
|
32
|
-
return toValidableType('style', {
|
|
33
|
-
type: [String, Object]
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static get VNodeChild() {
|
|
38
|
-
return toValidableType('VNodeChild', {
|
|
39
|
-
type: undefined
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2023-06-19 09:14:18
|
|
4
|
+
* @LastEditors: wei.li
|
|
5
|
+
* @LastEditTime: 2024-07-02 08:57:49
|
|
6
|
+
* @FilePath: /sitzone-mes/src/utils/propTypes.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
import type { CSSProperties, VNodeChild } from 'vue';
|
|
10
|
+
import { createTypes, toValidableType, type VueTypesInterface, type VueTypeValidableDef } from 'vue-types';
|
|
11
|
+
|
|
12
|
+
export type VueNode = VNodeChild | JSX.Element;
|
|
13
|
+
|
|
14
|
+
type PropTypes = VueTypesInterface & {
|
|
15
|
+
readonly style: VueTypeValidableDef<CSSProperties>;
|
|
16
|
+
readonly VNodeChild: VueTypeValidableDef<VueNode>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const newPropTypes = createTypes({
|
|
20
|
+
func: undefined,
|
|
21
|
+
bool: undefined,
|
|
22
|
+
string: undefined,
|
|
23
|
+
number: undefined,
|
|
24
|
+
object: undefined,
|
|
25
|
+
integer: undefined
|
|
26
|
+
}) as PropTypes;
|
|
27
|
+
|
|
28
|
+
// 从 vue-types v5.0 开始,extend()方法已经废弃,当前已改为官方推荐的ES6+方法 https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
|
|
29
|
+
export default class propTypes extends newPropTypes {
|
|
30
|
+
// a native-like validator that supports the `.validable` method
|
|
31
|
+
static get style() {
|
|
32
|
+
return toValidableType('style', {
|
|
33
|
+
type: [String, Object]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static get VNodeChild() {
|
|
38
|
+
return toValidableType('VNodeChild', {
|
|
39
|
+
type: undefined
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -74,12 +74,12 @@ class SuHttp {
|
|
|
74
74
|
if (whiteList.some(v => config.url.indexOf(v) > -1)) return config;
|
|
75
75
|
return new Promise(resolve => {
|
|
76
76
|
const token = cookies.get(kTOKENKEY);
|
|
77
|
-
// debugger;
|
|
78
77
|
if (token) {
|
|
79
78
|
const data = JSON.parse(token);
|
|
80
79
|
const now = new Date().getTime();
|
|
81
80
|
const expired = data.expires - now <= 0;
|
|
82
81
|
if (expired) {
|
|
82
|
+
debugger;
|
|
83
83
|
if (!SuHttp.isRefreshing) {
|
|
84
84
|
SuHttp.isRefreshing = true;
|
|
85
85
|
// requests.push(() => SuHttp.axiosInstance(config));
|
|
@@ -87,17 +87,28 @@ class SuHttp {
|
|
|
87
87
|
refreshToken: data.refreshToken
|
|
88
88
|
})
|
|
89
89
|
.then((res: any) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (!res?.access_token) {
|
|
91
|
+
SuHttp.requests = []; // 重新请求完清空
|
|
92
|
+
cookies.remove('kCookies_token');
|
|
93
|
+
cookies.remove('authorized-token');
|
|
94
|
+
cookies.remove('loginer');
|
|
95
|
+
this.router.push({ name: 'login' });
|
|
96
|
+
} else {
|
|
97
|
+
// 替换token
|
|
98
|
+
this.setToken(res);
|
|
99
|
+
config.headers['Authorization'] = 'Bearer ' + res.access_token;
|
|
100
|
+
// token 刷新后将数组的方法重新执行
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
SuHttp.requests.forEach(cb => cb(res.access_token));
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
.catch(e => {
|
|
106
|
+
console.log({ e });
|
|
96
107
|
SuHttp.requests = []; // 重新请求完清空
|
|
108
|
+
this.router.push({ name: 'login' });
|
|
97
109
|
})
|
|
98
110
|
.finally(() => {
|
|
99
111
|
SuHttp.isRefreshing = false;
|
|
100
|
-
this.router.push({ name: 'login' });
|
|
101
112
|
});
|
|
102
113
|
}
|
|
103
114
|
// @ts-ignore
|