This commit is contained in:
2026-03-18 01:34:34 +08:00
parent 82113b3bf7
commit 0625388ab2

View File

@@ -46,8 +46,8 @@ func (s *ReportPDFService) GenerateReportPDF(ctx context.Context, orderId, order
var pdfBuf []byte
err := chromedp.Run(ctxt,
chromedp.Navigate(reportURL),
// 等待报告主体区域渲染完成(数据加载并成功渲染后才会出现
chromedp.WaitVisible(`.pc-report-body`, chromedp.ByQuery),
// 等待前端标记报告渲染完成ReportPC.vue 中设置 window.__REPORT_READY__ = true
chromedp.Poll(`window.__REPORT_READY__ === true`, nil, chromedp.WithPollingInterval(200*time.Millisecond)),
chromedp.ActionFunc(func(ctx context.Context) error {
buf, _, pdfErr := page.PrintToPDF().
WithPrintBackground(true).