@utogether/udp-core 1.0.0
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/index.ts +90 -0
- package/build/plugins.ts +26 -0
- package/dist/403-B1R-4vXw.js +64 -0
- package/dist/404-fXPl8csw.js +64 -0
- package/dist/500-eI5842YB.js +66 -0
- package/dist/AuthorityInfo-CfVH6PaB.js +4 -0
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-DbK-f8jH.js +102 -0
- package/dist/AuthorityPanel-BaLMwMgW.js +4 -0
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-C_bkqLD9.js +107 -0
- package/dist/Company-CYC9Avfz.js +25 -0
- package/dist/CompanyPanel-B4MzoqN_.js +206 -0
- package/dist/DataSet-DT-rGICv.js +147 -0
- package/dist/Department-B4BNSiYx.js +25 -0
- package/dist/DepartmentPanel-zJO89L2O.js +224 -0
- package/dist/DesignPanel-S8P0J97f.js +4 -0
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-DW-_Vqrr.js +1015 -0
- package/dist/DictView-bIS5-rK-.js +95 -0
- package/dist/InvOrganization-MuM2jtsG.js +66 -0
- package/dist/Org-kXHSjsgJ.js +35 -0
- package/dist/Preview-CRyiwUIR.js +48 -0
- package/dist/ReportDefine-WZYIx8Sm.js +10 -0
- package/dist/ReportDesign-D-7GKgpb.js +165 -0
- package/dist/ReportQuery-BIIJny6w.js +75 -0
- package/dist/ReportQueryFrom-OoUl7N2O.js +4 -0
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-B878fgj8.js +177 -0
- package/dist/ReportTemplate-Cfeq9US-.js +161 -0
- package/dist/Role-BwTV2QMH.js +25 -0
- package/dist/RoleAssign-De1JjOun.js +26 -0
- package/dist/RolePanel-E3RcdByM.js +4 -0
- package/dist/RolePanel-pUBXsqCM.js +4 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-B2pQwHb0.js +148 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CTIad9_Q.js +126 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-vMR1fBi0.js +100 -0
- package/dist/Staff-Czm7A8vI.js +25 -0
- package/dist/StaffInfo-DJzvBuxy.js +4 -0
- package/dist/StaffInfo.vue_vue_type_style_index_0_lang-DMTL7KCh.js +108 -0
- package/dist/StaffPanel-CHk60LEz.js +4 -0
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-iPKLb5wG.js +114 -0
- package/dist/SysUser-BGwbttRn.js +15 -0
- package/dist/SysUserPanel-BCbKoLKt.js +4 -0
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-0QUjnhjF.js +289 -0
- package/dist/SystemMenu-BkqZSDKl.js +151 -0
- package/dist/UserInfo-BsyAcT2d.js +4 -0
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-D0-KDxAh.js +158 -0
- package/dist/await-to-js.es5-BtRbN2QH.js +10 -0
- package/dist/childView-CF83nhxb.js +4 -0
- package/dist/childView-CyuLTUqC.js +4 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-CNSgGda3.js +187 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-Cch4lE-i.js +144 -0
- package/dist/code-rule-Bz-gnktN.js +147 -0
- package/dist/core.es.js +13 -0
- package/dist/core.umd.js +173 -0
- package/dist/cron-task-CIifSUdW.js +135 -0
- package/dist/frameView-_d2mqjjQ.js +43 -0
- package/dist/img/l_img.svg +1 -0
- package/dist/img/minicolors.png +0 -0
- package/dist/img/v_img.svg +1 -0
- package/dist/index-BKIw8tSn.js +9195 -0
- package/dist/layoutView-DLKVepB8.js +3317 -0
- package/dist/log-in-e7D5Ss1P.js +110 -0
- package/dist/log-out--RRncZhN.js +120 -0
- package/dist/login-LREiDfFU.js +251 -0
- package/dist/login-log-CvVnyGi3.js +68 -0
- package/dist/lov-view-DDrIVILB.js +97 -0
- package/dist/menuInfo-B1FUV-Sk.js +4 -0
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-Cnk3vdtD.js +338 -0
- package/dist/pda-app-CRhVGijN.js +2209 -0
- package/dist/redirect-DiaNDu8F.js +15 -0
- package/dist/resource-BCwx9fEv.js +97 -0
- package/dist/su-welcome-189A7N4r.js +526 -0
- package/dist/sys-config-BZ3sejow.js +277 -0
- package/dist/udp-core.css +9 -0
- package/dist/utogether-r08LNiIZ.js +182 -0
- package/index.ts +36 -0
- package/package.json +16 -0
- package/public/img/l_img.svg +1 -0
- package/public/img/minicolors.png +0 -0
- package/public/img/v_img.svg +1 -0
- package/src/App.vue +70 -0
- package/src/api/http.ts +50 -0
- package/src/api/index.ts +31 -0
- package/src/api/mock.ts +20 -0
- package/src/api/user.ts +43 -0
- package/src/assets/images/avatars.jpg +0 -0
- package/src/assets/images/empty.png +0 -0
- package/src/assets/images/login.png +0 -0
- package/src/assets/images/logo.png +0 -0
- package/src/assets/images/mask-text.jpg +0 -0
- package/src/assets/images/minicolors.png +0 -0
- package/src/assets/images/utogether.png +0 -0
- package/src/assets/images/welcome.png +0 -0
- package/src/assets/status/403.svg +1 -0
- package/src/assets/status/404.svg +1 -0
- package/src/assets/status/500.svg +1 -0
- package/src/assets/svg/back_top.svg +1 -0
- package/src/assets/svg/bg.svg +1 -0
- package/src/assets/svg/close.svg +1 -0
- package/src/assets/svg/close_all.svg +1 -0
- package/src/assets/svg/close_left.svg +1 -0
- package/src/assets/svg/close_other.svg +1 -0
- package/src/assets/svg/close_right.svg +1 -0
- package/src/assets/svg/dark.svg +1 -0
- package/src/assets/svg/day.svg +1 -0
- package/src/assets/svg/enter_outlined.svg +1 -0
- package/src/assets/svg/exit_screen.svg +1 -0
- package/src/assets/svg/full_screen.svg +1 -0
- package/src/assets/svg/globalization.svg +1 -0
- package/src/assets/svg/loading.svg +17 -0
- package/src/assets/svg/mdi_keyboard_esc.svg +1 -0
- package/src/assets/svg/refresh.svg +1 -0
- package/src/assets/svg/system.svg +1 -0
- package/src/components/ReCountTo/README.md +2 -0
- package/src/components/ReCountTo/index.ts +18 -0
- package/src/components/ReCountTo/src/normal/index.tsx +165 -0
- package/src/components/ReCountTo/src/normal/props.ts +37 -0
- package/src/components/ReCountTo/src/rebound/index.tsx +67 -0
- package/src/components/ReCountTo/src/rebound/props.ts +14 -0
- package/src/components/ReCountTo/src/rebound/rebound.css +77 -0
- package/src/components/ReCropper/index.ts +14 -0
- package/src/components/ReCropper/src/index.tsx +141 -0
- package/src/components/ReFlicker/index.css +39 -0
- package/src/components/ReFlicker/index.ts +50 -0
- package/src/components/ReFlop/index.ts +14 -0
- package/src/components/ReFlop/src/Filpper.tsx +99 -0
- package/src/components/ReFlop/src/filpper.css +184 -0
- package/src/components/ReFlop/src/index.vue +126 -0
- package/src/components/ReFlowChart/index.ts +24 -0
- package/src/components/ReFlowChart/src/Control.vue +139 -0
- package/src/components/ReFlowChart/src/DataDialog.vue +12 -0
- package/src/components/ReFlowChart/src/NodePanel.vue +151 -0
- package/src/components/ReFlowChart/src/adpterForTurbo.ts +160 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.css +49 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.eot +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.js +61 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.json +58 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.svg +47 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff +0 -0
- package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/components/ReFlowChart/src/config.ts +62 -0
- package/src/components/ReIcon/index.ts +12 -0
- package/src/components/ReIcon/src/Icon.vue +81 -0
- package/src/components/ReIcon/src/hooks.ts +63 -0
- package/src/components/ReIcon/src/iconfont.ts +45 -0
- package/src/components/ReIcon/src/iconifyIconOffline.ts +36 -0
- package/src/components/ReIcon/src/iconifyIconOnline.ts +28 -0
- package/src/components/ReIcon/src/offlineIcon.ts +64 -0
- package/src/components/ReIcon/src/types.ts +20 -0
- package/src/components/ReSplitPane/index.css +49 -0
- package/src/components/ReSplitPane/index.tsx +119 -0
- package/src/components/ReSplitPane/resizer.css +45 -0
- package/src/components/ReSplitPane/resizer.tsx +30 -0
- package/src/components/SuCharts/index.ts +36 -0
- package/src/components/SuCharts/src/EchartBar.vue +134 -0
- package/src/components/SuCharts/src/UserInfo.vue +78 -0
- package/src/components/SuCharts/src/echart-line.vue +85 -0
- package/src/components/SuCharts/src/echart-pie.vue +95 -0
- package/src/components/SuCommon/card/components/Card.vue +148 -0
- package/src/components/SuCommon/card/components/DialogForm.vue +127 -0
- package/src/components/SuCommon/card/index.vue +142 -0
- package/src/components/SuCommon/icon-select/index.vue +241 -0
- package/src/components/SuCommon/table/index.vue +208 -0
- package/src/components/SuCommon/utils/index.ts +103 -0
- package/src/components/SuCommon/utils/slot.tsx +50 -0
- package/src/components/SuFloatButton/index.vue +159 -0
- package/src/components/SuQrcode/index.ts +14 -0
- package/src/components/SuQrcode/src/index.scss +9 -0
- package/src/components/SuQrcode/src/index.tsx +236 -0
- package/src/components/SuScrollTree/ScrollPanel.vue +175 -0
- package/src/components/SuTable/SuTable.vue +334 -0
- package/src/components/SuTypeit/index.ts +51 -0
- package/src/config/index.ts +35 -0
- package/src/contant/index.ts +20 -0
- package/src/directives/elResizeDetector/index.ts +33 -0
- package/src/directives/index.ts +11 -0
- package/src/directives/permission/index.ts +29 -0
- package/src/layout/components/lay-chrome/index.vue +30 -0
- package/src/layout/components/lay-content/index.vue +143 -0
- package/src/layout/components/lay-navbar/index.vue +237 -0
- package/src/layout/components/lay-notice/data.ts +59 -0
- package/src/layout/components/lay-notice/index.vue +83 -0
- package/src/layout/components/lay-notice/noticeItem.vue +160 -0
- package/src/layout/components/lay-notice/noticeList.vue +19 -0
- package/src/layout/components/lay-panel/index.vue +150 -0
- package/src/layout/components/lay-search/components/SearchFooter.vue +67 -0
- package/src/layout/components/lay-search/components/SearchModal.vue +189 -0
- package/src/layout/components/lay-search/components/SearchResult.vue +132 -0
- package/src/layout/components/lay-search/components/index.ts +10 -0
- package/src/layout/components/lay-search/index.vue +25 -0
- package/src/layout/components/lay-select-org/index.vue +69 -0
- package/src/layout/components/lay-setting/index.vue +510 -0
- package/src/layout/components/lay-sidebar/breadCrumb.vue +131 -0
- package/src/layout/components/lay-sidebar/extraIcon.vue +25 -0
- package/src/layout/components/lay-sidebar/hamBurger.vue +72 -0
- package/src/layout/components/lay-sidebar/horizontal.vue +191 -0
- package/src/layout/components/lay-sidebar/mixNav.vue +258 -0
- package/src/layout/components/lay-sidebar/sidebar-logo.vue +98 -0
- package/src/layout/components/lay-sidebar/sidebarItem.vue +205 -0
- package/src/layout/components/lay-sidebar/vertical.vue +94 -0
- package/src/layout/components/lay-tag/index.scss +375 -0
- package/src/layout/components/lay-tag/index.vue +625 -0
- package/src/layout/frameView.vue +71 -0
- package/src/layout/hooks/useBoolean.ts +33 -0
- package/src/layout/hooks/useDataThemeChange.ts +142 -0
- package/src/layout/hooks/useLayout.ts +65 -0
- package/src/layout/hooks/useNav.ts +173 -0
- package/src/layout/hooks/useTag.ts +233 -0
- package/src/layout/hooks/useTranslationLang.ts +51 -0
- package/src/layout/layoutView.vue +215 -0
- package/src/layout/redirect.vue +30 -0
- package/src/layout/routerView/parent.vue +23 -0
- package/src/layout/types.ts +92 -0
- package/src/main.ts +108 -0
- package/src/plugins/echarts/index.ts +58 -0
- package/src/plugins/echarts/theme.json +394 -0
- package/src/plugins/i18n/en.ts +289 -0
- package/src/plugins/i18n/index.ts +76 -0
- package/src/plugins/i18n/module/u-report.ts +64 -0
- package/src/plugins/i18n/module/u-workflow.ts +71 -0
- package/src/plugins/i18n/module/umsg.ts +28 -0
- package/src/plugins/i18n/zh.ts +337 -0
- package/src/plugins/vxe-table/index.ts +46 -0
- package/src/plugins/vxe-table/render.tsx +397 -0
- package/src/router/createComponent.tsx +25 -0
- package/src/router/index.ts +183 -0
- package/src/router/modules/error.ts +32 -0
- package/src/router/modules/home.ts +32 -0
- package/src/router/modules/nested.ts +93 -0
- package/src/router/modules/remaining.ts +83 -0
- package/src/router/modules/tabs.ts +55 -0
- package/src/router/utils.ts +377 -0
- package/src/store/index.ts +9 -0
- package/src/store/modules/app.ts +69 -0
- package/src/store/modules/epTheme.ts +49 -0
- package/src/store/modules/multiTags.ts +109 -0
- package/src/store/modules/permission.ts +103 -0
- package/src/store/modules/settings.ts +40 -0
- package/src/store/modules/system.ts +180 -0
- package/src/store/modules/types.ts +49 -0
- package/src/style/button.scss +78 -0
- package/src/style/clear-mixin.scss +28 -0
- package/src/style/dark.scss +218 -0
- package/src/style/element-plus.scss +206 -0
- package/src/style/index.scss +76 -0
- package/src/style/login.css +336 -0
- package/src/style/login2.css +106 -0
- package/src/style/print-lock.css +375 -0
- package/src/style/reset.scss +272 -0
- package/src/style/sidebar.scss +770 -0
- package/src/style/suprint.css +985 -0
- package/src/style/tailwind.css +68 -0
- package/src/style/theme.scss +143 -0
- package/src/style/transition.scss +42 -0
- package/src/style/vxetable.scss +256 -0
- package/src/utils/authority/index.ts +29 -0
- package/src/utils/browers.ts +59 -0
- package/src/utils/dataFormat/index.ts +223 -0
- package/src/utils/http/index.ts +297 -0
- package/src/utils/http/types.d.ts +46 -0
- package/src/utils/index.ts +47 -0
- package/src/utils/lifecycle.ts +20 -0
- package/src/utils/mitt.ts +19 -0
- package/src/utils/propTypes.ts +47 -0
- package/src/utils/storage/index.ts +51 -0
- package/src/views/components/contextmenu/basic.vue +74 -0
- package/src/views/components/contextmenu/context-menu.vue +40 -0
- package/src/views/components/contextmenu/menuDynamic.vue +99 -0
- package/src/views/components/contextmenu/menuGroup.vue +71 -0
- package/src/views/components/count-to/index.vue +43 -0
- package/src/views/components/cropping/index.vue +59 -0
- package/src/views/components/cropping/picture.jpeg +0 -0
- package/src/views/components/split-pane/index.vue +82 -0
- package/src/views/components/video/index.vue +57 -0
- package/src/views/error/403.vue +50 -0
- package/src/views/error/404.vue +50 -0
- package/src/views/error/500.vue +52 -0
- package/src/views/login/login-view.vue +314 -0
- package/src/views/login/utils/motion.ts +47 -0
- package/src/views/login/utils/rule.ts +70 -0
- package/src/views/login/utils/verifyCode.ts +52 -0
- package/src/views/organization/company/Company.vue +56 -0
- package/src/views/organization/company/CompanyPanel.vue +259 -0
- package/src/views/organization/department/Department.vue +58 -0
- package/src/views/organization/department/DepartmentPanel.vue +283 -0
- package/src/views/organization/inv-org/InvOrganization.vue +53 -0
- package/src/views/organization/org/Org.vue +43 -0
- package/src/views/organization/staff/Staff.vue +58 -0
- package/src/views/organization/staff/StaffInfo.vue +163 -0
- package/src/views/organization/staff/StaffPanel.vue +144 -0
- package/src/views/system/cron/cron-task.vue +157 -0
- package/src/views/system/menu/AuthorityPanel.vue +140 -0
- package/src/views/system/menu/SystemMenu.vue +191 -0
- package/src/views/system/menu/menuInfo.vue +368 -0
- package/src/views/system/role/AuthorityInfo.vue +147 -0
- package/src/views/system/role/Role.vue +57 -0
- package/src/views/system/role/RolePanel.vue +191 -0
- package/src/views/system/role/UserInfo.vue +193 -0
- package/src/views/system/role-assign/RoleAssign.vue +57 -0
- package/src/views/system/role-assign/RolePanel.vue +136 -0
- package/src/views/system/sys/sys-config.vue +291 -0
- package/src/views/system/sysUser/SysUser.vue +45 -0
- package/src/views/system/sysUser/SysUserPanel.vue +278 -0
- package/src/views/uapp/pda/pda-app.vue +176 -0
- package/src/views/udev/coderule/code-rule.vue +121 -0
- package/src/views/udev/dict/DictView.vue +106 -0
- package/src/views/udev/dict/childView.vue +222 -0
- package/src/views/udev/lov/childView.vue +180 -0
- package/src/views/udev/lov/lov-view.vue +91 -0
- package/src/views/ufile/aggregation/File.vue +87 -0
- package/src/views/ufile/file/water-mark.vue +103 -0
- package/src/views/uhome/components/menu-favorite.vue +331 -0
- package/src/views/uhome/su-welcome.vue +339 -0
- package/src/views/ulogin/login.vue +316 -0
- package/src/views/umsg/monitor/msg-monitor.vue +36 -0
- package/src/views/umsg/msg/TemplateContent.vue +103 -0
- package/src/views/umsg/msg/msg-template.vue +66 -0
- package/src/views/umsg/send/childView.vue +142 -0
- package/src/views/umsg/send/msg-send.vue +95 -0
- package/src/views/upms/interface/log-in.vue +106 -0
- package/src/views/upms/interface/log-out.vue +107 -0
- package/src/views/upms/user/login-log.vue +60 -0
- package/src/views/urpt/dataSet/DataSet.vue +139 -0
- package/src/views/urpt/design/DesignPanel.vue +526 -0
- package/src/views/urpt/design/Preview.vue +65 -0
- package/src/views/urpt/design/ReportDesign.vue +249 -0
- package/src/views/urpt/design/bg.png +0 -0
- package/src/views/urpt/design/panel.ts +841 -0
- package/src/views/urpt/design/print-data.ts +59 -0
- package/src/views/urpt/query/ReportQuery.vue +122 -0
- package/src/views/urpt/query/ReportQueryFrom.vue +252 -0
- package/src/views/urpt/report-request/ReportDefine.vue +10 -0
- package/src/views/urpt/static-resource/resource.vue +116 -0
- package/src/views/urpt/template/ReportTemplate.vue +198 -0
- package/tsconfig.json +30 -0
- package/types/env.d.ts +1 -0
- package/types/global-components.d.ts +12 -0
- package/types/global.d.ts +236 -0
- package/types/image.d.ts +7 -0
- package/types/index.d.ts +73 -0
- package/types/router.d.ts +107 -0
- package/types/shims-tsx.d.ts +22 -0
- package/types/shims-vue.d.ts +20 -0
- package/vite.config.ts +73 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2021-12-23 17:33:20
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2023-10-10 11:26:23
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
const Layout = () => import('@/layout/layoutView.vue');
|
|
9
|
+
const nestedRouter: RouteConfigsTable = {
|
|
10
|
+
path: '/nested',
|
|
11
|
+
component: Layout,
|
|
12
|
+
redirect: '/nested/menu1/menu1-1',
|
|
13
|
+
name: 'Nested',
|
|
14
|
+
meta: {
|
|
15
|
+
title: 'message.sumenus',
|
|
16
|
+
icon: 'histogram',
|
|
17
|
+
rank: 102
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
path: '/nested/menu1',
|
|
22
|
+
name: 'Menu1',
|
|
23
|
+
meta: {
|
|
24
|
+
title: 'message.hsmenu1',
|
|
25
|
+
extraIcon: 'ri-rocket-line',
|
|
26
|
+
keepAlive: true
|
|
27
|
+
},
|
|
28
|
+
redirect: '/nested/menu1/menu1-1',
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
path: '/nested/menu1/menu1-1',
|
|
32
|
+
component: () => import('@/views/nested/menu1/menu1-1/index.vue'),
|
|
33
|
+
name: 'Menu1-1',
|
|
34
|
+
meta: {
|
|
35
|
+
title: 'message.hsmenu1-1',
|
|
36
|
+
keepAlive: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: '/nested/menu1/menu1-2',
|
|
41
|
+
component: () => import('@/layout/routerView/parent.vue'),
|
|
42
|
+
name: 'Menu1-2',
|
|
43
|
+
redirect: '/nested/menu1/menu1-2/menu1-2-1',
|
|
44
|
+
meta: {
|
|
45
|
+
title: 'message.hsmenu1-2',
|
|
46
|
+
keepAlive: true
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
{
|
|
50
|
+
path: '/nested/menu1/menu1-2/menu1-2-1',
|
|
51
|
+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1/index.vue'),
|
|
52
|
+
name: 'Menu1-2-1',
|
|
53
|
+
meta: {
|
|
54
|
+
title: 'message.hsmenu1-2-1',
|
|
55
|
+
keepAlive: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
path: '/nested/menu1/menu1-2/menu1-2-2',
|
|
60
|
+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2/index.vue'),
|
|
61
|
+
name: 'Menu1-2-2',
|
|
62
|
+
meta: {
|
|
63
|
+
title: 'message.hsmenu1-2-2',
|
|
64
|
+
keepAlive: true,
|
|
65
|
+
extraIcon: 'team-iconxinpinrenqiwang'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
path: '/nested/menu1/menu1-3',
|
|
72
|
+
component: () => import('@/views/nested/menu1/menu1-3/index.vue'),
|
|
73
|
+
name: 'Menu1-3',
|
|
74
|
+
meta: {
|
|
75
|
+
title: 'message.hsmenu1-3',
|
|
76
|
+
keepAlive: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: '/nested/menu2',
|
|
83
|
+
name: 'Menu2',
|
|
84
|
+
component: () => import('@/views/nested/menu2/index.vue'),
|
|
85
|
+
meta: {
|
|
86
|
+
title: 'message.hsmenu2',
|
|
87
|
+
keepAlive: true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default nestedRouter;
|
|
@@ -0,0 +1,83 @@
|
|
|
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;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2023-10-10 11:31:53
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2023-10-10 14:21:59
|
|
6
|
+
* @FilePath: /sitzone-mes/src/router/modules/tabs.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
const Layout = () => import('@/layout/layoutView.vue');
|
|
10
|
+
|
|
11
|
+
const tabsRouter: RouteConfigsTable = {
|
|
12
|
+
component: Layout,
|
|
13
|
+
path: '/tabs',
|
|
14
|
+
meta: {
|
|
15
|
+
icon: 'IF-pure-iconfont-tabs',
|
|
16
|
+
title: 'message.sutabs'
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
{
|
|
20
|
+
path: '/tabs/index',
|
|
21
|
+
name: 'Tabs',
|
|
22
|
+
component: () => import('@/views/tabs/index.vue'),
|
|
23
|
+
meta: {
|
|
24
|
+
extraIcon: 'ri-calendar-2-line',
|
|
25
|
+
title: 'message.sutabs'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// query 传参模式
|
|
29
|
+
{
|
|
30
|
+
path: '/tabs/query-detail',
|
|
31
|
+
name: 'TabQueryDetail',
|
|
32
|
+
component: () => import('@/views/tabs/query-detail.vue'),
|
|
33
|
+
meta: {
|
|
34
|
+
// 不在menu菜单中显示
|
|
35
|
+
title: '',
|
|
36
|
+
showLink: false,
|
|
37
|
+
activePath: '/tabs/index'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
// params 传参模式
|
|
41
|
+
{
|
|
42
|
+
path: '/tabs/params-detail/:id',
|
|
43
|
+
component: () => import('@/views/tabs/params-detail.vue'),
|
|
44
|
+
// component: 'params-detail',
|
|
45
|
+
name: 'TabParamsDetail',
|
|
46
|
+
meta: {
|
|
47
|
+
title: '',
|
|
48
|
+
// 不在menu菜单中显示
|
|
49
|
+
showLink: false,
|
|
50
|
+
activePath: '/tabs/index'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
export default tabsRouter;
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import type { RouteRecordRaw, RouteComponent } from 'vue-router';
|
|
2
|
+
import { isProxy, toRaw, defineAsyncComponent } from 'vue';
|
|
3
|
+
import { useTimeoutFn } from '@vueuse/core';
|
|
4
|
+
import { storageLocal, buildHierarchyTree, dbstorage } from '@utogether/utils';
|
|
5
|
+
import { clone } from 'xe-utils';
|
|
6
|
+
import { router, getViews } from './index';
|
|
7
|
+
import { getConfig } from '../config';
|
|
8
|
+
import { geti18n } from '../plugins/i18n';
|
|
9
|
+
import { routerArrays } from '../layout/types';
|
|
10
|
+
import { usePermissionStoreHook } from '../store/modules/permission';
|
|
11
|
+
import { useSystemStoreHook } from '../store/modules/system';
|
|
12
|
+
import { useMultiTagsStoreHook } from '../store/modules/multiTags';
|
|
13
|
+
import { getServiceApi } from '../api';
|
|
14
|
+
import createComponent from './createComponent';
|
|
15
|
+
|
|
16
|
+
const Layout = () => import('../layout/layoutView.vue');
|
|
17
|
+
const IFrame = () => import('../layout/frameView.vue');
|
|
18
|
+
|
|
19
|
+
// 动态路由
|
|
20
|
+
import { initDict, initSystemInfo, getAsyncRoutes } from '../api/user';
|
|
21
|
+
// https://cn.vitejs.dev/guide/features.html#glob-import
|
|
22
|
+
// const modulesRoutes = import.meta.glob('/src/views/**/*.{vue,tsx}');
|
|
23
|
+
|
|
24
|
+
// 菜单类型
|
|
25
|
+
enum MenuCategoty {
|
|
26
|
+
Menu = '5', // 菜单
|
|
27
|
+
Lowcode = '10' // 低代码
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 按照路由中meta下的rank等级升序来排序路由 */
|
|
31
|
+
function ascending(arr: any[]) {
|
|
32
|
+
arr.forEach(v => {
|
|
33
|
+
if (v?.meta?.rank === null) v.meta.rank = undefined;
|
|
34
|
+
if (v?.meta?.rank === 0) {
|
|
35
|
+
if (v.name !== 'home' && v.path !== '/') {
|
|
36
|
+
console.warn('rank only the home page can be 0');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return arr.sort((a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
|
41
|
+
return a?.meta?.rank - b?.meta?.rank;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 过滤meta中showLink为false的菜单 */
|
|
46
|
+
function filterTree(data: RouteComponent[]) {
|
|
47
|
+
const newTree = clone(data, true).filter(
|
|
48
|
+
(v: { meta: { showLink: boolean } }) => v && v.meta?.showLink !== false
|
|
49
|
+
);
|
|
50
|
+
newTree.forEach((v: { children }) => v.children && (v.children = filterTree(v.children)));
|
|
51
|
+
return newTree;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 通过指定 `key` 获取父级路径集合,默认 `key` 为 `path` */
|
|
55
|
+
function getParentPaths(value: string, routes: RouteRecordRaw[], key = 'path') {
|
|
56
|
+
// 深度遍历查找
|
|
57
|
+
function dfs(routes: RouteRecordRaw[], value: string, parents: string[]) {
|
|
58
|
+
for (let i = 0; i < routes.length; i++) {
|
|
59
|
+
const item = routes[i];
|
|
60
|
+
// 找到path则返回父级path
|
|
61
|
+
// if (item[key] === value) {
|
|
62
|
+
// return parents.length ? parents : routes[0];
|
|
63
|
+
// }
|
|
64
|
+
if (item[key] === value) return parents;
|
|
65
|
+
// children不存在或为空则不递归
|
|
66
|
+
if (!item.children || !item.children.length) continue;
|
|
67
|
+
// 往下查找时将当前path入栈
|
|
68
|
+
parents.push(item.path);
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
if (dfs(item.children, value, parents).length) return parents;
|
|
71
|
+
// 深度遍历查找未找到时当前path 出栈
|
|
72
|
+
parents.pop();
|
|
73
|
+
}
|
|
74
|
+
// 未找到时返回空数组
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return dfs(routes, value, []);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** 查找对应 `path` 的路由信息 */
|
|
82
|
+
function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
|
|
83
|
+
let res = routes.find((item: { path: string }) => item.path == path);
|
|
84
|
+
if (res) {
|
|
85
|
+
return isProxy(res) ? toRaw(res) : res;
|
|
86
|
+
} else {
|
|
87
|
+
for (let i = 0; i < routes.length; i++) {
|
|
88
|
+
if (routes[i].children instanceof Array && routes[i].children.length > 0) {
|
|
89
|
+
res = findRouteByPath(path, routes[i].children);
|
|
90
|
+
if (res) {
|
|
91
|
+
return isProxy(res) ? toRaw(res) : res;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function addPathMatch() {
|
|
99
|
+
if (!router.hasRoute('pathMatch')) {
|
|
100
|
+
router.addRoute({
|
|
101
|
+
path: '/:pathMatch(.*)',
|
|
102
|
+
name: 'pathMatch',
|
|
103
|
+
redirect: '/error/404'
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @description: 添加审批动态路由
|
|
110
|
+
* @param {*} syncRoutes 异步获取的路由表数据
|
|
111
|
+
* @param {*} routes 格式化后的路由表数据
|
|
112
|
+
* @return {*} 格式化后的路由表数据
|
|
113
|
+
*/
|
|
114
|
+
// function addWorkflowRouter(syncRoutes, routes) {
|
|
115
|
+
// const flowIdx = syncRoutes.findIndex(f => f.menuCode === 'Workflow');
|
|
116
|
+
// const isExit = flowIdx !== -1 && syncRoutes[flowIdx].children?.some(s => s.name === 'workflowApprove');
|
|
117
|
+
// if (!isExit) {
|
|
118
|
+
// flowIdx !== -1 && routes[flowIdx].children?.push(workflowRouter);
|
|
119
|
+
// }
|
|
120
|
+
// return routes;
|
|
121
|
+
// }
|
|
122
|
+
// 菜单国家化
|
|
123
|
+
function setMenui18n() {
|
|
124
|
+
const i18n = geti18n();
|
|
125
|
+
i18n.global?.mergeLocaleMessage('zh', menuI18n.zh);
|
|
126
|
+
i18n.global?.mergeLocaleMessage('en', menuI18n.en);
|
|
127
|
+
storageLocal.setItem('menu_zh', menuI18n.zh);
|
|
128
|
+
storageLocal.setItem('menu_en', menuI18n.en);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function handleAsyncRoutes(routesList) {
|
|
132
|
+
if (routesList?.length) {
|
|
133
|
+
const idx = routesList.findIndex(f => f.menuCode === 'SysHome');
|
|
134
|
+
if (idx !== -1) {
|
|
135
|
+
// 仪表盘报表
|
|
136
|
+
const dashboardTabs = [];
|
|
137
|
+
const homeMenus = [];
|
|
138
|
+
routesList[idx].children.forEach(child => {
|
|
139
|
+
if (child.menuCategory !== '1') {
|
|
140
|
+
dashboardTabs.push(child);
|
|
141
|
+
} else {
|
|
142
|
+
homeMenus.push(child);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
routesList[idx].children = homeMenus;
|
|
146
|
+
useSystemStoreHook().setHomeMenus(dashboardTabs);
|
|
147
|
+
}
|
|
148
|
+
const routes = clone(addAsyncRoutes(routesList), true);
|
|
149
|
+
|
|
150
|
+
// routes = addWorkflowRouter(routesList, routes);
|
|
151
|
+
setMenui18n();
|
|
152
|
+
formatFlatteningRoutes(routes).map((v: RouteRecordRaw) => {
|
|
153
|
+
// 菜单国际化
|
|
154
|
+
// 防止重复添加路由
|
|
155
|
+
const { options } = router;
|
|
156
|
+
if (options.routes[0].children.findIndex(value => value.path === v.path) !== -1) {
|
|
157
|
+
return;
|
|
158
|
+
} else {
|
|
159
|
+
// 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转
|
|
160
|
+
router.options.routes[0].children.push(v);
|
|
161
|
+
// 最终路由进行升序
|
|
162
|
+
ascending(router.options.routes[0].children);
|
|
163
|
+
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
usePermissionStoreHook().changeSetting(routesList);
|
|
168
|
+
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
|
169
|
+
useMultiTagsStoreHook().handleTags('equal', [
|
|
170
|
+
...routerArrays,
|
|
171
|
+
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
174
|
+
addPathMatch();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
|
|
178
|
+
async function initRouter(userName) {
|
|
179
|
+
let asyncRouteList = [];
|
|
180
|
+
const key = `U-${userName}-ROUTES`;
|
|
181
|
+
// 开启动态路由缓存本地
|
|
182
|
+
if (getConfig().CachingAsyncRoutes) {
|
|
183
|
+
await dbstorage.getItem(key).then(data => (asyncRouteList = data));
|
|
184
|
+
}
|
|
185
|
+
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
186
|
+
await initSystemInfo().then(async (res: IRecord) => {
|
|
187
|
+
useSystemStoreHook().setSystemInfo(res);
|
|
188
|
+
await getServiceApi()
|
|
189
|
+
.get('/uums/cusOrganization', { pageSize: 100, pageNum: 1, orgId: res.orgId })
|
|
190
|
+
.then((res: IResponseData) => useSystemStoreHook().setInvOrgList(res?.list || []));
|
|
191
|
+
});
|
|
192
|
+
if (asyncRouteList?.length) {
|
|
193
|
+
return new Promise(resolve => {
|
|
194
|
+
handleAsyncRoutes(asyncRouteList);
|
|
195
|
+
// 缓存最新的路由
|
|
196
|
+
getAsyncRoutes({ userName }).then((data: any) => {
|
|
197
|
+
dbstorage.setItem(key, data);
|
|
198
|
+
});
|
|
199
|
+
resolve(router);
|
|
200
|
+
});
|
|
201
|
+
} else {
|
|
202
|
+
return new Promise(resolve => {
|
|
203
|
+
getAsyncRoutes({ userName }).then((data: any) => {
|
|
204
|
+
handleAsyncRoutes(clone(data, true));
|
|
205
|
+
dbstorage.setItem(key, data);
|
|
206
|
+
resolve(router);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 将多级嵌套路由处理成一维数组
|
|
214
|
+
* @param routesList 传入路由
|
|
215
|
+
* @returns 返回处理后的一维路由
|
|
216
|
+
*/
|
|
217
|
+
function formatFlatteningRoutes(routesList: RouteRecordRaw[]) {
|
|
218
|
+
if (routesList.length === 0) return routesList;
|
|
219
|
+
let hierarchyList = buildHierarchyTree(routesList);
|
|
220
|
+
for (let i = 0; i < hierarchyList.length; i++) {
|
|
221
|
+
if (hierarchyList[i].children) {
|
|
222
|
+
hierarchyList = hierarchyList
|
|
223
|
+
.slice(0, i + 1)
|
|
224
|
+
.concat(hierarchyList[i].children, hierarchyList.slice(i + 1));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return hierarchyList;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* 一维数组处理成多级嵌套数组(三级及以上的路由全部拍成二级,keep-alive 只支持到二级缓存)
|
|
232
|
+
* @param routesList 处理后的一维路由菜单数组
|
|
233
|
+
* @returns 返回将一维数组重新处理成规定路由的格式
|
|
234
|
+
*/
|
|
235
|
+
function formatTwoStageRoutes(routesList: RouteRecordRaw[]) {
|
|
236
|
+
if (routesList.length === 0) return routesList;
|
|
237
|
+
const newRoutesList: RouteRecordRaw[] = [];
|
|
238
|
+
routesList.forEach((v: RouteRecordRaw) => {
|
|
239
|
+
if (v.path === '/') {
|
|
240
|
+
newRoutesList.push({
|
|
241
|
+
component: v.component,
|
|
242
|
+
name: v.name,
|
|
243
|
+
path: v.path,
|
|
244
|
+
redirect: v.redirect,
|
|
245
|
+
meta: v.meta,
|
|
246
|
+
children: []
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
newRoutesList[0].children.push({ ...v });
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return newRoutesList;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** 处理缓存路由(添加、删除、刷新) */
|
|
256
|
+
function handleAliveRoute({ name }: ToRouteType, mode?: string) {
|
|
257
|
+
switch (mode) {
|
|
258
|
+
case 'add':
|
|
259
|
+
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
260
|
+
break;
|
|
261
|
+
case 'delete':
|
|
262
|
+
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
263
|
+
break;
|
|
264
|
+
case 'refresh':
|
|
265
|
+
usePermissionStoreHook().cacheOperate({ mode: 'refresh', name });
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
269
|
+
useTimeoutFn(() => {
|
|
270
|
+
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
271
|
+
}, 100);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** 过滤后端传来的动态路由 重新生成规范路由 */
|
|
276
|
+
const menuI18n = {
|
|
277
|
+
zh: {},
|
|
278
|
+
en: {}
|
|
279
|
+
};
|
|
280
|
+
const addAsyncRoutes = (arrRoutes: Array<any>) => {
|
|
281
|
+
const modulesRoutes = getViews();
|
|
282
|
+
|
|
283
|
+
if (!arrRoutes || !arrRoutes.length) return;
|
|
284
|
+
const modulesRoutesKeys = Object.keys(modulesRoutes);
|
|
285
|
+
for (let i = 0; i < arrRoutes.length; i++) {
|
|
286
|
+
const v = arrRoutes[i];
|
|
287
|
+
|
|
288
|
+
if (v?.children && v.children.length && !v.redirect) {
|
|
289
|
+
// 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值
|
|
290
|
+
v.redirect = v.children[0].path;
|
|
291
|
+
}
|
|
292
|
+
const { icon, permissionCode, extraIcon, frameSrc } = v;
|
|
293
|
+
v.meta = { keepAlive: true, rank: v.sort, title: `${v.i18nField}` };
|
|
294
|
+
Object.assign(v.meta, { icon, permissionCode, extraIcon, frameSrc });
|
|
295
|
+
menuI18n.zh[v.i18nField] = v.menuName || v.menuNameEn;
|
|
296
|
+
menuI18n.en[v.i18nField] = v.menuNameEn || v.menuName;
|
|
297
|
+
v.name = v.menuCode || v.name;
|
|
298
|
+
v.path = v.menuPath || v.path;
|
|
299
|
+
if (!v.parentId) {
|
|
300
|
+
v.component = Layout;
|
|
301
|
+
} else if (v.meta?.frameSrc) {
|
|
302
|
+
v.component = IFrame;
|
|
303
|
+
} else if (v.menuCategory === MenuCategoty.Lowcode) {
|
|
304
|
+
// 低开路由处理
|
|
305
|
+
const index = modulesRoutesKeys.findIndex(ev => ev.includes('lowcode-contain'));
|
|
306
|
+
v.component = createComponent(
|
|
307
|
+
v.name,
|
|
308
|
+
defineAsyncComponent(() => import(/* @vite-ignore */ modulesRoutesKeys[index]))
|
|
309
|
+
);
|
|
310
|
+
// 将模块类型赋值到meta中
|
|
311
|
+
Object.assign(v.meta, { moduleType: v.moduleType });
|
|
312
|
+
} else if (v.menuCategory !== MenuCategoty.Menu) {
|
|
313
|
+
const index = modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
|
314
|
+
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
|
315
|
+
}
|
|
316
|
+
if (v?.children && v.children.length) {
|
|
317
|
+
addAsyncRoutes(v.children);
|
|
318
|
+
} else {
|
|
319
|
+
delete v.children;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return arrRoutes;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// 是否有权限
|
|
326
|
+
function hasPermissions(value: Array<string>): boolean {
|
|
327
|
+
if (value && value instanceof Array && value.length > 0) {
|
|
328
|
+
const roles = usePermissionStoreHook().buttonAuth;
|
|
329
|
+
const permissionRoles = value;
|
|
330
|
+
|
|
331
|
+
const hasPermission = roles.some(role => {
|
|
332
|
+
return permissionRoles.includes(role);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
if (!hasPermission) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
return true;
|
|
339
|
+
} else {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// 删除当前路由
|
|
344
|
+
function delCurrentRoute(current: any, toNext = true) {
|
|
345
|
+
const startIndex: number = useMultiTagsStoreHook().multiTags.findIndex(tag => {
|
|
346
|
+
if (current.query) {
|
|
347
|
+
if (current.path === tag.path) {
|
|
348
|
+
return current.query === tag.query;
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
return current.path === tag.path;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
useMultiTagsStoreHook().handleTags('splice', '', { startIndex, length: 1 });
|
|
355
|
+
handleAliveRoute(current.matched, 'delete');
|
|
356
|
+
if (toNext) {
|
|
357
|
+
const newRoute = useMultiTagsStoreHook().handleTags('slice');
|
|
358
|
+
router.push({
|
|
359
|
+
path: newRoute[0].path,
|
|
360
|
+
query: newRoute[0].query
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export {
|
|
366
|
+
ascending,
|
|
367
|
+
filterTree,
|
|
368
|
+
initRouter,
|
|
369
|
+
hasPermissions,
|
|
370
|
+
addAsyncRoutes,
|
|
371
|
+
getParentPaths,
|
|
372
|
+
findRouteByPath,
|
|
373
|
+
handleAliveRoute,
|
|
374
|
+
formatTwoStageRoutes,
|
|
375
|
+
formatFlatteningRoutes,
|
|
376
|
+
delCurrentRoute
|
|
377
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2021-11-17 16:02:30
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2024-12-17 18:52:43
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { store } from '../index';
|
|
9
|
+
import type { appType } from './types';
|
|
10
|
+
import { defineStore } from 'pinia';
|
|
11
|
+
import { storageLocal, deviceDetection } from '@utogether/utils';
|
|
12
|
+
import { responsiveStorageNameSpace, getConfig } from '../../config';
|
|
13
|
+
|
|
14
|
+
export const useAppStore = defineStore('udp-app', {
|
|
15
|
+
state: (): appType => ({
|
|
16
|
+
sidebar: {
|
|
17
|
+
opened:
|
|
18
|
+
storageLocal.getItem(`${responsiveStorageNameSpace()}layout`)?.sidebarStatus ??
|
|
19
|
+
getConfig().SidebarStatus,
|
|
20
|
+
withoutAnimation: false,
|
|
21
|
+
isClickCollapse: false
|
|
22
|
+
},
|
|
23
|
+
// 这里的layout用于监听容器拖拉后恢复对应的导航模式
|
|
24
|
+
layout: storageLocal.getItem(`${responsiveStorageNameSpace()}layout`)?.layout ?? getConfig().Layout,
|
|
25
|
+
device: deviceDetection() ? 'mobile' : 'desktop'
|
|
26
|
+
}),
|
|
27
|
+
getters: {
|
|
28
|
+
getSidebarStatus() {
|
|
29
|
+
return this.sidebar.opened;
|
|
30
|
+
},
|
|
31
|
+
getDevice() {
|
|
32
|
+
return this.device;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
actions: {
|
|
36
|
+
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
|
|
37
|
+
const layout = storageLocal.getItem(`${responsiveStorageNameSpace()}layout`);
|
|
38
|
+
if (!layout) return;
|
|
39
|
+
if (opened && resize) {
|
|
40
|
+
this.sidebar.withoutAnimation = true;
|
|
41
|
+
this.sidebar.opened = true;
|
|
42
|
+
layout.sidebarStatus = true;
|
|
43
|
+
} else if (!opened && resize) {
|
|
44
|
+
this.sidebar.withoutAnimation = true;
|
|
45
|
+
this.sidebar.opened = false;
|
|
46
|
+
layout.sidebarStatus = false;
|
|
47
|
+
} else if (!opened && !resize) {
|
|
48
|
+
this.sidebar.withoutAnimation = false;
|
|
49
|
+
this.sidebar.opened = !this.sidebar.opened;
|
|
50
|
+
this.sidebar.isClickCollapse = !this.sidebar.opened;
|
|
51
|
+
layout.sidebarStatus = this.sidebar.opened;
|
|
52
|
+
}
|
|
53
|
+
storageLocal.setItem(`${responsiveStorageNameSpace()}layout`, layout);
|
|
54
|
+
},
|
|
55
|
+
async toggleSideBar(opened?: boolean, resize?: string) {
|
|
56
|
+
await this.TOGGLE_SIDEBAR(opened, resize);
|
|
57
|
+
},
|
|
58
|
+
toggleDevice(device: string) {
|
|
59
|
+
this.device = device;
|
|
60
|
+
},
|
|
61
|
+
setLayout(layout) {
|
|
62
|
+
this.layout = layout;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export function useAppStoreHook() {
|
|
68
|
+
return useAppStore(store);
|
|
69
|
+
}
|