fix: 统一AI详情页面包屑与Tab导航表现

- 为工作流、插件、知识库、聊天助手详情路由恢复面包屑与Tab参与并保持父模块高亮

- 列表卡片跳转统一追加 navTitle 与 pageKey,详情页Tab标题与面包屑优先显示卡片名称

- 工作流设计页、知识库详情页、聊天助手设置页在深链缺少 navTitle 时自动 replace 补写
This commit is contained in:
2026-03-11 20:07:00 +08:00
parent c933971a75
commit 99f792f6de
13 changed files with 146 additions and 13 deletions

View File

@@ -67,6 +67,9 @@ const headerButtons = [
permission: '/api/v1/documentCollection/save',
},
];
function resolveNavTitle(row: BotInfo) {
return (row as Record<string, any>)?.title || row?.name || '';
}
const actions: ActionButton[] = [
{
icon: Edit,
@@ -83,7 +86,13 @@ const actions: ActionButton[] = [
className: '',
permission: '',
onClick(row: BotInfo) {
router.push({ path: `/ai/bots/setting/${row.id}` });
router.push({
path: '/ai/bots/setting/' + row.id,
query: {
pageKey: '/ai/bots',
navTitle: resolveNavTitle(row),
},
});
},
},
{

View File

@@ -2,7 +2,7 @@
import type {BotInfo} from '@easyflow/types';
import {computed, onMounted, ref} from 'vue';
import {useRoute} from 'vue-router';
import {useRoute, useRouter} from 'vue-router';
import {tryit} from 'radash';
@@ -14,11 +14,33 @@ import Preview from './preview.vue';
import Prompt from './prompt.vue';
const route = useRoute();
const router = useRouter();
const hasSavePermission = computed(() =>
hasPermission(['/api/v1/bot/save', '/api/v1/bot/updateLlmId']),
);
const bot = ref<BotInfo>();
function syncNavTitle(title: string) {
if (!title) {
return;
}
const query = route.query as Record<string, any>;
const navTitle = Array.isArray(query.navTitle)
? query.navTitle[0]
: query.navTitle;
if (typeof navTitle === 'string' && navTitle.trim()) {
return;
}
router.replace({
path: route.path,
query: {
...query,
pageKey: query.pageKey || '/ai/bots',
navTitle: title,
},
});
}
onMounted(() => {
if (route.params.id) {
fetchBotDetail(route.params.id as string);
@@ -30,6 +52,7 @@ const fetchBotDetail = async (id: string) => {
if (res?.errorCode === 0) {
bot.value = res.data;
syncNavTitle((res.data?.title || res.data?.name || '') as string);
}
};
</script>