@utogether/udp-core 1.0.1-beta.16 → 1.0.1-beta.18

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.
Files changed (123) hide show
  1. package/build/plugins.ts +39 -39
  2. package/dist/{403-RBzulrcG.js → 403-B8xAGW0x.js} +1 -1
  3. package/dist/{404-DX-dU_6C.js → 404-BtgajMpP.js} +1 -1
  4. package/dist/{500-BCTk0__d.js → 500-DFWWZylZ.js} +1 -1
  5. package/dist/{AuthorityInfo-BADTOenq.js → AuthorityInfo-BxWSZs7n.js} +1 -1
  6. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Cv46yAx_.js → AuthorityInfo.vue_vue_type_style_index_0_lang-XIiFdjxN.js} +1 -1
  7. package/dist/{Company-B-61KrWd.js → Company-BbUJtuvr.js} +3 -3
  8. package/dist/{CompanyPanel-CawSrEff.js → CompanyPanel-KOOFrGjk.js} +8 -8
  9. package/dist/{Department-CrzJPtvP.js → Department-BimSgBm2.js} +3 -3
  10. package/dist/{DepartmentPanel-DYuL8H-j.js → DepartmentPanel-DYXPUCDs.js} +3 -3
  11. package/dist/{DesignPanel-DEAv6V68.js → DesignPanel-CHZ36J4q.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BsnXZ2td.js → DesignPanel.vue_vue_type_style_index_0_lang-ZbNixuuY.js} +2 -2
  13. package/dist/{DictView-BuO-2b-c.js → DictView-7RQYVj4H.js} +1 -1
  14. package/dist/{InvOrganization-CBgKBJAn.js → InvOrganization-esq9FI1K.js} +1 -1
  15. package/dist/{Org-BaQw2r-o.js → Org-BGswGV9g.js} +1 -1
  16. package/dist/{Preview-DvCrmKNk.js → Preview-DP0pD6Kf.js} +1 -1
  17. package/dist/{ReportDefine-DyhWz0as.js → ReportDefine-1rjKlbK-.js} +1 -1
  18. package/dist/{ReportDesign-DgZ2f2zv.js → ReportDesign-BIUj35Kh.js} +2 -2
  19. package/dist/{ReportQuery-DTZYbCDi.js → ReportQuery-CWevStRg.js} +1 -1
  20. package/dist/{ReportQueryFrom-B-vtJegP.js → ReportQueryFrom-vlOF5_gc.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-D6izgxph.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-BGyeoYxo.js} +1 -1
  22. package/dist/{ReportTemplate-DA1ZqKGf.js → ReportTemplate-BPURQOFZ.js} +1 -1
  23. package/dist/{Role-mbqoav5t.js → Role-D8xJ3rai.js} +3 -3
  24. package/dist/{RoleAssign-ltEJIEcr.js → RoleAssign-CE5FeHLd.js} +8 -8
  25. package/dist/{RolePanel-u90v9eS0.js → RolePanel-B6wskQVB.js} +1 -1
  26. package/dist/{RolePanel-1g1a-G8D.js → RolePanel-CqHsGjrK.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-LC4Egk-Q.js → RolePanel.vue_vue_type_script_setup_true_lang-Bjoq-nCm.js} +3 -3
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-D9YxpGnt.js → RolePanel.vue_vue_type_script_setup_true_lang-Dv5IVELj.js} +1 -1
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DZ3W1epK.js → ScrollPanel.vue_vue_type_style_index_0_lang-Bp8Y_5A2.js} +1 -1
  30. package/dist/{Staff-CJ2GgCL3.js → Staff-DuYrik71.js} +3 -3
  31. package/dist/{StaffInfo-3KkodDCK.js → StaffInfo-CZiak-1b.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CW-isIxJ.js → StaffInfo.vue_vue_type_script_setup_true_lang-LCuqxUh8.js} +1 -1
  33. package/dist/{StaffPanel-DoXPSoY5.js → StaffPanel-DI6MBAJH.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DvhGnOMZ.js → StaffPanel.vue_vue_type_script_setup_true_lang-DxJhnVpd.js} +2 -2
  35. package/dist/{SysUser-BuIZhMPh.js → SysUser-DoNj2tIV.js} +2 -2
  36. package/dist/{SysUserPanel-t1GJcJGM.js → SysUserPanel-CvfyRxel.js} +1 -1
  37. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-CDDkFLlN.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BoghL7F3.js} +43 -39
  38. package/dist/{SystemMenu-DuLEL6_l.js → SystemMenu-Cr3vUEQU.js} +2 -2
  39. package/dist/{UserInfo-WWby4lts.js → UserInfo-6c8UDIVO.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-B06ZSrJV.js → UserInfo.vue_vue_type_style_index_0_lang-DstUSeNQ.js} +1 -1
  41. package/dist/{childView-B0-EAoAi.js → childView-BlmHw5jv.js} +1 -1
  42. package/dist/{childView-IYY4L8VK.js → childView-C050pf1v.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-B56v6yK7.js → childView.vue_vue_type_style_index_0_lang-BxLT1Dz0.js} +1 -1
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-CjF8nZuj.js → childView.vue_vue_type_style_index_0_lang-D0nlTIP-.js} +2 -2
  45. package/dist/{code-rule-DDLdi3pP.js → code-rule-Br1Mh3_M.js} +1 -1
  46. package/dist/core.es.js +1 -1
  47. package/dist/{cron-task-p3-AFN1w.js → cron-task-DhuIk5pP.js} +1 -1
  48. package/dist/{frameView-B_WAZErD.js → frameView-hJoSI0Ai.js} +1 -1
  49. package/dist/index-1dgWFXT2.js +5436 -0
  50. package/dist/{layoutView-CoEp2afn.js → layoutView-DU-TVfOp.js} +1340 -1337
  51. package/dist/{login-DP0oP70W.js → login-CzJBV0x8.js} +2 -2
  52. package/dist/{lov-view-BDoZRK-v.js → lov-view-BxaHaVKE.js} +2 -2
  53. package/dist/{menuInfo-5Xls76qB.js → menuInfo-Dp7nAbgM.js} +1 -1
  54. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BfZczW9a.js → menuInfo.vue_vue_type_style_index_0_lang-Ch4NbiCL.js} +1 -1
  55. package/dist/{pda-app-DxGYn4G7.js → pda-app-BmxY3H7y.js} +2 -2
  56. package/dist/{resource-BnYWe_-Q.js → resource-D2dCI_x9.js} +1 -1
  57. package/dist/{su-welcome-B2rNhhDH.js → su-welcome-BKGU5HUf.js} +1 -1
  58. package/dist/{sys-config-Bb4WkxZK.js → sys-config-s8DnZMOd.js} +1 -1
  59. package/dist/udp-core.css +1 -9
  60. package/index.ts +48 -48
  61. package/package.json +1 -1
  62. package/src/App.vue +65 -65
  63. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  64. package/src/components/SuScrollTree/ScrollPanel.vue +170 -175
  65. package/src/components/udp/{grid.vue → grid/index.vue} +39 -25
  66. package/src/components/udp/index.ts +2 -9
  67. package/src/components/udp/utils.ts +63 -108
  68. package/src/layout/components/lay-navbar/index.vue +239 -239
  69. package/src/layout/components/lay-panel/index.vue +150 -150
  70. package/src/layout/components/lay-search/index.vue +25 -25
  71. package/src/layout/components/lay-select-org/index.vue +64 -64
  72. package/src/layout/components/lay-sidebar/horizontal.vue +190 -190
  73. package/src/layout/components/lay-sidebar/mixNav.vue +260 -260
  74. package/src/layout/components/lay-sidebar/sidebar-logo.vue +1 -0
  75. package/src/layout/components/lay-tag/index.vue +20 -48
  76. package/src/layout/hooks/useNav.ts +173 -173
  77. package/src/layout/hooks/useTag.ts +5 -3
  78. package/src/layout/types.ts +3 -2
  79. package/src/main.ts +24 -21
  80. package/src/plugins/i18n/en.ts +302 -302
  81. package/src/plugins/i18n/zh.ts +356 -354
  82. package/src/plugins/vxe-table/index.ts +67 -4
  83. package/src/plugins/vxe-table/render.tsx +18 -29
  84. package/src/router/index.ts +186 -177
  85. package/src/router/modules/remaining.ts +58 -58
  86. package/src/router/utils.ts +393 -377
  87. package/src/store/modules/app.ts +1 -3
  88. package/src/store/modules/multiTags.ts +110 -109
  89. package/src/store/modules/permission.ts +113 -100
  90. package/src/style/button.scss +85 -85
  91. package/src/style/login.css +336 -336
  92. package/src/style/vxetable.scss +338 -321
  93. package/src/views/organization/company/CompanyPanel.vue +259 -259
  94. package/src/views/organization/department/DepartmentPanel.vue +269 -283
  95. package/src/views/system/menu/SystemMenu.vue +183 -183
  96. package/src/views/system/menu/menuInfo.vue +363 -363
  97. package/src/views/system/role/UserInfo.vue +195 -195
  98. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  99. package/src/views/system/role-assign/RolePanel.vue +139 -139
  100. package/src/views/system/sys/sys-config.vue +336 -336
  101. package/src/views/system/sysUser/SysUserPanel.vue +279 -278
  102. package/src/views/uapp/pda/pda-app.vue +208 -208
  103. package/src/views/udev/dict/DictView.vue +118 -118
  104. package/src/views/udev/dict/childView.vue +1 -1
  105. package/src/views/udev/lov/lov-view.vue +91 -91
  106. package/src/views/ulogin/login.vue +323 -323
  107. package/src/views/upms/interface/log-out.vue +101 -101
  108. package/src/views/urpt/design/DesignPanel.vue +507 -507
  109. package/types/global.d.ts +230 -230
  110. package/dist/index-24fnvUBy.js +0 -2822
  111. package/src/components/udp/count-down.vue +0 -536
  112. package/src/components/udp/flip-down/FlipCard/flip-card.vue +0 -251
  113. package/src/components/udp/flip-down/FlipCard/interfaces.ts +0 -4
  114. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +0 -113
  115. package/src/components/udp/form-upload.vue +0 -482
  116. package/src/components/udp/form.vue +0 -112
  117. package/src/components/udp/lov.vue +0 -388
  118. package/src/components/udp/modal-form.vue +0 -190
  119. package/src/components/udp/modal-grid.vue +0 -298
  120. package/src/components/udp/upload.vue +0 -423
  121. package/src/utils/udp/http/index.ts +0 -294
  122. package/src/utils/udp/http/types.d.ts +0 -49
  123. package/src/utils/udp/useRender.ts +0 -431
