From 40905cbd04c2e332cd4bc2b9e0c5b3e1da9cccfa Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期一, 30 三月 2026 08:17:32 +0800
Subject: [PATCH] feat: complete rsf-design phase 1 integration
---
rsf-design/src/store/modules/worktab.js | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/rsf-design/src/store/modules/worktab.js b/rsf-design/src/store/modules/worktab.js
index 301c807..da66bf0 100644
--- a/rsf-design/src/store/modules/worktab.js
+++ b/rsf-design/src/store/modules/worktab.js
@@ -2,6 +2,19 @@
import { ref, computed } from 'vue'
import { router } from '@/router'
import { useCommon } from '@/hooks/core/useCommon'
+import { normalizeIcon } from '@/router/adapters/backendMenuAdapter.js'
+
+const normalizeTabState = (tab) => {
+ if (!tab || typeof tab !== 'object') {
+ return tab
+ }
+
+ return {
+ ...tab,
+ icon: normalizeIcon(tab.icon)
+ }
+}
+
const useWorktabStore = defineStore(
'worktabStore',
() => {
@@ -53,7 +66,7 @@
}
if (existingIndex === -1) {
const insertIndex = tab.fixedTab ? findFixedTabInsertIndex() : opened.value.length
- const newTab = { ...tab }
+ const newTab = normalizeTabState(tab)
if (tab.fixedTab) {
opened.value.splice(insertIndex, 0, newTab)
} else {
@@ -62,7 +75,7 @@
current.value = newTab
} else {
const existingTab = opened.value[existingIndex]
- opened.value[existingIndex] = {
+ opened.value[existingIndex] = normalizeTabState({
...existingTab,
path: tab.path,
params: tab.params,
@@ -72,7 +85,7 @@
keepAlive: tab.keepAlive ?? existingTab.keepAlive,
name: tab.name || existingTab.name,
icon: tab.icon || existingTab.icon
- }
+ })
current.value = opened.value[existingIndex]
}
}
@@ -257,15 +270,22 @@
return false
}
}
- const validTabs = opened.value.filter((tab) => isTabRouteValid(tab))
+ const validTabs = opened.value.filter((tab) => isTabRouteValid(tab)).map(normalizeTabState)
if (validTabs.length !== opened.value.length) {
console.warn('鍙戠幇鏃犳晥鐨勬爣绛鹃〉璺敱锛屽凡鑷姩娓呯悊')
+ }
+ if (
+ validTabs.length !== opened.value.length ||
+ validTabs.some((tab, index) => tab.icon !== opened.value[index]?.icon)
+ ) {
opened.value = validTabs
}
const isCurrentValid = current.value && isTabRouteValid(current.value)
if (!isCurrentValid && validTabs.length > 0) {
console.warn('褰撳墠婵�娲绘爣绛炬棤鏁堬紝宸茶嚜鍔ㄥ垏鎹�')
current.value = validTabs[0]
+ } else if (isCurrentValid) {
+ current.value = normalizeTabState(current.value)
} else if (!isCurrentValid) {
current.value = {}
}
--
Gitblit v1.9.1