feat(dashboard): archive daily report from page data

Generate the standalone daily report HTML from the dashboard data already loaded in the H5 page, keeping the archived page visually aligned with the mobile dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
danaisuiyuan
2026-05-11 13:21:35 +08:00
parent 403ffe0fde
commit 9a4a5f2339
2 changed files with 219 additions and 2 deletions

View File

@@ -3,7 +3,8 @@ import { useMemo, useState } from 'react'
import { MiniTrendChart } from '../../../components/charts/MiniTrendChart'
import { KpiCard } from '../../../components/kpi/KpiCard'
import { formatMoney, formatNumber } from '../../../utils/format'
import { downloadDailyReportArchive, useDashboardOverview } from '../api'
import { useDashboardOverview } from '../api'
import { buildDailyReportArchiveHtml } from '../archive'
import type { DashboardOverview, RiskLevel, SnapshotSlot, TodaySnapshot } from '../types'
const snapshotStatusMeta = {
@@ -187,7 +188,8 @@ export function DailyReportPage() {
const handleArchive = async () => {
try {
setIsArchiving(true)
const blob = await downloadDailyReportArchive(data.businessDate)
const html = buildDailyReportArchiveHtml(data)
const blob = new Blob([html], { type: 'text/html;charset=utf-8' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url