@@ -53,10 +53,7 @@ const contextmenuRef = ref();
53
53
  const isShowArrow = ref(false);
54
54
  const { isFullscreen, toggle } = useFullscreen();
55
55
 
56
- const fixedTags = [
57
- ...routerArrays,
58
- ...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
59
- ];
56
+ const fixedTags = [...routerArrays, ...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)];
60
57
  const dynamicTagView = async () => {
61
58
  await nextTick();
62
59
  const index = multiTags.value.findIndex(item => {
@@ -93,10 +90,7 @@ const moveToView = async (index: number): Promise<void> => {
93
90
  tabItemElOffsetLeft + tabItemOffsetWidth < -translateX.value + scrollbarDomWidth
94
91
  ) {
95
92
  // 标签在可视区域
96
- translateX.value = Math.min(
97
- 0,
98
- scrollbarDomWidth - tabItemOffsetWidth - tabItemElOffsetLeft - tabNavPadding
99
- );
93
+ translateX.value = Math.min(0, scrollbarDomWidth - tabItemOffsetWidth - tabItemElOffsetLeft - tabNavPadding);
100
94
  } else {
101
95
  // 标签在可视区域右侧
102
96
  translateX.value = -(tabItemElOffsetLeft - (scrollbarDomWidth - tabNavPadding - tabItemOffsetWidth));
@@ -171,7 +165,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
171
165
 
172
166
  const spliceRoute = (startIndex?: number, length?: number, other?: boolean): void => {
173
167
  if (other) {
174
- useMultiTagsStoreHook().handleTags('equal', [fixedTags, obj]);
168
+ useMultiTagsStoreHook().handleTags('equal', [fixedTags, obj].flat());
175
169
  } else {
176
170
  useMultiTagsStoreHook().handleTags('splice', '', {
177
171
  startIndex,
@@ -216,6 +210,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
216
210
  }
217
211
 
218
212
  function deleteMenu(item, tag?: string) {
213
+ debugger;
219
214
  deleteDynamicTag(item, item.path, tag);
220
215
  handleAliveRoute(route as ToRouteType);
221
216
  }
@@ -294,7 +289,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
294
289
  break;
295
290
  }
296
291
  setTimeout(() => {
297
- showMenuModel(route.fullPath, route.query);
292
+ showMenuModel(route.fullPath, route.query, route.params);
298
293
  });
299
294
  }
300
295
 
@@ -326,11 +321,13 @@ function disabledMenus(value: boolean, fixedTag = false) {
326
321
  }
327
322
 
328
323
  /** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
329
- function showMenuModel(currentPath: string, query: object = {}, refresh = false) {
324
+ function showMenuModel(currentPath: string, query: object = {}, params: object = {}, refresh = false) {
330
325
  const allRoute = multiTags.value;
331
326
  const routeLength = multiTags.value.length;
332
327
  let currentIndex = -1;
333
- if (isEmpty(query)) {
328
+ if (!isEmpty(params)) {
329
+ currentIndex = allRoute.findIndex(v => isEqual(v.params, params));
330
+ } else if (isEmpty(query)) {
334
331
  currentIndex = allRoute.findIndex(v => v.path === currentPath);
335
332
  } else {
336
333
  currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
@@ -400,14 +397,15 @@ function openMenu(tag, e) {
400
397
  } else if (route.path !== tag.path && route.name !== tag.name) {
401
398
  // 右键菜单不匹配当前路由,隐藏刷新
402
399
  tagsViews[0].show = false;
403
- showMenuModel(tag.path, tag.query);
400
+ showMenuModel(tag.path, tag.query, tag.params);
404
401
  } else if (multiTags.value.length === 2 && route.path !== tag.path) {
405
402
  showMenus(true);
406
403
  // 只有两个标签时不显示关闭其他标签页
407
404
  tagsViews[4].show = false;
405
+ showMenuModel(tag.path, tag.query, tag.params);
408
406
  } else if (route.path === tag.path) {
409
407
  // 右键当前激活的菜单
410
- showMenuModel(tag.path, tag.query, true);
408
+ showMenuModel(tag.path, tag.query, tag.params, true);
411
409
  }
412
410
 
413
411
  currentSelect.value = tag;
@@ -512,11 +510,7 @@ onBeforeUnmount(() => {
512
510
  <span v-show="isShowArrow" class="arrow-left">
513
511
  <IconifyIconOffline icon="ri:arrow-left-s-line" @click="handleScroll(200)" />
514
512
  </span>
515
- <div
516
- ref="scrollbarDom"
517
- class="scroll-container"
518
- :class="showModel === 'chrome' && 'chrome-scroll-container'"
519
- >
513
+ <div ref="scrollbarDom" class="scroll-container" :class="showModel === 'chrome' && 'chrome-scroll-container'">
520
514
  <div ref="tabDom" class="select-none tab" :style="getTabStyle">
521
515
  <div
522
516
  v-for="(item, index) in multiTags"
@@ -535,37 +529,25 @@ onBeforeUnmount(() => {
535
529
  >
536
530
  <template v-if="showModel !== 'chrome'">
537
531
  <span class="tag-title dark:text-text_color_primary! dark:hover:text-primary!">
538
- {{ transformI18n(item.meta.title) }}
532
+ {{ transformI18n(item?.meta?.title) }}
539
533
  </span>
540
534
  <span
541
- v-if="
542
- isFixedTag(item)
543
- ? false
544
- : iconIsActive(item, index) || (index === activeIndex && index !== 0)
545
- "
535
+ v-if="isFixedTag(item) ? false : iconIsActive(item, index) || (index === activeIndex && index !== 0)"
546
536
  class="el-icon-close"
547
537
  @click.stop="deleteMenu(item)"
548
538
  >
549
539
  <IconifyIconOffline icon="ri:close-fill" />
550
540
  </span>
551
- <span
552
- v-if="showModel !== 'card'"
553
- :ref="'schedule' + index"
554
- :class="[scheduleIsActive(item)]"
555
- />
541
+ <span v-if="showModel !== 'card'" :ref="'schedule' + index" :class="[scheduleIsActive(item)]" />
556
542
  </template>
557
543
  <div v-else class="chrome-tab">
558
544
  <div class="chrome-tab__bg">
559
545
  <TagChrome />
560
546
  </div>
561
547
  <span class="tag-title">
562
- {{ transformI18n(item.meta.title) }}
548
+ {{ transformI18n(item?.meta?.title) }}
563
549
  </span>
564
- <span
565
- v-if="isFixedTag(item) ? false : index !== 0"
566
- class="chrome-close-btn"
567
- @click.stop="deleteMenu(item)"
568
- >
550
+ <span v-if="isFixedTag(item) ? false : index !== 0" class="chrome-close-btn" @click.stop="deleteMenu(item)">
569
551
  <IconifyIconOffline icon="ri:close-fill" />
570
552
  </span>
571
553
  <span class="chrome-tab-divider" />
@@ -578,18 +560,8 @@ onBeforeUnmount(() => {
578
560
  </span>
579
561
  <!-- 右键菜单按钮 -->
580
562
  <transition name="el-zoom-in-top">
581
- <ul
582
- v-show="visible"
583
- ref="contextmenuRef"
584
- :key="Math.random()"
585
- :style="getContextMenuStyle"
586
- class="contextmenu"
587
- >
588
- <div
589
- v-for="(item, key) in tagsViews.slice(0, 6)"
590
- :key="key"
591
- style="display: flex; align-items: center"
592
- >
563
+ <ul v-show="visible" ref="contextmenuRef" :key="Math.random()" :style="getContextMenuStyle" class="contextmenu">
564
+ <div v-for="(item, key) in tagsViews.slice(0, 6)" :key="key" style="display: flex; align-items: center">
593
565
  <li v-if="item.show" @click="selectTag(key, item)">
594
566
  <IconifyIconOffline :icon="item.icon" />
595
567
  {{ $t(item.text) }}
@@ -1,173 +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
- }
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
+ }
@@ -91,14 +91,16 @@ export function useTags() {
91
91
  ]);
92
92
 
93
93
  function conditionHandle(item, previous, next) {
94
+ const currentName = route.name || '';
95
+ const itemName = item.name || '';
94
96
  if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
95
97
  if (Object.keys(route.query).length > 0) {
96
- return isEqual(route.query, item.query) ? previous : next;
98
+ return currentName === itemName && isEqual(route.query, item.query) ? previous : next;
97
99
  } else {
98
- return isEqual(route.params, item.params) ? previous : next;
100
+ return currentName === itemName && isEqual(route.params, item.params) ? previous : next;
99
101
  }
100
102
  } else {
101
- return route.path === item.path ? previous : next;
103
+ return currentName === itemName ? previous : next;
102
104
  }
103
105
  }
104
106
 
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: wei.li
3
3
  * @Date: 2021-11-17 16:02:30
4
- * @LastEditors: wei.li
5
- * @LastEditTime: 2024-06-27 13:51:19
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-10-19 12:07:59
6
6
  * @Description: file content
7
7
  */
8
8
 
@@ -11,6 +11,7 @@ import type { IconifyIcon } from '@iconify/vue';
11
11
  export const routerArrays: Array<RouteConfigs> = [
12
12
  {
13
13
  path: '/welcome',
14
+ name: 'Welcome',
14
15
  meta: {
15
16
  title: 'message.udp.home',
16
17
  icon: 'home-filled'
package/src/main.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: levi7754 levi7754@163.com
3
3
  * @Date: 2025-07-25 13:38:20
4
4
  * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-09-11 16:21:38
5
+ * @LastEditTime: 2025-10-19 12:15:08
6
6
  * @FilePath: \udp-front\packages\udp-core\src\main.ts
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
8
  */
@@ -26,28 +26,29 @@ import './style/reset.scss';
26
26
  // 导入公共样式
27
27
  import './style/index.scss';
28
28
 
29
- import 'viewerjs/dist/viewer.css';
29
+ // import 'viewerjs/dist/viewer.css';
30
30
 
31
- import VueViewer from 'v-viewer';
31
+ // import VueViewer from 'v-viewer';
32
32
 
33
33
  // import SuTable from './components/SuTable/SuTable.vue';
34
34
 
35
- // import {
36
- // UtButton,
37
- // utLov2,
38
- // UGrid,
39
- // UtDivider,
40
- // UtModalForm2
41
- // FormUpload2,
42
- // UtForm2
43
- // UtGrid2
44
- // UtContent,
45
- // UtModalGrid2
46
- // UtUpload2
47
- // UtIconSelect,
48
- // UtCalendar
49
- // uAttachment
50
- // } from './components/udp';
35
+ import {
36
+ // UtButton,
37
+ // utLov2,
38
+ // UGrid,
39
+ // UtDivider,
40
+ // UtModalForm2
41
+ // FormUpload2,
42
+ // UtForm2
43
+ UtGrid2
44
+ // UtContent2,
45
+ // UtStampBadge2
46
+ // UtModalGrid2
47
+ // UtUpload2
48
+ // UtIconSelect,
49
+ // UtCalendar
50
+ // uAttachment
51
+ } from './components/udp';
51
52
 
52
53
  const app = createApp(App);
53
54
 
@@ -92,14 +93,16 @@ const init = ({ router, config, lang, views, env, tableConfig }) => {
92
93
  // app.component('uAttachment', uAttachment).component('UGrid', UGrid);
93
94
  // .component('UtDivider', UtDivider)
94
95
  // app.component('UtModalForm2', UtModalForm2);
95
- // app.component('UtGrid2', UtGrid2);
96
+ app.component('UtGrid2', UtGrid2);
96
97
  // app.component('UtForm2', UtForm2);
97
98
  // app.component('UtModalGrid2', UtModalGrid2);
98
99
  // .component('UtIconSelect', UtIconSelect)
99
100
  // app.component('FormUpload2', FormUpload2);
100
101
  // .component('UtCalendar', UtCalendar)
102
+ // app.component('UtContent2', UtContent2);
103
+ // app.component('UtStampBadge2', UtStampBadge2);
101
104
  // .component('UtModalGrid', UtModalGrid);
102
- app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
105
+ // app.use(VueViewer, { defaultOptions: { zIndex: 9999 } });
103
106
  setGlobal(app);
104
107
  setBaseUrl(getBaseURL());
105
108
  setGlobalDirective(app);