@utogether/udp-core 2.0.0-beta.25 → 2.0.0-beta.27
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-gdcH0-Bo.js +65 -0
- package/dist/404-Se2SF97M.js +65 -0
- package/dist/500-B6j9AqLo.js +67 -0
- package/dist/AuthorityInfo-CQ8ydZvr.js +4 -0
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-C4NRvS8p.js +100 -0
- package/dist/AuthorityPanel-lVnZ5bce.js +4 -0
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-nsfhDlvV.js +113 -0
- package/dist/Company-BzSVBSC4.js +25 -0
- package/dist/CompanyPanel-DBjZB4aJ.js +204 -0
- package/dist/DataSet-iBHzs75s.js +147 -0
- package/dist/Department-BkgseHo8.js +25 -0
- package/dist/DepartmentPanel-Sen93_2M.js +249 -0
- package/dist/DesignPanel-pqDcwaFC.js +4 -0
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BjtYyEw7.js +1013 -0
- package/dist/DictView-CJLG4LlE.js +110 -0
- package/dist/InvOrganization-D0Jq1IAa.js +74 -0
- package/dist/Org-CO_1WT39.js +39 -0
- package/dist/Preview-DLI4Bwel.js +48 -0
- package/dist/ReportDefine-Cw46OnJ_.js +10 -0
- package/dist/ReportDesign-D4sHTXT7.js +165 -0
- package/dist/ReportQuery-DtOCvQSN.js +74 -0
- package/dist/ReportQueryFrom-QjL-ETPq.js +4 -0
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-Dj9ne87n.js +177 -0
- package/dist/ReportTemplate-BxAgc_Aj.js +161 -0
- package/dist/Role-Df77BBD-.js +25 -0
- package/dist/RoleAssign-BrunouML.js +26 -0
- package/dist/RolePanel-DSVwqhiD.js +4 -0
- package/dist/RolePanel-HLA7XBlN.js +4 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CKlbqRa5.js +132 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CN0rUxKz.js +152 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-D_FeSXKv.js +99 -0
- package/dist/Staff-BeL1xcRf.js +26 -0
- package/dist/StaffInfo-CIfnltyX.js +4 -0
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-DbLFwWfG.js +107 -0
- package/dist/StaffPanel-BV2CHWac.js +4 -0
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-CvT-Vp2G.js +153 -0
- package/dist/SysUser-DPfNvthk.js +15 -0
- package/dist/SysUserPanel-CoLKYlQE.js +4 -0
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-lcO3Cjbq.js +353 -0
- package/dist/SystemMenu-sdj1dRDA.js +156 -0
- package/dist/UserInfo-CTX4hhFl.js +4 -0
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-ClhCd_8z.js +160 -0
- package/dist/await-to-js.es5-Bv3Eu4mi.js +10 -0
- package/dist/childView-BDmWwJO5.js +4 -0
- package/dist/childView-Dx3ACtHa.js +4 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-CfKq_0FN.js +183 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-DxZNtkhd.js +143 -0
- package/dist/code-rule-cvN4gYC_.js +148 -0
- package/dist/core.es.js +24 -6
- package/dist/cron-task-B0TkxFdp.js +135 -0
- package/dist/flow-task-PoDnE_kE.js +10 -0
- package/dist/frameView-5cy5BSgS.js +43 -0
- package/dist/img/minicolors.png +0 -0
- package/dist/index-C5WRTwvI.js +3006 -0
- package/dist/layout-home-DrARg-3o.js +232 -0
- package/dist/layoutView-25v_ngk5.js +3191 -0
- package/dist/log-in-Bmz5Uhbt.js +116 -0
- package/dist/log-out-B-8m3oNj.js +130 -0
- package/dist/login-Cmp2RvvW.js +217 -0
- package/dist/login-log-CVvRgZSu.js +70 -0
- package/dist/lov-view-BATtzw2X.js +99 -0
- package/dist/menuInfo-BIvrE7nm.js +4 -0
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-B6USomit.js +360 -0
- package/dist/pda-app-CzHVyeEa.js +707 -0
- package/dist/redirect-DTz8GSnv.js +15 -0
- package/dist/resource-Y5lGB38n.js +97 -0
- package/dist/su-welcome-CXA6OzBw.js +878 -0
- package/dist/sys-config-CqO03LeC.js +385 -0
- package/dist/udp-core.css +1 -2
- package/dist/useNav-C-rCgubt.js +84 -0
- package/dist/utogether-MlnyYtNS.js +4 -0
- package/dist/wecom-push-B75FLee5.js +70 -0
- package/index.ts +3 -2
- package/package.json +1 -1
- package/src/App.vue +79 -73
- package/src/api/index.ts +1 -1
- package/src/components/SuQrcode/src/index.tsx +231 -236
- package/src/components/udp/grid/index.vue +9 -11
- package/src/components/udp/utils.ts +420 -414
- package/src/layout/components/lay-panel/index.vue +2 -6
- package/src/layout/components/lay-search/components/SearchModal.vue +7 -3
- package/src/main.ts +111 -110
- package/src/router/index.ts +156 -187
- package/src/router/utils.ts +2 -3
- package/src/store/modules/system.ts +7 -0
- package/src/style/vxetable.scss +372 -364
- package/src/utils/authority/index.ts +46 -29
- package/src/utils/udp/http/index.ts +115 -64
- package/src/utils/udp/http/types.d.ts +15 -14
- package/src/views/login/login-view.vue +280 -301
- package/src/views/organization/department/DepartmentPanel.vue +3 -4
- package/src/views/system/sys/sys-config.vue +344 -344
- package/src/views/uhome/components/home-todo.vue +179 -178
- package/src/views/ulogin/login.vue +8 -41
- package/tsconfig.json +2 -3
- package/types/global.d.ts +234 -234
- package/vite.config.ts +2 -1
- package/dist/403-QwBKrRZE.js +0 -72
- package/dist/404-Cr7MbzNV.js +0 -72
- package/dist/500-B7kCOeIA.js +0 -77
- package/dist/AuthorityInfo-Dwml2K4S.js +0 -91
- package/dist/AuthorityPanel-DzPhsPpa.js +0 -98
- package/dist/Company-BhOlvl7Q.js +0 -21
- package/dist/CompanyPanel-ByhY5-Sq.js +0 -199
- package/dist/DataSet-CuGZcKC-.js +0 -141
- package/dist/Department-QvngN63N.js +0 -21
- package/dist/DepartmentPanel-BCXqC39J.js +0 -2
- package/dist/DepartmentPanel-DntGycxr.js +0 -242
- package/dist/DesignPanel-BMN4DZ0R.js +0 -1196
- package/dist/DictView-ERFqZ5VD.js +0 -100
- package/dist/File-WJXjGYxr.js +0 -89
- package/dist/InvOrganization-BwMmD8Ua.js +0 -76
- package/dist/Org-HgnOWubi.js +0 -76
- package/dist/Preview-CVZdnHB1.js +0 -45
- package/dist/ReIcon-DecitXmg.js +0 -413
- package/dist/ReportDefine-BgLM-Rjk.js +0 -10
- package/dist/ReportDesign-CjfTyyy_.js +0 -158
- package/dist/ReportQuery-CP-E0Puv.js +0 -101
- package/dist/ReportQueryFrom-D7SPPAps.js +0 -198
- package/dist/ReportTemplate-DE25zc1f.js +0 -162
- package/dist/Role-K7v_ZhFE.js +0 -21
- package/dist/RoleAssign-C16fjLaX.js +0 -22
- package/dist/RolePanel-CV-xPlYJ.js +0 -176
- package/dist/RolePanel-DPCe9k8f.js +0 -131
- package/dist/ScrollPanel-DW30pGz1.js +0 -88
- package/dist/Staff-w2ly4qd0.js +0 -22
- package/dist/StaffInfo-DPDRpz6F.js +0 -149
- package/dist/StaffPanel-DI1eTTp9.js +0 -143
- package/dist/SysUser-BMTX1cJM.js +0 -12
- package/dist/SysUserPanel-xwZdVjdp.js +0 -365
- package/dist/SystemMenu-TXhiQZVm.js +0 -154
- package/dist/UserInfo-JQqw8FMT.js +0 -194
- package/dist/_plugin-vue_export-helper-C6QCLu9I.js +0 -8
- package/dist/api-BFNxcxSN.js +0 -30
- package/dist/authority-Bi6BGB5B.js +0 -20
- package/dist/await-to-js.es5-DkWYmPXW.js +0 -10
- package/dist/childView-Bk8OD9bV.js +0 -181
- package/dist/childView-CyrcwshT.js +0 -184
- package/dist/code-rule-QFrhqFrW.js +0 -151
- package/dist/contant-Q77dU_V3.js +0 -4
- package/dist/cron-task-BpUDKEAU.js +0 -131
- package/dist/flow-task-DAc2NrDU.js +0 -11
- package/dist/frameView-Di0zJZUR.js +0 -39
- package/dist/layout-home-BVp7vYLR.js +0 -239
- package/dist/layoutView-DFUjrqAS.js +0 -2662
- package/dist/log-in-BrNB0mLz.js +0 -117
- package/dist/log-out-dYfqvzy6.js +0 -111
- package/dist/login-BdCDnuXL.js +0 -233
- package/dist/login-log-CJak-ANA.js +0 -79
- package/dist/lov-view-DkmG4K57.js +0 -95
- package/dist/menuInfo-kp2wNYOp.js +0 -346
- package/dist/mitt-CQgI7DYU.js +0 -27
- package/dist/pda-app-CA7YI37u.js +0 -589
- package/dist/redirect-N0k4tImU.js +0 -16
- package/dist/resource-CfQTHFcs.js +0 -94
- package/dist/router-CeluSGiD.js +0 -1531
- package/dist/su-welcome-JeiovGpe.js +0 -799
- package/dist/sys-config-Ddb3vBpK.js +0 -316
- package/dist/udp-core-Dhm-BlAs.js +0 -2032
- package/dist/useDataThemeChange-BCy8JBG7.js +0 -226
- package/dist/useNav-DY8FkltH.js +0 -106
- package/dist/utogether-l7JXs4Lv.js +0 -4
- package/dist/water-mark-WDQZ9YqB.js +0 -119
- package/dist/wecom-push-kWkAVRCj.js +0 -77
|
@@ -53,9 +53,7 @@ onBeforeUnmount(() => {
|
|
|
53
53
|
<div :class="{ show }">
|
|
54
54
|
<div class="right-panel-background" />
|
|
55
55
|
<div ref="target" class="right-panel bg-bg_color bg-white">
|
|
56
|
-
<div
|
|
57
|
-
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
|
58
|
-
>
|
|
56
|
+
<div class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]">
|
|
59
57
|
<h4 class="dark:text-white">{{ $t('message.tip.projectConfig') }}</h4>
|
|
60
58
|
<span
|
|
61
59
|
v-tippy="{
|
|
@@ -78,9 +76,7 @@ onBeforeUnmount(() => {
|
|
|
78
76
|
<slot />
|
|
79
77
|
</el-scrollbar>
|
|
80
78
|
|
|
81
|
-
<div
|
|
82
|
-
class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
|
83
|
-
>
|
|
79
|
+
<div class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]">
|
|
84
80
|
<el-button
|
|
85
81
|
v-tippy="{
|
|
86
82
|
content: $t('message.tip.toLogin'),
|
|
@@ -96,10 +96,14 @@ watch(show, async val => {
|
|
|
96
96
|
/** 将菜单树形结构扁平化为一维数组,用于菜单查询 */
|
|
97
97
|
function flatTree(arr) {
|
|
98
98
|
const res = [];
|
|
99
|
-
function deep(arr) {
|
|
99
|
+
function deep(arr, parentIcon?) {
|
|
100
100
|
arr.forEach(item => {
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
if (!item.children || item.children.length === 0) {
|
|
102
|
+
const menuItem = !item.meta?.icon && parentIcon ? { ...item, meta: { ...item.meta, icon: parentIcon } } : item;
|
|
103
|
+
res.push(menuItem);
|
|
104
|
+
} else {
|
|
105
|
+
deep(item.children, item.meta?.icon);
|
|
106
|
+
}
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
109
|
deep(arr);
|
package/src/main.ts
CHANGED
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: levi7754 levi7754@163.com
|
|
3
|
-
* @Date: 2025-07-25 13:38:20
|
|
4
|
-
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2026-
|
|
6
|
-
* @FilePath: \udp-front\packages\udp-core\src\main.ts
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/
|
|
9
|
-
import { createApp, type Directive } from 'vue';
|
|
10
|
-
import App from './App.vue';
|
|
11
|
-
// import router from './router';
|
|
12
|
-
import { setViews } from './router';
|
|
13
|
-
import { setupStore } from './store';
|
|
14
|
-
import { setConfig,
|
|
15
|
-
import { useI18n, transformI18n } from '../src/plugins/i18n';
|
|
16
|
-
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
17
|
-
import { injectResponsiveStorage } from './utils/storage';
|
|
18
|
-
import hasAuthority from './utils/authority';
|
|
19
|
-
import { getServiceApi, getBaseURL, setRouter, setBaseUrl, getDebugBaseURL } from './api';
|
|
20
|
-
|
|
21
|
-
import 'nprogress/nprogress.css';
|
|
22
|
-
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
23
|
-
import './style/tailwind.css';
|
|
24
|
-
// // 引入重置样式
|
|
25
|
-
import './style/reset.scss';
|
|
26
|
-
// 导入公共样式
|
|
27
|
-
import './style/index.scss';
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} from './components/udp';
|
|
44
|
-
|
|
45
|
-
const app = createApp(App);
|
|
46
|
-
|
|
47
|
-
// 全局注册`@iconify/vue`图标库
|
|
48
|
-
import { IconifyIconOffline, FontIcon } from './components/ReIcon';
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
import 'tippy
|
|
52
|
-
import
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
app.config.globalProperties.$
|
|
64
|
-
app.config.globalProperties.$
|
|
65
|
-
app.config.globalProperties.$
|
|
66
|
-
app.config.globalProperties.$
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
app
|
|
86
|
-
app.component('
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
app.component('
|
|
91
|
-
app.component('
|
|
92
|
-
// app.component('
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
app.component('
|
|
96
|
-
app.component('
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2025-07-25 13:38:20
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2026-05-18 15:34:06
|
|
6
|
+
* @FilePath: \udp-front\packages\udp-core\src\main.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
import { createApp, type Directive } from 'vue';
|
|
10
|
+
import App from './App.vue';
|
|
11
|
+
// import router from './router';
|
|
12
|
+
import { setViews } from './router';
|
|
13
|
+
import { setupStore } from './store';
|
|
14
|
+
import { setConfig, setSystemEnv } from './config';
|
|
15
|
+
import { useI18n, transformI18n } from '../src/plugins/i18n';
|
|
16
|
+
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
17
|
+
import { injectResponsiveStorage } from './utils/storage';
|
|
18
|
+
import { hasAuthority, isViewonly } from './utils/authority';
|
|
19
|
+
import { getServiceApi, getBaseURL, setRouter, setBaseUrl, getDebugBaseURL } from './api';
|
|
20
|
+
|
|
21
|
+
import 'nprogress/nprogress.css';
|
|
22
|
+
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
23
|
+
import './style/tailwind.css';
|
|
24
|
+
// // 引入重置样式
|
|
25
|
+
import './style/reset.scss';
|
|
26
|
+
// 导入公共样式
|
|
27
|
+
import './style/index.scss';
|
|
28
|
+
|
|
29
|
+
// import {
|
|
30
|
+
// UtLov2,
|
|
31
|
+
// UtDivider,
|
|
32
|
+
// UtModalForm2
|
|
33
|
+
// FormUpload2,
|
|
34
|
+
// UtForm2,
|
|
35
|
+
// UtGrid2,
|
|
36
|
+
// UtContent2,
|
|
37
|
+
// UtStampBadge2,
|
|
38
|
+
// UtModalGrid2
|
|
39
|
+
// UtUpload2
|
|
40
|
+
// UtIconSelect,
|
|
41
|
+
// UtCalendar
|
|
42
|
+
// uAttachment
|
|
43
|
+
// } from './components/udp';
|
|
44
|
+
|
|
45
|
+
const app = createApp(App);
|
|
46
|
+
|
|
47
|
+
// 全局注册`@iconify/vue`图标库
|
|
48
|
+
import { IconifyIconOffline, FontIcon } from './components/ReIcon';
|
|
49
|
+
|
|
50
|
+
// 全局注册`vue-tippy`
|
|
51
|
+
import VueTippy from 'vue-tippy';
|
|
52
|
+
import 'tippy.js/dist/tippy.css';
|
|
53
|
+
import 'tippy.js/animations/perspective.css';
|
|
54
|
+
|
|
55
|
+
app.use(VueTippy, {
|
|
56
|
+
defaultProps: { animation: 'perspective' }
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// 自定义指令
|
|
60
|
+
import * as directives from './directives';
|
|
61
|
+
|
|
62
|
+
const setGlobal = app => {
|
|
63
|
+
app.config.globalProperties.$hasAuthority = hasAuthority;
|
|
64
|
+
app.config.globalProperties.$isViewonly = isViewonly;
|
|
65
|
+
app.config.globalProperties.$serviceApi = getServiceApi();
|
|
66
|
+
app.config.globalProperties.$debuggerApi = getDebugBaseURL();
|
|
67
|
+
app.config.globalProperties.$url = getBaseURL();
|
|
68
|
+
window.$i18n = transformI18n;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const setGlobalDirective = app => {
|
|
72
|
+
Object.keys(directives).forEach(key => {
|
|
73
|
+
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const init = ({ router, config, lang, views, env, tableConfig }) => {
|
|
78
|
+
setViews(views, router);
|
|
79
|
+
app.use(router);
|
|
80
|
+
setRouter(router);
|
|
81
|
+
setConfig(app, config);
|
|
82
|
+
setSystemEnv(env);
|
|
83
|
+
setTableConfig(tableConfig);
|
|
84
|
+
return new Promise(resolve => {
|
|
85
|
+
useI18n(app, lang);
|
|
86
|
+
app.component('IconifyIconOffline', IconifyIconOffline);
|
|
87
|
+
app.component('FontIcon', FontIcon);
|
|
88
|
+
// app.component('uAttachment', uAttachment).component('UGrid', UGrid);
|
|
89
|
+
// .component('UtDivider', UtDivider)
|
|
90
|
+
// app.component('UtModalForm2', UtModalForm2);
|
|
91
|
+
// app.component('UtGrid2', UtGrid2);
|
|
92
|
+
// app.component('UtUpload2', UtUpload2);
|
|
93
|
+
// app.component('UtModalGrid2', UtModalGrid2);
|
|
94
|
+
// .component('UtIconSelect', UtIconSelect)
|
|
95
|
+
// app.component('FormUpload2', FormUpload2).component('UtLov2', UtLov2);
|
|
96
|
+
// app.component('UtContent2', UtContent2);
|
|
97
|
+
// app.component('UtStampBadge2', UtStampBadge2);
|
|
98
|
+
// .component('UtModalGrid', UtModalGrid);
|
|
99
|
+
// app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
|
|
100
|
+
setGlobal(app);
|
|
101
|
+
setBaseUrl(getBaseURL());
|
|
102
|
+
setGlobalDirective(app);
|
|
103
|
+
// 全局组件
|
|
104
|
+
setupStore(app);
|
|
105
|
+
injectResponsiveStorage(app, config);
|
|
106
|
+
const result = { app, router };
|
|
107
|
+
resolve(result);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default init;
|
package/src/router/index.ts
CHANGED
|
@@ -1,187 +1,156 @@
|
|
|
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
|
-
import flow from './modules/flow';
|
|
14
|
-
|
|
15
|
-
const systemRouter = import.meta.glob([
|
|
16
|
-
'../views/system/**/*.{vue,tsx}',
|
|
17
|
-
'../views/uapp/**/*.{vue,tsx}',
|
|
18
|
-
'../views/upms/**/*.{vue,tsx}',
|
|
19
|
-
'../views/ufile/**/*.{vue}',
|
|
20
|
-
'../views/urpt/**/*.{vue,tsx}',
|
|
21
|
-
'../views/organization/**/*.{vue,tsx}',
|
|
22
|
-
'../views/udev/**/*.{vue, tsx}'
|
|
23
|
-
// '../views/uflow/**/*.{vue, tsx}'
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
export const remainingRouters = remainingRouter;
|
|
27
|
-
|
|
28
|
-
// 原始静态路由(未做任何处理)
|
|
29
|
-
const routes = [homeRouter, errorRouter, flow];
|
|
30
|
-
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
|
|
31
|
-
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|
32
|
-
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
/** 用于渲染菜单,保持原始层级 */
|
|
36
|
-
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(...remainingRouter);
|
|
37
|
-
|
|
38
|
-
/** 不参与菜单的路由 */
|
|
39
|
-
export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
|
40
|
-
return remainingRouter[v].path;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
/** 创建路由实例 */
|
|
44
|
-
// export const router: Router = createRouter({
|
|
45
|
-
// history: createWebHistory(window.__HISTORY_PATH__),
|
|
46
|
-
// routes: constantRoutes.concat(...(remainingRouter as any)),
|
|
47
|
-
// strict: true,
|
|
48
|
-
// scrollBehavior(to, from, savedPosition) {
|
|
49
|
-
// return new Promise(resolve => {
|
|
50
|
-
// if (savedPosition) {
|
|
51
|
-
// return savedPosition;
|
|
52
|
-
// } else {
|
|
53
|
-
// if (from.meta.saveSrollTop) {
|
|
54
|
-
// const top: number = document.documentElement.scrollTop || document.body.scrollTop;
|
|
55
|
-
// resolve({ left: 0, top });
|
|
56
|
-
// }
|
|
57
|
-
// }
|
|
58
|
-
// });
|
|
59
|
-
// }
|
|
60
|
-
// });
|
|
61
|
-
|
|
62
|
-
/** 记录已经加载的页面路径 */
|
|
63
|
-
const loadedPaths = new Set<string>();
|
|
64
|
-
|
|
65
|
-
/** 重置已加载页面记录 */
|
|
66
|
-
export function resetLoadedPaths() {
|
|
67
|
-
loadedPaths.clear();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** 重置路由 */
|
|
71
|
-
export function resetRouter() {
|
|
72
|
-
router.getRoutes().forEach(route => {
|
|
73
|
-
const { name, meta } = route;
|
|
74
|
-
if (name && router.hasRoute(name) && meta?.backstage) {
|
|
75
|
-
router.removeRoute(name);
|
|
76
|
-
router.options.routes = formatTwoStageRoutes(formatFlatteningRoutes(buildHierarchyTree(ascending(routes))));
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
usePermissionStoreHook().clearAllCachePage();
|
|
80
|
-
resetLoadedPaths();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let views = null;
|
|
84
|
-
export let router = null;
|
|
85
|
-
export function setViews(cviews, crouter) {
|
|
86
|
-
views = cviews;
|
|
87
|
-
router = crouter;
|
|
88
|
-
Object.assign(views, systemRouter);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function getViews() {
|
|
92
|
-
return views;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/** 路由白名单 */
|
|
96
|
-
const whiteList = ['/login'];
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (to.meta?.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
} else {
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const index = findIndexOf(remainingRouter, v => v.path === path);
|
|
158
|
-
const routes: any = index === -1 ? router.options.routes[0].children : router.options.routes;
|
|
159
|
-
const route = findRouteByPath(path, routes);
|
|
160
|
-
if (route && route.meta?.title) {
|
|
161
|
-
const { path, name, meta } = route;
|
|
162
|
-
useMultiTagsStoreHook().handleTags('push', { path, name, meta });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
// 确保动态路由完全加入路由列表并且不影响静态路由
|
|
166
|
-
// (注意:动态路由刷新时router.beforeEach可能会触发两次,
|
|
167
|
-
// 第一次触发动态路由还未完全添加,第二次动态路由才完全添加到路由列表,
|
|
168
|
-
// 如果需要在router.beforeEach做一些判断可以在to.name存在的条件下去判断,这样就只会触发一次)
|
|
169
|
-
if (isEmpty(to.name)) router.push(to.fullPath);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
if (_from.fullPath === '/' && to.fullPath === '/login' && !to.query?.tokenExpire) {
|
|
173
|
-
to.path = '/welcome';
|
|
174
|
-
to.fullPath = '/welcome';
|
|
175
|
-
to.name = 'UdpWelcome';
|
|
176
|
-
} else if (_from.fullPath === '/' && to.path === '/workflow/approve/index') {
|
|
177
|
-
to.path = '/welcome';
|
|
178
|
-
to.fullPath = '/welcome';
|
|
179
|
-
to.name = 'UdpWelcome';
|
|
180
|
-
to.query = {};
|
|
181
|
-
}
|
|
182
|
-
// next();
|
|
183
|
-
toCorrectRoute();
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// 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
|
+
import flow from './modules/flow';
|
|
14
|
+
|
|
15
|
+
const systemRouter = import.meta.glob([
|
|
16
|
+
'../views/system/**/*.{vue,tsx}',
|
|
17
|
+
'../views/uapp/**/*.{vue,tsx}',
|
|
18
|
+
'../views/upms/**/*.{vue,tsx}',
|
|
19
|
+
'../views/ufile/**/*.{vue}',
|
|
20
|
+
'../views/urpt/**/*.{vue,tsx}',
|
|
21
|
+
'../views/organization/**/*.{vue,tsx}',
|
|
22
|
+
'../views/udev/**/*.{vue, tsx}'
|
|
23
|
+
// '../views/uflow/**/*.{vue, tsx}'
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
export const remainingRouters = remainingRouter;
|
|
27
|
+
|
|
28
|
+
// 原始静态路由(未做任何处理)
|
|
29
|
+
const routes = [homeRouter, errorRouter, flow];
|
|
30
|
+
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
|
|
31
|
+
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|
32
|
+
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/** 用于渲染菜单,保持原始层级 */
|
|
36
|
+
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(...remainingRouter);
|
|
37
|
+
|
|
38
|
+
/** 不参与菜单的路由 */
|
|
39
|
+
export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
|
40
|
+
return remainingRouter[v].path;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/** 创建路由实例 */
|
|
44
|
+
// export const router: Router = createRouter({
|
|
45
|
+
// history: createWebHistory(window.__HISTORY_PATH__),
|
|
46
|
+
// routes: constantRoutes.concat(...(remainingRouter as any)),
|
|
47
|
+
// strict: true,
|
|
48
|
+
// scrollBehavior(to, from, savedPosition) {
|
|
49
|
+
// return new Promise(resolve => {
|
|
50
|
+
// if (savedPosition) {
|
|
51
|
+
// return savedPosition;
|
|
52
|
+
// } else {
|
|
53
|
+
// if (from.meta.saveSrollTop) {
|
|
54
|
+
// const top: number = document.documentElement.scrollTop || document.body.scrollTop;
|
|
55
|
+
// resolve({ left: 0, top });
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// });
|
|
59
|
+
// }
|
|
60
|
+
// });
|
|
61
|
+
|
|
62
|
+
/** 记录已经加载的页面路径 */
|
|
63
|
+
const loadedPaths = new Set<string>();
|
|
64
|
+
|
|
65
|
+
/** 重置已加载页面记录 */
|
|
66
|
+
export function resetLoadedPaths() {
|
|
67
|
+
loadedPaths.clear();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 重置路由 */
|
|
71
|
+
export function resetRouter() {
|
|
72
|
+
router.getRoutes().forEach(route => {
|
|
73
|
+
const { name, meta } = route;
|
|
74
|
+
if (name && router.hasRoute(name) && meta?.backstage) {
|
|
75
|
+
router.removeRoute(name);
|
|
76
|
+
router.options.routes = formatTwoStageRoutes(formatFlatteningRoutes(buildHierarchyTree(ascending(routes))));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
usePermissionStoreHook().clearAllCachePage();
|
|
80
|
+
resetLoadedPaths();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let views = null;
|
|
84
|
+
export let router = null;
|
|
85
|
+
export function setViews(cviews, crouter) {
|
|
86
|
+
views = cviews;
|
|
87
|
+
router = crouter;
|
|
88
|
+
Object.assign(views, systemRouter);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function getViews() {
|
|
92
|
+
return views;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** 路由白名单 */
|
|
96
|
+
const whiteList = ['/login'];
|
|
97
|
+
export const routerBefore = (to, _from) => {
|
|
98
|
+
// TODO 无权限跳转403页面
|
|
99
|
+
// if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
|
|
100
|
+
// next({ path: "/error/403" });
|
|
101
|
+
// }
|
|
102
|
+
const userName = cookies.get(kLOGINER);
|
|
103
|
+
const externalLink = isUrl(to?.name as string);
|
|
104
|
+
/** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
|
|
105
|
+
function toCorrectRoute() {
|
|
106
|
+
return whiteList.includes(to.fullPath) ? _from.fullPath : undefined;
|
|
107
|
+
}
|
|
108
|
+
if (_from?.name && _from?.name !== 'login') {
|
|
109
|
+
// m.name === to.name 判断param路由跳转
|
|
110
|
+
const cmp = to.matched.find(m => m.path === to.path || (m.name === to.name && to.params))?.components;
|
|
111
|
+
// 如果路由包含http 则是超链接 反之是普通路由
|
|
112
|
+
if (externalLink) {
|
|
113
|
+
openLink(to?.name as string);
|
|
114
|
+
NProgress?.done();
|
|
115
|
+
} else if (cmp?.default || to.name === 'redirect') {
|
|
116
|
+
toCorrectRoute();
|
|
117
|
+
} else {
|
|
118
|
+
return { path: '/error/404' };
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
// 刷新
|
|
122
|
+
if (usePermissionStoreHook().wholeMenus.length === 0) {
|
|
123
|
+
initRouter(userName).then((router: Router) => {
|
|
124
|
+
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
|
125
|
+
const { path } = to;
|
|
126
|
+
const index = findIndexOf(remainingRouter, v => v.path === path);
|
|
127
|
+
const routes: any = index === -1 ? router.options.routes[0].children : router.options.routes;
|
|
128
|
+
const route = findRouteByPath(path, routes);
|
|
129
|
+
if (route && route.meta?.title) {
|
|
130
|
+
const { path, name, meta } = route;
|
|
131
|
+
useMultiTagsStoreHook().handleTags('push', { path, name, meta });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// 确保动态路由完全加入路由列表并且不影响静态路由
|
|
135
|
+
// (注意:动态路由刷新时router.beforeEach可能会触发两次,
|
|
136
|
+
// 第一次触发动态路由还未完全添加,第二次动态路由才完全添加到路由列表,
|
|
137
|
+
// 如果需要在router.beforeEach做一些判断可以在to.name存在的条件下去判断,这样就只会触发一次)
|
|
138
|
+
if (isEmpty(to.name)) router.push(to.fullPath);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (_from.fullPath === '/' && to.fullPath === '/login' && !to.query?.tokenExpire) {
|
|
142
|
+
to.path = '/welcome';
|
|
143
|
+
to.fullPath = '/welcome';
|
|
144
|
+
to.name = 'UdpWelcome';
|
|
145
|
+
} else if (_from.fullPath === '/' && to.path === '/workflow/approve/index') {
|
|
146
|
+
to.path = '/welcome';
|
|
147
|
+
to.fullPath = '/welcome';
|
|
148
|
+
to.name = 'UdpWelcome';
|
|
149
|
+
to.query = {};
|
|
150
|
+
}
|
|
151
|
+
// next();
|
|
152
|
+
toCorrectRoute();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// export default router;
|
package/src/router/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: levi7754 levi7754@163.com
|
|
3
3
|
* @Date: 2024-08-01 21:42:39
|
|
4
4
|
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2026-
|
|
5
|
+
* @LastEditTime: 2026-04-16 09:56:45
|
|
6
6
|
* @FilePath: \udp-front\packages\udp-core\src\router\utils.ts
|
|
7
7
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
8
|
*/
|
|
@@ -26,7 +26,7 @@ const Layout = () => import('../layout/layoutView.vue');
|
|
|
26
26
|
const IFrame = () => import('../layout/frameView.vue');
|
|
27
27
|
|
|
28
28
|
// 动态路由
|
|
29
|
-
import {
|
|
29
|
+
import { initSystemInfo, getAsyncRoutes } from '../api/user';
|
|
30
30
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
|
31
31
|
// const modulesRoutes = import.meta.glob('/src/views/**/*.{vue,tsx}');
|
|
32
32
|
|
|
@@ -190,7 +190,6 @@ async function initRouter(userName) {
|
|
|
190
190
|
if (getConfig().CachingAsyncRoutes) {
|
|
191
191
|
await dbstorage.getItem(key).then(data => (asyncRouteList = data));
|
|
192
192
|
}
|
|
193
|
-
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
194
193
|
await initSystemInfo().then(async (res: IRecord) => {
|
|
195
194
|
useSystemStoreHook().setSystemInfo(res);
|
|
196
195
|
await getServiceApi()
|