fix: Export PDF with org id

pull/15897/head
wangruidong 2025-08-21 17:42:18 +08:00 committed by 老广
parent 87b456c941
commit 9551cd4da9
1 changed files with 4 additions and 1 deletions

View File

@ -72,7 +72,9 @@ def export_chart_to_pdf(chart_name, sessionid, request=None):
if settings.DEBUG_DEV: if settings.DEBUG_DEV:
url = url.replace(":8080", ":9528") url = url.replace(":8080", ":9528")
days = request.GET.get('days', 7) days = request.GET.get('days', 7)
url = url + f"?days={days}" oid = request.COOKIES.get("X-JMS-ORG")
days = request.GET.get('days', 7)
url = url + f"?days={days}&oid={oid}"
with sync_playwright() as p: with sync_playwright() as p:
lang = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME) lang = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME)
@ -93,6 +95,7 @@ def export_chart_to_pdf(chart_name, sessionid, request=None):
page = context.new_page() page = context.new_page()
try: try:
page.goto(url, wait_until='networkidle') page.goto(url, wait_until='networkidle')
page.wait_for_selector('.charts-zone', timeout=10000)
page_title = page.title() page_title = page.title()
print(f"Page title: {page_title}") print(f"Page title: {page_title}")
pdf_bytes = page.pdf(format="A4", landscape=True, pdf_bytes = page.pdf(format="A4", landscape=True,