@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,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-03-10 11:27:45
|
|
4
|
+
* @LastEditors: wei.li
|
|
5
|
+
* @LastEditTime: 2022-03-10 11:33:43
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { ref } from 'vue';
|
|
9
|
+
|
|
10
|
+
export function useBoolean(initValue = false) {
|
|
11
|
+
const bool = ref(initValue);
|
|
12
|
+
|
|
13
|
+
function setBool(value: boolean) {
|
|
14
|
+
bool.value = value;
|
|
15
|
+
}
|
|
16
|
+
function setTrue() {
|
|
17
|
+
setBool(true);
|
|
18
|
+
}
|
|
19
|
+
function setFalse() {
|
|
20
|
+
setBool(false);
|
|
21
|
+
}
|
|
22
|
+
function toggle() {
|
|
23
|
+
setBool(!bool.value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
bool,
|
|
28
|
+
setBool,
|
|
29
|
+
setTrue,
|
|
30
|
+
setFalse,
|
|
31
|
+
toggle
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { useGlobal, cookies, storageLocal, storageSession } from '@utogether/utils';
|
|
3
|
+
import { darken, lighten } from '../../utils';
|
|
4
|
+
import { useLayout } from './useLayout';
|
|
5
|
+
import { getConfig } from '../../config';
|
|
6
|
+
import type { themeColorsType } from '../types';
|
|
7
|
+
import { routerArrays } from '../types';
|
|
8
|
+
import { kTOKEN, kLOGINER, kCKTOKEN } from '../../contant';
|
|
9
|
+
import { router, resetRouter } from '../../router';
|
|
10
|
+
import { useMultiTagsStoreHook } from '../../store/modules/multiTags';
|
|
11
|
+
import { useAppStoreHook } from '../../store/modules/app';
|
|
12
|
+
import { useEpThemeStoreHook } from '../../store/modules/epTheme';
|
|
13
|
+
import { setTheme } from '../../plugins/vxe-table';
|
|
14
|
+
|
|
15
|
+
export function useDataThemeChange() {
|
|
16
|
+
const { layoutTheme, layout } = useLayout();
|
|
17
|
+
const themeColors = ref<Array<themeColorsType>>([
|
|
18
|
+
/* 道奇蓝(默认) */
|
|
19
|
+
{ color: '#1b2a47', themeColor: 'default' },
|
|
20
|
+
/* 亮白色 */
|
|
21
|
+
{ color: '#ffffff', themeColor: 'light' },
|
|
22
|
+
/* 猩红色 */
|
|
23
|
+
{ color: '#f5222d', themeColor: 'dusk' },
|
|
24
|
+
/* 橙红色 */
|
|
25
|
+
{ color: '#fa541c', themeColor: 'volcano' },
|
|
26
|
+
/* 金色 */
|
|
27
|
+
{ color: '#fadb14', themeColor: 'yellow' },
|
|
28
|
+
/* 绿宝石 */
|
|
29
|
+
{ color: '#13c2c2', themeColor: 'mingQing' },
|
|
30
|
+
/* 酸橙绿 */
|
|
31
|
+
{ color: '#52c41a', themeColor: 'auroraGreen' },
|
|
32
|
+
/* 深粉色 */
|
|
33
|
+
{ color: '#eb2f96', themeColor: 'pink' },
|
|
34
|
+
/* 深紫罗兰色 */
|
|
35
|
+
{ color: '#722ed1', themeColor: 'saucePurple' }
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const { $storage } = useGlobal();
|
|
39
|
+
const dataTheme = ref<boolean>($storage?.layout?.darkMode);
|
|
40
|
+
const overallStyle = ref<string>($storage?.layout?.overallStyle);
|
|
41
|
+
const body = document.documentElement as HTMLElement;
|
|
42
|
+
|
|
43
|
+
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
|
44
|
+
const targetEl = target || document.body;
|
|
45
|
+
let { className } = targetEl;
|
|
46
|
+
className = className.replace(clsName, '').trim();
|
|
47
|
+
targetEl.className = flag ? `${className} ${clsName}` : className;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 设置导航主题色 */
|
|
51
|
+
function setLayoutThemeColor(theme = getConfig().Theme ?? 'default') {
|
|
52
|
+
layoutTheme.value.theme = theme;
|
|
53
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
54
|
+
// 清空class
|
|
55
|
+
document.documentElement.className = '';
|
|
56
|
+
document.documentElement.classList.add(`layout-theme-${theme}`);
|
|
57
|
+
$storage.layout = {
|
|
58
|
+
layout: layout.value,
|
|
59
|
+
theme,
|
|
60
|
+
darkMode: dataTheme.value,
|
|
61
|
+
sidebarStatus: $storage.layout?.sidebarStatus,
|
|
62
|
+
epThemeColor: $storage.layout?.epThemeColor,
|
|
63
|
+
overallStyle: overallStyle.value
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
if (theme === 'default' || theme === 'light') {
|
|
67
|
+
setEpThemeColor(getConfig().EpThemeColor || '#409EFF');
|
|
68
|
+
} else {
|
|
69
|
+
const colors = themeColors.value.find(item => item.themeColor === theme);
|
|
70
|
+
|
|
71
|
+
setEpThemeColor(colors.color);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function setPropertyPrimary(mode: string, i: number, color: string) {
|
|
76
|
+
document.documentElement.style.setProperty(
|
|
77
|
+
`--el-color-primary-${mode}-${i}`,
|
|
78
|
+
dataTheme.value ? darken(color, i / 10) : lighten(color, i / 10)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 设置 `element-plus` 主题色 */
|
|
83
|
+
const setEpThemeColor = (color: string) => {
|
|
84
|
+
useEpThemeStoreHook().setEpThemeColor(color);
|
|
85
|
+
document.documentElement.style.setProperty('--el-color-primary', color);
|
|
86
|
+
for (let i = 1; i <= 2; i++) {
|
|
87
|
+
setPropertyPrimary('dark', i, color);
|
|
88
|
+
}
|
|
89
|
+
for (let i = 1; i <= 9; i++) {
|
|
90
|
+
setPropertyPrimary('light', i, color);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** 浅色、深色整体风格切换 */
|
|
95
|
+
function dataThemeChange(overall?: string) {
|
|
96
|
+
/* 如果当前是light夜间主题,默认切换到default主题 */
|
|
97
|
+
overallStyle.value = overall;
|
|
98
|
+
if (useEpThemeStoreHook().epTheme === 'light' && dataTheme.value) {
|
|
99
|
+
setLayoutThemeColor('default');
|
|
100
|
+
} else {
|
|
101
|
+
setLayoutThemeColor(useEpThemeStoreHook().epTheme);
|
|
102
|
+
}
|
|
103
|
+
setTheme(!dataTheme.value ? 'light' : 'dark');
|
|
104
|
+
if (dataTheme.value) {
|
|
105
|
+
document.documentElement.classList.add('dark');
|
|
106
|
+
document.documentElement.classList.remove('default');
|
|
107
|
+
} else {
|
|
108
|
+
document.documentElement.classList.add('default');
|
|
109
|
+
document.documentElement.classList.remove('dark');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function onReset() {
|
|
114
|
+
cookies.remove(kCKTOKEN);
|
|
115
|
+
cookies.remove(kTOKEN);
|
|
116
|
+
cookies.remove(kLOGINER);
|
|
117
|
+
storageLocal.clear();
|
|
118
|
+
storageSession.clear();
|
|
119
|
+
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
|
120
|
+
useAppStoreHook().setLayout(Layout);
|
|
121
|
+
setEpThemeColor(EpThemeColor);
|
|
122
|
+
useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache);
|
|
123
|
+
toggleClass(Grey, 'html-grey', document.querySelector('html'));
|
|
124
|
+
toggleClass(Weak, 'html-weakness', document.querySelector('html'));
|
|
125
|
+
router.push('/login');
|
|
126
|
+
useMultiTagsStoreHook().handleTags('equal', [...routerArrays]);
|
|
127
|
+
resetRouter();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
body,
|
|
132
|
+
overallStyle,
|
|
133
|
+
dataTheme,
|
|
134
|
+
layoutTheme,
|
|
135
|
+
themeColors,
|
|
136
|
+
onReset,
|
|
137
|
+
toggleClass,
|
|
138
|
+
dataThemeChange,
|
|
139
|
+
setEpThemeColor,
|
|
140
|
+
setLayoutThemeColor
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-08-30 10:31:26
|
|
4
|
+
* @LastEditors: wei.li
|
|
5
|
+
* @LastEditTime: 2024-07-02 14:31:54
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { computed } from 'vue';
|
|
9
|
+
import { useI18n } from 'vue-i18n';
|
|
10
|
+
import { routerArrays } from '../types';
|
|
11
|
+
import { useGlobal } from '@utogether/utils';
|
|
12
|
+
import { useMultiTagsStore } from '../../store/modules/multiTags';
|
|
13
|
+
|
|
14
|
+
export function useLayout() {
|
|
15
|
+
const { $storage, $config } = useGlobal();
|
|
16
|
+
|
|
17
|
+
const initStorage = () => {
|
|
18
|
+
/** 路由 */
|
|
19
|
+
if (useMultiTagsStore().multiTagsCache && (!$storage.tags || $storage.tags.length === 0)) {
|
|
20
|
+
$storage.tags = routerArrays;
|
|
21
|
+
}
|
|
22
|
+
/** 国际化 */
|
|
23
|
+
if (!$storage?.locale) {
|
|
24
|
+
// $storage.locale = { locale: $config?.Locale ?? 'zh' };
|
|
25
|
+
useI18n().locale.value = $config?.Locale ?? 'zh';
|
|
26
|
+
}
|
|
27
|
+
/** 导航 */
|
|
28
|
+
if ($storage && !$storage?.layout) {
|
|
29
|
+
$storage.layout = {
|
|
30
|
+
layout: $config?.Layout ?? 'vertical',
|
|
31
|
+
theme: $config?.Theme ?? 'default',
|
|
32
|
+
darkMode: $config?.DarkMode ?? false,
|
|
33
|
+
sidebarStatus: $config?.SidebarStatus ?? true,
|
|
34
|
+
epThemeColor: $config?.EpThemeColor ?? '#409EFF',
|
|
35
|
+
overallStyle: $config?.OverallStyle ?? 'light'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** 灰色模式、色弱模式、隐藏标签页 */
|
|
39
|
+
if ($storage && !$storage?.configure) {
|
|
40
|
+
$storage.configure = {
|
|
41
|
+
grey: $config?.Grey ?? false,
|
|
42
|
+
weak: $config?.Weak ?? false,
|
|
43
|
+
hideTabs: $config?.HideTabs ?? false,
|
|
44
|
+
showLogo: $config?.ShowLogo ?? true,
|
|
45
|
+
showModel: $config?.ShowModel ?? 'smart',
|
|
46
|
+
multiTagsCache: $config?.MultiTagsCache ?? false
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** 清空缓存后从serverConfig.json读取默认配置并赋值到storage中 */
|
|
52
|
+
const layout = computed(() => {
|
|
53
|
+
return $storage?.layout.layout;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const layoutTheme = computed(() => {
|
|
57
|
+
return $storage?.layout;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
layout,
|
|
62
|
+
layoutTheme,
|
|
63
|
+
initStorage
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2023-04-18 15:44:40
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2025-04-16 15:49:31
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { computed, type CSSProperties } from 'vue';
|
|
9
|
+
import { storeToRefs } from 'pinia';
|
|
10
|
+
import { useRouter } from 'vue-router';
|
|
11
|
+
import { cookies, useGlobal, storageLocal } from '@utogether/utils';
|
|
12
|
+
import { router, remainingPaths, resetRouter } from '../../router';
|
|
13
|
+
import { emitter } from '../../utils/mitt';
|
|
14
|
+
import { getEnv } from '../../config';
|
|
15
|
+
import { kTOKEN, kLOGINER, kCKTOKEN, kSYSCONFIG } from '../../contant';
|
|
16
|
+
import { routerArrays } from '../types';
|
|
17
|
+
// import { transformI18n } from '@/plugins/i18n';
|
|
18
|
+
import { useAppStoreHook } from '../../store/modules/app';
|
|
19
|
+
import { usePermissionStoreHook } from '../../store/modules/permission';
|
|
20
|
+
import { useEpThemeStoreHook } from '../../store/modules/epTheme';
|
|
21
|
+
import { useSystemStoreHook } from '../../store/modules/system';
|
|
22
|
+
import { useMultiTagsStoreHook } from '../../store/modules/multiTags';
|
|
23
|
+
|
|
24
|
+
const errorInfo = '当前路由配置不正确,请检查配置';
|
|
25
|
+
|
|
26
|
+
export function useNav() {
|
|
27
|
+
const appHook = useAppStoreHook();
|
|
28
|
+
const routers = useRouter().options.routes;
|
|
29
|
+
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
|
30
|
+
|
|
31
|
+
const getDivStyle = computed((): CSSProperties => {
|
|
32
|
+
return {
|
|
33
|
+
width: '100%',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'space-between',
|
|
37
|
+
overflow: 'hidden'
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/** 设置国际化选中后的样式 */
|
|
42
|
+
const getDropdownItemStyle = computed(() => {
|
|
43
|
+
return (locale, t) => {
|
|
44
|
+
return {
|
|
45
|
+
background: locale === t ? useEpThemeStoreHook().epThemeColor : '',
|
|
46
|
+
color: locale === t ? '#f4f4f5' : '#000'
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const getDropdownItemClass = computed(() => {
|
|
52
|
+
return (locale, t) => {
|
|
53
|
+
return locale === t ? '' : 'dark:hover:text-primary!';
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/** 用户名 */
|
|
58
|
+
const userInfo = computed<IRecord>(() => {
|
|
59
|
+
return useSystemStoreHook().getUserInfo || {};
|
|
60
|
+
});
|
|
61
|
+
const avatarsStyle = computed(() => {
|
|
62
|
+
return userInfo.value ? { marginRight: '10px' } : '';
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const isCollapse = computed(() => {
|
|
66
|
+
return !appHook.getSidebarStatus;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const device = computed(() => {
|
|
70
|
+
return appHook.getDevice;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const { $storage } = useGlobal();
|
|
74
|
+
const layout = computed(() => {
|
|
75
|
+
return $storage?.layout?.layout;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const title = computed(() => {
|
|
79
|
+
const sysConfig = storageLocal.getItem(kSYSCONFIG) || {};
|
|
80
|
+
return sysConfig?.title || 'U-DP';
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/** 动态title */
|
|
84
|
+
function setDocumentTitle() {
|
|
85
|
+
document.title = getEnv().MODE !== 'staging' ? title.value : `${title.value}•测试`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 退出登录 */
|
|
89
|
+
function logout() {
|
|
90
|
+
useMultiTagsStoreHook().handleTags('equal', [...routerArrays]);
|
|
91
|
+
cookies.remove(kCKTOKEN);
|
|
92
|
+
cookies.remove(kTOKEN);
|
|
93
|
+
cookies.remove(kLOGINER);
|
|
94
|
+
usePermissionStoreHook().setWholeMenus([]);
|
|
95
|
+
// 关闭全部标签页, 防止缓存了tags,又用另一个账号登录
|
|
96
|
+
useMultiTagsStoreHook().handleTags('splice', '', {
|
|
97
|
+
startIndex: 1,
|
|
98
|
+
length: useMultiTagsStoreHook()?.multiTags?.length
|
|
99
|
+
});
|
|
100
|
+
usePermissionStoreHook().clearAllCachePage();
|
|
101
|
+
resetRouter();
|
|
102
|
+
router.push('/login');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function backHome() {
|
|
106
|
+
router.push('/welcome');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function onPanel() {
|
|
110
|
+
emitter.emit('openPanel');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function toggleSideBar() {
|
|
114
|
+
appHook.toggleSideBar();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function handleResize(menuRef) {
|
|
118
|
+
menuRef?.handleResize();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function resolvePath(route) {
|
|
122
|
+
if (!route.children) return console.error(errorInfo);
|
|
123
|
+
const httpReg = /^http(s?):\/\//;
|
|
124
|
+
const routeChildPath = route.children[0]?.path;
|
|
125
|
+
if (httpReg.test(routeChildPath)) {
|
|
126
|
+
return route.path + '/' + routeChildPath;
|
|
127
|
+
} else {
|
|
128
|
+
return routeChildPath;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function menuSelect(indexPath: string) {
|
|
132
|
+
if (wholeMenus.value.length === 0 || isRemaining(indexPath)) return;
|
|
133
|
+
emitter.emit('changLayoutRoute', indexPath);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 判断路径是否参与菜单 */
|
|
137
|
+
function isRemaining(path: string) {
|
|
138
|
+
return remainingPaths.includes(path);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function passwordItems() {
|
|
142
|
+
const itemRender = { name: '$input', props: { type: 'password' } };
|
|
143
|
+
return [
|
|
144
|
+
{ field: 'oldUserPwd', title: 'message.udp.oldPwd', required: true, itemRender },
|
|
145
|
+
{ field: 'userPwd', title: 'message.udp.newPwd', required: true, itemRender },
|
|
146
|
+
{ field: 'confirmPwd', title: 'message.udp.confirmPwd', required: true, itemRender }
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
title,
|
|
152
|
+
device,
|
|
153
|
+
layout,
|
|
154
|
+
logout,
|
|
155
|
+
routers,
|
|
156
|
+
$storage,
|
|
157
|
+
backHome,
|
|
158
|
+
onPanel,
|
|
159
|
+
getDivStyle,
|
|
160
|
+
setDocumentTitle,
|
|
161
|
+
toggleSideBar,
|
|
162
|
+
menuSelect,
|
|
163
|
+
handleResize,
|
|
164
|
+
resolvePath,
|
|
165
|
+
isCollapse,
|
|
166
|
+
appHook,
|
|
167
|
+
userInfo,
|
|
168
|
+
avatarsStyle,
|
|
169
|
+
getDropdownItemStyle,
|
|
170
|
+
getDropdownItemClass,
|
|
171
|
+
passwordItems
|
|
172
|
+
};
|
|
173
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ref,
|
|
3
|
+
unref,
|
|
4
|
+
watch,
|
|
5
|
+
computed,
|
|
6
|
+
reactive,
|
|
7
|
+
onMounted,
|
|
8
|
+
type CSSProperties,
|
|
9
|
+
getCurrentInstance
|
|
10
|
+
} from 'vue';
|
|
11
|
+
import type { tagsViewsType } from '../types';
|
|
12
|
+
import { isEqual, isBoolean } from 'xe-utils';
|
|
13
|
+
import { useEventListener } from '@vueuse/core';
|
|
14
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
15
|
+
import { storageLocal, toggleClass, hasClass } from '@utogether/utils';
|
|
16
|
+
import { transformI18n } from '../../plugins/i18n';
|
|
17
|
+
import { useSettingStoreHook } from '../../store/modules/settings';
|
|
18
|
+
import { responsiveStorageNameSpace } from '../../config';
|
|
19
|
+
import { useMultiTagsStoreHook } from '../../store/modules/multiTags';
|
|
20
|
+
|
|
21
|
+
export function useTags() {
|
|
22
|
+
const route = useRoute();
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
const instance = getCurrentInstance();
|
|
25
|
+
const SuSetting = useSettingStoreHook();
|
|
26
|
+
|
|
27
|
+
const buttonTop = ref(0);
|
|
28
|
+
const buttonLeft = ref(0);
|
|
29
|
+
const translateX = ref(0);
|
|
30
|
+
const visible = ref(false);
|
|
31
|
+
const activeIndex = ref(-1);
|
|
32
|
+
// 当前右键选中的路由信息
|
|
33
|
+
const currentSelect = ref({});
|
|
34
|
+
|
|
35
|
+
/** 显示模式,默认灵动模式 */
|
|
36
|
+
const showModel = ref(
|
|
37
|
+
storageLocal.getItem(`${responsiveStorageNameSpace()}configure`)?.showModel || 'smart'
|
|
38
|
+
);
|
|
39
|
+
/** 是否隐藏标签页,默认显示 */
|
|
40
|
+
const showTags =
|
|
41
|
+
ref(storageLocal.getItem(`${responsiveStorageNameSpace()}configure`)?.hideTabs) ?? ref('false');
|
|
42
|
+
const multiTags: any = computed(() => {
|
|
43
|
+
return useMultiTagsStoreHook().multiTags;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const tagsViews = reactive<Array<tagsViewsType>>([
|
|
47
|
+
{
|
|
48
|
+
icon: 'refresh-right',
|
|
49
|
+
text: 'message.udp.reload',
|
|
50
|
+
divided: false,
|
|
51
|
+
disabled: false,
|
|
52
|
+
show: true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
icon: 'close',
|
|
56
|
+
text: 'message.udp.closeCurrentTab',
|
|
57
|
+
divided: false,
|
|
58
|
+
disabled: multiTags.value.length > 1 ? false : true,
|
|
59
|
+
show: true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
icon: 'ri:text-direction-r',
|
|
63
|
+
text: 'message.udp.closeLeftTabs',
|
|
64
|
+
divided: true,
|
|
65
|
+
disabled: multiTags.value.length > 1 ? false : true,
|
|
66
|
+
show: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
icon: 'ri:text-direction-l',
|
|
70
|
+
text: 'message.udp.closeRightTabs',
|
|
71
|
+
divided: false,
|
|
72
|
+
disabled: multiTags.value.length > 1 ? false : true,
|
|
73
|
+
show: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
icon: 'ri:text-spacing',
|
|
77
|
+
text: 'message.udp.closeOtherTabs',
|
|
78
|
+
divided: true,
|
|
79
|
+
disabled: multiTags.value.length > 2 ? false : true,
|
|
80
|
+
show: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
icon: 'ri:subtract-line',
|
|
84
|
+
text: 'message.udp.closeAllTabs',
|
|
85
|
+
divided: false,
|
|
86
|
+
disabled: multiTags.value.length > 1 ? false : true,
|
|
87
|
+
show: true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
icon: 'ri:fullscreen-fill',
|
|
91
|
+
text: 'message.udp.wholeFullScreen',
|
|
92
|
+
divided: true,
|
|
93
|
+
disabled: false,
|
|
94
|
+
show: true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
icon: 'ri:fullscreen-fill',
|
|
98
|
+
text: 'message.udp.contentFullScreen',
|
|
99
|
+
divided: false,
|
|
100
|
+
disabled: false,
|
|
101
|
+
show: true
|
|
102
|
+
}
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
function conditionHandle(item, previous, next) {
|
|
106
|
+
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
|
|
107
|
+
if (Object.keys(route.query).length > 0) {
|
|
108
|
+
return isEqual(route.query, item.query) ? previous : next;
|
|
109
|
+
} else {
|
|
110
|
+
return isEqual(route.params, item.params) ? previous : next;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
return route.path === item.path ? previous : next;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const isFixedTag = computed(() => {
|
|
118
|
+
return item => {
|
|
119
|
+
return isBoolean(item?.meta?.fixedTag) && item?.meta?.fixedTag === true;
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const iconIsActive = computed(() => {
|
|
124
|
+
return (item, index) => {
|
|
125
|
+
if (index === 0) return;
|
|
126
|
+
return conditionHandle(item, true, false);
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const linkIsActive = computed(() => {
|
|
131
|
+
return item => {
|
|
132
|
+
return conditionHandle(item, 'is-active', '');
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const scheduleIsActive = computed(() => {
|
|
137
|
+
return item => {
|
|
138
|
+
return conditionHandle(item, 'schedule-active', '');
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const getTabStyle = computed((): CSSProperties => {
|
|
143
|
+
return {
|
|
144
|
+
transform: `translateX(${translateX.value}px)`
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const getContextMenuStyle = computed((): CSSProperties => {
|
|
149
|
+
return { left: buttonLeft.value + 'px', top: buttonTop.value + 'px' };
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const closeMenu = () => {
|
|
153
|
+
visible.value = false;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** 鼠标移入添加激活样式 */
|
|
157
|
+
function onMouseenter(index) {
|
|
158
|
+
if (index) activeIndex.value = index;
|
|
159
|
+
if (unref(showModel) === 'smart') {
|
|
160
|
+
if (hasClass(instance.refs['schedule' + index][0], 'schedule-active')) return;
|
|
161
|
+
toggleClass(true, 'schedule-in', instance.refs['schedule' + index][0]);
|
|
162
|
+
toggleClass(false, 'schedule-out', instance.refs['schedule' + index][0]);
|
|
163
|
+
} else {
|
|
164
|
+
if (hasClass(instance.refs['dynamic' + index][0], 'is-active')) return;
|
|
165
|
+
toggleClass(true, 'card-in', instance.refs['dynamic' + index][0]);
|
|
166
|
+
toggleClass(false, 'card-out', instance.refs['dynamic' + index][0]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** 鼠标移出恢复默认样式 */
|
|
171
|
+
function onMouseleave(index) {
|
|
172
|
+
activeIndex.value = -1;
|
|
173
|
+
if (unref(showModel) === 'smart') {
|
|
174
|
+
if (hasClass(instance.refs['schedule' + index][0], 'schedule-active')) return;
|
|
175
|
+
toggleClass(false, 'schedule-in', instance.refs['schedule' + index][0]);
|
|
176
|
+
toggleClass(true, 'schedule-out', instance.refs['schedule' + index][0]);
|
|
177
|
+
} else {
|
|
178
|
+
if (hasClass(instance.refs['dynamic' + index][0], 'is-active')) return;
|
|
179
|
+
toggleClass(false, 'card-in', instance.refs['dynamic' + index][0]);
|
|
180
|
+
toggleClass(true, 'card-out', instance.refs['dynamic' + index][0]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function onContentFullScreen() {
|
|
185
|
+
SuSetting.hiddenSideBar
|
|
186
|
+
? SuSetting.changeSetting({ key: 'hiddenSideBar', value: false })
|
|
187
|
+
: SuSetting.changeSetting({ key: 'hiddenSideBar', value: true });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
onMounted(() => {
|
|
191
|
+
if (!showModel.value) {
|
|
192
|
+
const configure = storageLocal.getItem(`${responsiveStorageNameSpace()}configure`);
|
|
193
|
+
configure.showModel = 'card';
|
|
194
|
+
storageLocal.setItem(`${responsiveStorageNameSpace()}configure`, configure);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
watch(
|
|
199
|
+
() => visible.value,
|
|
200
|
+
() => {
|
|
201
|
+
useEventListener(document, 'click', closeMenu);
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
route,
|
|
207
|
+
router,
|
|
208
|
+
visible,
|
|
209
|
+
showTags,
|
|
210
|
+
instance,
|
|
211
|
+
multiTags,
|
|
212
|
+
showModel,
|
|
213
|
+
tagsViews,
|
|
214
|
+
buttonTop,
|
|
215
|
+
buttonLeft,
|
|
216
|
+
translateX,
|
|
217
|
+
isFixedTag,
|
|
218
|
+
SuSetting,
|
|
219
|
+
activeIndex,
|
|
220
|
+
getTabStyle,
|
|
221
|
+
iconIsActive,
|
|
222
|
+
linkIsActive,
|
|
223
|
+
currentSelect,
|
|
224
|
+
scheduleIsActive,
|
|
225
|
+
getContextMenuStyle,
|
|
226
|
+
closeMenu,
|
|
227
|
+
onMounted,
|
|
228
|
+
onMouseenter,
|
|
229
|
+
onMouseleave,
|
|
230
|
+
transformI18n,
|
|
231
|
+
onContentFullScreen
|
|
232
|
+
};
|
|
233
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2022-08-30 12:01:43
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2024-06-27 10:22:29
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import { VxeUI } from 'vxe-table';
|
|
9
|
+
import { useI18n } from 'vue-i18n';
|
|
10
|
+
import { useRoute } from 'vue-router';
|
|
11
|
+
import { watch, onBeforeMount, type Ref } from 'vue';
|
|
12
|
+
import { useNav } from './useNav';
|
|
13
|
+
|
|
14
|
+
export function useTranslationLang(ref?: Ref) {
|
|
15
|
+
const { $storage, setDocumentTitle, handleResize } = useNav();
|
|
16
|
+
const { locale, t } = useI18n();
|
|
17
|
+
const route = useRoute();
|
|
18
|
+
|
|
19
|
+
function translationCh() {
|
|
20
|
+
$storage.locale = { locale: 'zh' };
|
|
21
|
+
locale.value = 'zh';
|
|
22
|
+
VxeUI.setLanguage('zh-CN');
|
|
23
|
+
ref && handleResize(ref.value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function translationEn() {
|
|
27
|
+
$storage.locale = { locale: 'en' };
|
|
28
|
+
locale.value = 'en';
|
|
29
|
+
VxeUI.setLanguage('en-US');
|
|
30
|
+
ref && handleResize(ref.value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
watch(
|
|
34
|
+
() => locale.value,
|
|
35
|
+
() => {
|
|
36
|
+
setDocumentTitle();
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
onBeforeMount(() => {
|
|
41
|
+
locale.value = $storage.locale?.locale ?? 'zh';
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
t,
|
|
46
|
+
route,
|
|
47
|
+
locale,
|
|
48
|
+
translationCh,
|
|
49
|
+
translationEn
|
|
50
|
+
};
|
|
51
|
+
}
|