From 5d31cb5f1fb32a478d5b751ebfe97d47db890778 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 01 四月 2026 14:17:42 +0800
Subject: [PATCH] #前端
---
rsf-design/src/store/modules/worktab.js | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/rsf-design/src/store/modules/worktab.js b/rsf-design/src/store/modules/worktab.js
index da66bf0..b06c68b 100644
--- a/rsf-design/src/store/modules/worktab.js
+++ b/rsf-design/src/store/modules/worktab.js
@@ -4,6 +4,14 @@
import { useCommon } from '@/hooks/core/useCommon'
import { normalizeIcon } from '@/router/adapters/backendMenuAdapter.js'
+function normalizeLegacyTabPath(path) {
+ if (path === '/dashboard') {
+ return '/dashboard/console'
+ }
+
+ return path
+}
+
const normalizeTabState = (tab) => {
if (!tab || typeof tab !== 'object') {
return tab
@@ -11,6 +19,7 @@
return {
...tab,
+ path: normalizeLegacyTabPath(tab.path),
icon: normalizeIcon(tab.icon)
}
}
@@ -24,25 +33,30 @@
const hasOpenedTabs = computed(() => opened.value.length > 0)
const hasMultipleTabs = computed(() => opened.value.length > 1)
const currentTabIndex = computed(() =>
- current.value.path ? opened.value.findIndex((tab) => tab.path === current.value.path) : -1
+ current.value.path
+ ? opened.value.findIndex((tab) => tab.path === normalizeLegacyTabPath(current.value.path))
+ : -1
)
const findTabIndex = (path) => {
- return opened.value.findIndex((tab) => tab.path === path)
+ const resolvedPath = normalizeLegacyTabPath(path)
+ return opened.value.findIndex((tab) => tab.path === resolvedPath)
}
const getTab = (path) => {
- return opened.value.find((tab) => tab.path === path)
+ const resolvedPath = normalizeLegacyTabPath(path)
+ return opened.value.find((tab) => tab.path === resolvedPath)
}
const isTabClosable = (tab) => {
return !tab.fixedTab
}
const safeRouterPush = (tab) => {
- if (!tab.path) {
+ const resolvedPath = normalizeLegacyTabPath(tab.path)
+ if (!resolvedPath) {
console.warn('灏濊瘯璺宠浆鍒版棤鏁堣矾寰勭殑鏍囩椤�')
return
}
try {
router.push({
- path: tab.path,
+ path: resolvedPath,
query: tab.query
})
} catch (error) {
@@ -50,7 +64,8 @@
}
}
const openTab = (tab) => {
- if (!tab.path) {
+ const resolvedPath = normalizeLegacyTabPath(tab.path)
+ if (!resolvedPath) {
console.warn('灏濊瘯鎵撳紑鏃犳晥鐨勬爣绛鹃〉')
return
}
@@ -62,11 +77,14 @@
existingIndex = opened.value.findIndex((t) => t.name === tab.name)
}
if (existingIndex === -1) {
- existingIndex = findTabIndex(tab.path)
+ existingIndex = findTabIndex(resolvedPath)
}
if (existingIndex === -1) {
const insertIndex = tab.fixedTab ? findFixedTabInsertIndex() : opened.value.length
- const newTab = normalizeTabState(tab)
+ const newTab = normalizeTabState({
+ ...tab,
+ path: resolvedPath
+ })
if (tab.fixedTab) {
opened.value.splice(insertIndex, 0, newTab)
} else {
@@ -77,7 +95,7 @@
const existingTab = opened.value[existingIndex]
opened.value[existingIndex] = normalizeTabState({
...existingTab,
- path: tab.path,
+ path: resolvedPath,
params: tab.params,
query: tab.query,
title: tab.title || existingTab.title,
@@ -259,8 +277,9 @@
if (routes.some((r) => r.name === tab.name)) return true
}
if (tab.path) {
+ const resolvedPath = normalizeLegacyTabPath(tab.path)
const resolved = routerInstance.resolve({
- path: tab.path,
+ path: resolvedPath,
query: tab.query || void 0
})
return resolved.matched.length > 0
--
Gitblit v1.9.1