This commit is contained in:
freedakgmail
2025-12-21 17:32:33 +08:00
parent cffdd75e96
commit 5c8c70097c
190 changed files with 2746 additions and 893 deletions
+5 -3
View File
@@ -24,6 +24,7 @@ import { RelationshipPathDisplay } from "@/components/relationship-path-display"
import { useSession } from "next-auth/react"
import { EmptyStateBadge } from "@/components/empty-state-badge"
import { exportFamilyHTML } from "@/lib/export-pdf"
import { useDialog } from "@/components/ui/alert-dialog-custom"
// 动态导入 D3 图表组件(减少初始加载体积)
const D3OrgChartFlow = dynamic(
@@ -48,6 +49,7 @@ export default function TreePage() {
const { treeData, currentTree, refreshData } = useFamily()
const { calculateRelationship } = useRelationship()
const { data: session, status } = useSession()
const { showAlert } = useDialog()
const router = useRouter()
const searchParams = useSearchParams()
const [viewMode, setViewMode] = useState<ViewMode>("traditional")
@@ -641,7 +643,7 @@ export default function TreePage() {
// 导出 PDF(按世代导出成员信息)
const handleExportPDF = useCallback(async () => {
if (!treeData.members || Object.keys(treeData.members).length === 0) {
alert('没有成员数据可导出')
await showAlert('没有成员数据可导出', "提示")
return
}
@@ -655,9 +657,9 @@ export default function TreePage() {
await exportFamilyHTML(members, getMemberName, treeName, baseUrl)
} catch (error) {
console.error('导出PDF失败:', error)
alert('导出失败,请重试')
await showAlert('导出失败,请重试', "错误")
}
}, [treeData.members, currentTree?.name])
}, [treeData.members, currentTree?.name, showAlert])
// 未登录时不渲染内容(已在 useEffect 中重定向)
if (status === 'loading' || !session) {