|
|
@@ -811,6 +811,9 @@ async function switchReport(report) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 更新报告标题(在加载前设置,避免显示旧标题)
|
|
|
+ reportTitle.value = report.name || '未命名报告'
|
|
|
+
|
|
|
// 更新 URL(不刷新页面)
|
|
|
const newUrl = new URL(window.location.href)
|
|
|
newUrl.searchParams.set('doc', report.baseDocumentId)
|
|
|
@@ -821,9 +824,6 @@ async function switchReport(report) {
|
|
|
|
|
|
// 加载新文档
|
|
|
await loadDocumentById(report.baseDocumentId)
|
|
|
-
|
|
|
- // 更新报告标题
|
|
|
- reportTitle.value = report.name || '未命名报告'
|
|
|
}
|
|
|
|
|
|
// 取消选中报告,回到初始状态
|
|
|
@@ -836,7 +836,7 @@ function unselectReport() {
|
|
|
// 清除当前文档和报告
|
|
|
currentDocumentId.value = null
|
|
|
currentReportId.value = null
|
|
|
- reportTitle.value = '新建报告'
|
|
|
+ reportTitle.value = ''
|
|
|
|
|
|
// 清空文档内容
|
|
|
blocks.value = []
|
|
|
@@ -1336,18 +1336,19 @@ onMounted(async () => {
|
|
|
// 检查 URL 是否有指定文档ID
|
|
|
const docId = route.query.doc
|
|
|
if (docId) {
|
|
|
- // 只有 URL 明确指定了文档才加载
|
|
|
- currentDocumentId.value = docId
|
|
|
- await loadDocumentById(docId)
|
|
|
- // 找到对应的报告设置标题和ID
|
|
|
+ // 找到对应的报告,提前设置标题(避免加载时显示错误标题)
|
|
|
const report = myReports.value.find(r => r.baseDocumentId === docId)
|
|
|
if (report) {
|
|
|
reportTitle.value = report.name || '未命名报告'
|
|
|
currentReportId.value = report.id
|
|
|
}
|
|
|
+
|
|
|
+ // 只有 URL 明确指定了文档才加载
|
|
|
+ currentDocumentId.value = docId
|
|
|
+ await loadDocumentById(docId)
|
|
|
} else {
|
|
|
// 没有指定文档,显示欢迎页,不自动选中任何报告
|
|
|
- reportTitle.value = '新建报告'
|
|
|
+ reportTitle.value = ''
|
|
|
currentReportId.value = null
|
|
|
documentContent.value = emptyPlaceholder
|
|
|
}
|