@utogether/udp-core 1.0.1-beta.3 → 1.0.1-beta.5
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/build/plugins.ts +39 -37
- package/dist/{403-BuP9jvH9.js → 403-CP2RkkAy.js} +10 -10
- package/dist/{404-DfQk8kKl.js → 404-DwK-0wNQ.js} +4 -4
- package/dist/{500-OgROWdiZ.js → 500-CLbJDqnd.js} +1 -1
- package/dist/{AuthorityInfo-q2ksfkWH.js → AuthorityInfo-Bi1_uhMu.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Bwsf6lMH.js → AuthorityInfo.vue_vue_type_style_index_0_lang-RUhvzu76.js} +8 -9
- package/dist/{Company-DgqowAxc.js → Company-B--cokc6.js} +3 -3
- package/dist/{CompanyPanel-BNb1rUhD.js → CompanyPanel-B_gmcZ9L.js} +6 -6
- package/dist/{Department-Cl8CROSU.js → Department-DbKdyNzK.js} +3 -3
- package/dist/{DepartmentPanel-D5VkqKeP.js → DepartmentPanel-BmEttboJ.js} +23 -24
- package/dist/{DesignPanel-BGvEusHC.js → DesignPanel-LL68_36s.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BQF1uQ7w.js → DesignPanel.vue_vue_type_style_index_0_lang-DWPmFegv.js} +8 -9
- package/dist/{DictView-BnxfaOBv.js → DictView-B8j-EWx5.js} +1 -1
- package/dist/{InvOrganization-5y79ZLdY.js → InvOrganization-DnGQlESM.js} +7 -8
- package/dist/Org-Dg9Xkd34.js +34 -0
- package/dist/{Preview-BaGmXH7r.js → Preview-yot4NBW5.js} +1 -1
- package/dist/{ReportDefine-DkQdBErt.js → ReportDefine-DHadqNYy.js} +1 -1
- package/dist/{ReportDesign-DzB_A_G6.js → ReportDesign-CBihGRth.js} +23 -24
- package/dist/{ReportQuery-DRcMb6ya.js → ReportQuery-CwHQ6LUU.js} +1 -1
- package/dist/{ReportQueryFrom-CeA9xhR4.js → ReportQueryFrom-ie6lQcGL.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CgGtcs5V.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-B8LJNK0m.js} +1 -1
- package/dist/{ReportTemplate-qaiTMQuT.js → ReportTemplate-B2Smwo-z.js} +18 -18
- package/dist/{Role-DsFulAjq.js → Role-Cf7DB7uS.js} +3 -3
- package/dist/{RoleAssign-DMRdocpa.js → RoleAssign-upUnqs_i.js} +3 -3
- package/dist/{RolePanel-wXVysDHM.js → RolePanel-BBGDGK8V.js} +1 -1
- package/dist/{RolePanel-B9POS_pg.js → RolePanel-EXL_FLvM.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-t6S_0zmJ.js → RolePanel.vue_vue_type_script_setup_true_lang-BwfL_JVZ.js} +8 -9
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CleVvkcY.js → RolePanel.vue_vue_type_script_setup_true_lang-DF8qJKwW.js} +9 -9
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DlXUs0j9.js → ScrollPanel.vue_vue_type_style_index_0_lang-DbBGg32H.js} +13 -13
- package/dist/{Staff-Cq4V7ruC.js → Staff-DYu5ZEyR.js} +3 -3
- package/dist/{StaffInfo-CJDKMbud.js → StaffInfo-CHvNGjtz.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DQ4DL1KY.js → StaffInfo.vue_vue_type_script_setup_true_lang-XRJVEJ-s.js} +14 -14
- package/dist/{StaffPanel-CG-uggdr.js → StaffPanel-C-ygEY65.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DAgN7zN2.js → StaffPanel.vue_vue_type_script_setup_true_lang-BvLrF4Yw.js} +6 -6
- package/dist/{SysUser-kwnzRNdD.js → SysUser-BHk_szpK.js} +2 -2
- package/dist/{SysUserPanel-DTlZf3vk.js → SysUserPanel-DFvzA5d-.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-BW6PlGjM.js → SysUserPanel.vue_vue_type_script_setup_true_lang-B9zUXXwa.js} +24 -25
- package/dist/{SystemMenu-BVT0n-L2.js → SystemMenu-5TK9ZA11.js} +34 -35
- package/dist/{UserInfo-BbTQ9Zat.js → UserInfo-Bx3zQqHa.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-D_bpYDmI.js → UserInfo.vue_vue_type_style_index_0_lang-C2sqUQdg.js} +12 -13
- package/dist/{childView-BJbIhjmf.js → childView-BSUWnii7.js} +1 -1
- package/dist/{childView-DCsGFrG-.js → childView-CFC3gA_U.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-CDtsalCm.js → childView.vue_vue_type_style_index_0_lang-EcT-Dux7.js} +48 -49
- package/dist/{childView.vue_vue_type_style_index_0_lang-BCDxpVoD.js → childView.vue_vue_type_style_index_0_lang-WQVLSJR8.js} +9 -10
- package/dist/{code-rule-DePU6cdp.js → code-rule-DybjhotB.js} +6 -8
- package/dist/core.es.js +14 -11
- package/dist/{cron-task-DUM1SIGL.js → cron-task-DGdknqaF.js} +7 -8
- package/dist/{frameView-CEUTDtSm.js → frameView-BOOZRv1S.js} +1 -1
- package/dist/index-BDE4-ZvN.js +5091 -0
- package/dist/{layoutView-PCjwVwkX.js → layoutView-BWeDLY9C.js} +11 -12
- package/dist/{login-B1CjWVKu.js → login-BcuCHhGE.js} +21 -21
- package/dist/{login-log-CvVnyGi3.js → login-log-kqKzKTto.js} +1 -1
- package/dist/{lov-view-D8wwkxFJ.js → lov-view-DDgzqYSW.js} +8 -9
- package/dist/{menuInfo-B5JKVwrB.js → menuInfo-B3MOxomU.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CcM9WX4n.js → menuInfo.vue_vue_type_style_index_0_lang-BXMrNMUs.js} +19 -18
- package/dist/{pda-app-DIa1p1Ww.js → pda-app-Dy9WMHEG.js} +19 -20
- package/dist/{resource-CCQ7Dd-5.js → resource-BoCP7-dM.js} +8 -8
- package/dist/{su-welcome-CLp9YaJa.js → su-welcome-DXpI1MHr.js} +97 -98
- package/dist/{sys-config-BBmf_SqF.js → sys-config-BiUWzxGU.js} +19 -20
- package/dist/udp-core.css +2 -2
- package/dist/{utogether-Bkptx2lB.js → utogether-DXDcsKt7.js} +1 -1
- package/index.ts +40 -36
- package/package.json +1 -1
- package/src/App.vue +1 -1
- package/src/api/index.ts +1 -1
- package/src/components/udp/count-down.vue +536 -0
- package/src/components/udp/form.vue +107 -0
- package/src/components/udp/grid.vue +6 -1
- package/src/components/udp/index.ts +4 -1
- package/src/components/udp/modal-form.vue +9 -0
- package/src/components/udp/upload.vue +425 -0
- package/src/components/udp/utils.ts +72 -3
- package/src/directives/permission/index.ts +1 -1
- package/src/layout/components/lay-panel/index.vue +3 -3
- package/src/main.ts +111 -110
- package/src/plugins/vxe-table/index.ts +3 -3
- package/src/router/index.ts +187 -183
- package/src/router/modules/remaining.ts +58 -83
- package/src/style/vxetable.scss +30 -1
- package/src/utils/authority/index.ts +1 -1
- package/src/utils/{http → udp/http}/index.ts +8 -24
- package/src/utils/{http → udp/http}/types.d.ts +8 -5
- package/src/views/login/login-view.vue +1 -1
- package/src/views/system/menu/menuInfo.vue +7 -3
- package/src/views/system/sys/sys-config.vue +1 -1
- package/src/views/udev/dict/childView.vue +6 -1
- package/src/views/uhome/su-welcome.vue +1 -1
- package/src/views/ulogin/login.vue +3 -2
- package/src/views/upms/user/login-log.vue +1 -1
- package/src/views/urpt/design/ReportDesign.vue +3 -3
- package/types/global.d.ts +2 -1
- package/dist/Org-2oBAXN2r.js +0 -35
- package/dist/await-to-js.es5-BtRbN2QH.js +0 -10
- package/dist/index-ZdgOD7cF.js +0 -3399
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: wei.li
|
|
3
3
|
* @Date: 2021-12-23 17:33:20
|
|
4
4
|
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2025-
|
|
5
|
+
* @LastEditTime: 2025-07-31 10:15:40
|
|
6
6
|
* @Description: 个性化设置页面
|
|
7
7
|
-->
|
|
8
8
|
<script setup lang="ts">
|
|
@@ -52,7 +52,7 @@ onBeforeUnmount(() => {
|
|
|
52
52
|
<template>
|
|
53
53
|
<div :class="{ show }">
|
|
54
54
|
<div class="right-panel-background" />
|
|
55
|
-
<div ref="target" class="right-panel bg-bg_color">
|
|
55
|
+
<div ref="target" class="right-panel bg-bg_color bg-white">
|
|
56
56
|
<div
|
|
57
57
|
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
|
58
58
|
>
|
|
@@ -118,7 +118,7 @@ onBeforeUnmount(() => {
|
|
|
118
118
|
position: fixed;
|
|
119
119
|
top: 0;
|
|
120
120
|
right: 0;
|
|
121
|
-
z-index:
|
|
121
|
+
z-index: 400000;
|
|
122
122
|
width: 100%;
|
|
123
123
|
max-width: 300px;
|
|
124
124
|
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
|
package/src/main.ts
CHANGED
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: wei.li
|
|
3
|
-
* @Date: 2022-10-18 18:13:54
|
|
4
|
-
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2025-07-
|
|
6
|
-
* @Description: file content
|
|
7
|
-
*/
|
|
8
|
-
import { createApp, type Directive } from 'vue';
|
|
9
|
-
import App from './App.vue';
|
|
10
|
-
import router from './router';
|
|
11
|
-
import { setViews } from './router';
|
|
12
|
-
import { setupStore } from './store';
|
|
13
|
-
import { setConfig, setSystemEnv } from './config';
|
|
14
|
-
import { useI18n } from '../src/plugins/i18n';
|
|
15
|
-
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
16
|
-
import { injectResponsiveStorage } from './utils/storage';
|
|
17
|
-
import hasAuthority from './utils/authority';
|
|
18
|
-
import { getServiceApi, getBaseURL, setRouter } from './api';
|
|
19
|
-
|
|
20
|
-
import 'nprogress/nprogress.css';
|
|
21
|
-
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
22
|
-
import './style/tailwind.css';
|
|
23
|
-
// // 引入重置样式
|
|
24
|
-
import './style/reset.scss';
|
|
25
|
-
// 导入公共样式
|
|
26
|
-
import './style/index.scss';
|
|
27
|
-
|
|
28
|
-
import 'viewerjs/dist/viewer.css';
|
|
29
|
-
|
|
30
|
-
import VueViewer from 'v-viewer';
|
|
31
|
-
|
|
32
|
-
// import SuTable from './components/SuTable/SuTable.vue';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// UtButton,
|
|
36
|
-
// utLov2,
|
|
37
|
-
// UGrid,
|
|
38
|
-
// UtDivider,
|
|
39
|
-
|
|
40
|
-
// FormUpload2
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// UtContent,
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
import 'tippy.js/
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
app.config.globalProperties.$
|
|
69
|
-
app.config.globalProperties.$
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
app
|
|
88
|
-
app.component('
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// .component('
|
|
96
|
-
// .component('
|
|
97
|
-
|
|
98
|
-
// .component('
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-10-18 18:13:54
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2025-07-31 17:17:32
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { createApp, type Directive } from 'vue';
|
|
9
|
+
import App from './App.vue';
|
|
10
|
+
// import router from './router';
|
|
11
|
+
import { setViews } from './router';
|
|
12
|
+
import { setupStore } from './store';
|
|
13
|
+
import { setConfig, setSystemEnv } from './config';
|
|
14
|
+
import { useI18n } from '../src/plugins/i18n';
|
|
15
|
+
import { setTableConfig } from '../src/plugins/vxe-table';
|
|
16
|
+
import { injectResponsiveStorage } from './utils/storage';
|
|
17
|
+
import hasAuthority from './utils/authority';
|
|
18
|
+
import { getServiceApi, getBaseURL, setRouter } from './api';
|
|
19
|
+
|
|
20
|
+
import 'nprogress/nprogress.css';
|
|
21
|
+
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
|
22
|
+
import './style/tailwind.css';
|
|
23
|
+
// // 引入重置样式
|
|
24
|
+
import './style/reset.scss';
|
|
25
|
+
// 导入公共样式
|
|
26
|
+
import './style/index.scss';
|
|
27
|
+
|
|
28
|
+
import 'viewerjs/dist/viewer.css';
|
|
29
|
+
|
|
30
|
+
import VueViewer from 'v-viewer';
|
|
31
|
+
|
|
32
|
+
// import SuTable from './components/SuTable/SuTable.vue';
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
// UtButton,
|
|
36
|
+
// utLov2,
|
|
37
|
+
// UGrid,
|
|
38
|
+
// UtDivider,
|
|
39
|
+
UtModalForm2,
|
|
40
|
+
// FormUpload2
|
|
41
|
+
UtForm2,
|
|
42
|
+
UtGrid2,
|
|
43
|
+
// UtContent,
|
|
44
|
+
// UtCountdown2,
|
|
45
|
+
UtUpload2
|
|
46
|
+
// UtIconSelect,
|
|
47
|
+
// UtCalendar
|
|
48
|
+
// uAttachment
|
|
49
|
+
} from './components/udp';
|
|
50
|
+
|
|
51
|
+
const app = createApp(App);
|
|
52
|
+
|
|
53
|
+
// 全局注册`@iconify/vue`图标库
|
|
54
|
+
import { IconifyIconOffline, FontIcon } from './components/ReIcon';
|
|
55
|
+
// 全局注册`vue-tippy`
|
|
56
|
+
import 'tippy.js/dist/tippy.css';
|
|
57
|
+
import 'tippy.js/animations/perspective.css';
|
|
58
|
+
import VueTippy from 'vue-tippy';
|
|
59
|
+
|
|
60
|
+
app.use(VueTippy, {
|
|
61
|
+
defaultProps: { animation: 'perspective' }
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// 自定义指令
|
|
65
|
+
import * as directives from './directives';
|
|
66
|
+
|
|
67
|
+
const setGlobal = app => {
|
|
68
|
+
app.config.globalProperties.$hasAuthority = hasAuthority;
|
|
69
|
+
app.config.globalProperties.$serviceApi = getServiceApi();
|
|
70
|
+
app.config.globalProperties.$url = getBaseURL();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const setGlobalDirective = app => {
|
|
74
|
+
Object.keys(directives).forEach(key => {
|
|
75
|
+
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const init = ({ router, config, lang, views, env, tableConfig }) => {
|
|
80
|
+
setViews(views, router);
|
|
81
|
+
app.use(router);
|
|
82
|
+
setRouter(router);
|
|
83
|
+
setConfig(app, config);
|
|
84
|
+
setSystemEnv(env);
|
|
85
|
+
setTableConfig(tableConfig);
|
|
86
|
+
return new Promise(resolve => {
|
|
87
|
+
useI18n(app, lang);
|
|
88
|
+
app.component('IconifyIconOffline', IconifyIconOffline);
|
|
89
|
+
app.component('FontIcon', FontIcon);
|
|
90
|
+
// app.component('uAttachment', uAttachment).component('UGrid', UGrid);
|
|
91
|
+
// .component('UtDivider', UtDivider)
|
|
92
|
+
app.component('UtModalForm2', UtModalForm2);
|
|
93
|
+
app.component('UtGrid2', UtGrid2);
|
|
94
|
+
app.component('UtForm2', UtForm2);
|
|
95
|
+
// .component('UtContent', UtContent)
|
|
96
|
+
// .component('UtIconSelect', UtIconSelect)
|
|
97
|
+
app.component('UtUpload2', UtUpload2);
|
|
98
|
+
// .component('UtCalendar', UtCalendar)
|
|
99
|
+
// .component('UtModalGrid', UtModalGrid);
|
|
100
|
+
app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
|
|
101
|
+
setGlobal(app);
|
|
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;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: levi7754 levi7754@163.com
|
|
3
3
|
* @Date: 2024-06-05 14:32:03
|
|
4
4
|
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2025-07-
|
|
5
|
+
* @LastEditTime: 2025-07-30 09:51:55
|
|
6
6
|
* @FilePath: /udp-front/packages/udp-core/src/plugins/vxe-table/index.ts
|
|
7
7
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
8
|
*/
|
|
@@ -10,8 +10,8 @@ import 'xe-utils';
|
|
|
10
10
|
import { merge } from 'xe-utils';
|
|
11
11
|
import { geti18n, transformI18n } from '../i18n/index';
|
|
12
12
|
// import { storageLocal } from '@utogether/utils';
|
|
13
|
-
|
|
14
|
-
import { VxetableRender } from './render';
|
|
13
|
+
import { VxetableRender } from '@utogether/utils';
|
|
14
|
+
// import { VxetableRender } from './render';
|
|
15
15
|
import { getServiceApi } from '../../api';
|
|
16
16
|
|
|
17
17
|
import VXETable, { VxeUI } from 'vxe-table';
|
package/src/router/index.ts
CHANGED
|
@@ -1,183 +1,187 @@
|
|
|
1
|
-
import { findIndexOf, isEmpty } from 'xe-utils';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
export const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
export const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
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 {
|
|
7
|
+
ascending,
|
|
8
|
+
initRouter,
|
|
9
|
+
findRouteByPath,
|
|
10
|
+
formatTwoStageRoutes,
|
|
11
|
+
formatFlatteningRoutes
|
|
12
|
+
} from './utils';
|
|
13
|
+
// import { getEnv } from '../config';
|
|
14
|
+
import { kLOGINER } from '../contant';
|
|
15
|
+
|
|
16
|
+
import homeRouter from './modules/home';
|
|
17
|
+
import errorRouter from './modules/error';
|
|
18
|
+
import remainingRouter from './modules/remaining';
|
|
19
|
+
|
|
20
|
+
const systemRouter = import.meta.glob([
|
|
21
|
+
'../views/system/**/*.{vue,tsx}',
|
|
22
|
+
'../views/uapp/**/*.{vue,tsx}',
|
|
23
|
+
'../views/upms/**/*.{vue,tsx}',
|
|
24
|
+
'../views/ufile/**/*.{vue}',
|
|
25
|
+
'../views/urpt/**/*.{vue,tsx}',
|
|
26
|
+
'../views/organization/**/*.{vue,tsx}',
|
|
27
|
+
'../views/udev/**/*.{vue, tsx}'
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const remainingRouters = remainingRouter;
|
|
31
|
+
|
|
32
|
+
// 原始静态路由(未做任何处理)
|
|
33
|
+
const routes = [homeRouter, errorRouter];
|
|
34
|
+
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
|
|
35
|
+
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|
36
|
+
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
/** 用于渲染菜单,保持原始层级 */
|
|
40
|
+
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(...remainingRouter);
|
|
41
|
+
|
|
42
|
+
/** 不参与菜单的路由 */
|
|
43
|
+
export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
|
44
|
+
return remainingRouter[v].path;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** 创建路由实例 */
|
|
48
|
+
// export const router: Router = createRouter({
|
|
49
|
+
// history: createWebHistory(window.__HISTORY_PATH__),
|
|
50
|
+
// routes: constantRoutes.concat(...(remainingRouter as any)),
|
|
51
|
+
// strict: true,
|
|
52
|
+
// scrollBehavior(to, from, savedPosition) {
|
|
53
|
+
// return new Promise(resolve => {
|
|
54
|
+
// if (savedPosition) {
|
|
55
|
+
// return savedPosition;
|
|
56
|
+
// } else {
|
|
57
|
+
// if (from.meta.saveSrollTop) {
|
|
58
|
+
// const top: number = document.documentElement.scrollTop || document.body.scrollTop;
|
|
59
|
+
// resolve({ left: 0, top });
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
// });
|
|
63
|
+
// }
|
|
64
|
+
// });
|
|
65
|
+
|
|
66
|
+
/** 重置路由 */
|
|
67
|
+
export function resetRouter() {
|
|
68
|
+
router.getRoutes().forEach(route => {
|
|
69
|
+
const { name, meta } = route;
|
|
70
|
+
if (name && router.hasRoute(name) && meta?.backstage) {
|
|
71
|
+
router.removeRoute(name);
|
|
72
|
+
router.options.routes = formatTwoStageRoutes(
|
|
73
|
+
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
usePermissionStoreHook().clearAllCachePage();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let views = null;
|
|
81
|
+
export let router = null;
|
|
82
|
+
export function setViews(cviews, crouter) {
|
|
83
|
+
views = cviews;
|
|
84
|
+
router = crouter;
|
|
85
|
+
Object.assign(views, systemRouter);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getViews() {
|
|
89
|
+
return views;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 路由白名单 */
|
|
93
|
+
const whiteList = ['/login'];
|
|
94
|
+
/*
|
|
95
|
+
router.beforeEach((to: ToRouteType, _from, next) => {
|
|
96
|
+
if (to.meta?.keepAlive) {
|
|
97
|
+
handleAliveRoute(to, 'add');
|
|
98
|
+
// 页面整体刷新和点击标签页刷新
|
|
99
|
+
if (_from.name === undefined || _from.name === 'redirect') {
|
|
100
|
+
handleAliveRoute(to);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const userName = cookies.get(kLOGINER);
|
|
104
|
+
NProgress.start();
|
|
105
|
+
if (userName) {
|
|
106
|
+
routerBefore(to, _from, next);
|
|
107
|
+
} else {
|
|
108
|
+
if (to.path !== '/login') {
|
|
109
|
+
if (whiteList.indexOf(to.path) !== -1) {
|
|
110
|
+
next();
|
|
111
|
+
} else {
|
|
112
|
+
next({ path: '/login' });
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
next();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
router.afterEach(() => {
|
|
121
|
+
NProgress?.done();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
*/
|
|
125
|
+
export const routerBefore = (to, _from, next) => {
|
|
126
|
+
// TODO 无权限跳转403页面
|
|
127
|
+
// if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
|
|
128
|
+
// next({ path: "/error/403" });
|
|
129
|
+
// }
|
|
130
|
+
const userName = cookies.get(kLOGINER);
|
|
131
|
+
|
|
132
|
+
const externalLink = isUrl(to?.name as string);
|
|
133
|
+
/** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
|
|
134
|
+
function toCorrectRoute() {
|
|
135
|
+
whiteList.includes(to.fullPath) ? next(_from.fullPath) : next();
|
|
136
|
+
}
|
|
137
|
+
if (_from?.name && _from?.name !== 'login') {
|
|
138
|
+
// m.name === to.name 判断param路由跳转
|
|
139
|
+
const cmp = to.matched.find(
|
|
140
|
+
m => m.path === to.path || (m.name === to.name && to.params)
|
|
141
|
+
)?.components;
|
|
142
|
+
// 如果路由包含http 则是超链接 反之是普通路由
|
|
143
|
+
if (externalLink) {
|
|
144
|
+
openLink(to?.name as string);
|
|
145
|
+
NProgress?.done();
|
|
146
|
+
} else if (cmp?.default || to.name === 'redirect') {
|
|
147
|
+
toCorrectRoute();
|
|
148
|
+
} else {
|
|
149
|
+
next({ path: '/error/404' });
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
// 刷新
|
|
153
|
+
if (usePermissionStoreHook().wholeMenus.length === 0) {
|
|
154
|
+
initRouter(userName).then((router: Router) => {
|
|
155
|
+
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
|
156
|
+
const { path } = to;
|
|
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 = 'SuHome';
|
|
176
|
+
} else if (_from.fullPath === '/' && to.path === '/workflow/approve/index') {
|
|
177
|
+
to.path = '/welcome';
|
|
178
|
+
to.fullPath = '/welcome';
|
|
179
|
+
to.name = 'SuHome';
|
|
180
|
+
to.query = {};
|
|
181
|
+
}
|
|
182
|
+
// next();
|
|
183
|
+
toCorrectRoute();
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// export default router;
|