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