This commit is contained in:
2026-03-11 15:31:36 +08:00
parent 2741839cf3
commit 058e355d77

View File

@@ -2207,13 +2207,19 @@
try {
// 从当前 URL 中解析报告编号,路径形如 /reports/qygl/:id
var path = window.location.pathname || "";
var match = path.match(/\\/reports\\/qygl\\/([^/]+)/);
if (!match || !match[1]) {
var segments = path.split("/");
var reportId = null;
for (var i = 0; i < segments.length; i++) {
if (segments[i] === "qygl" && i + 1 < segments.length && segments[i + 1]) {
reportId = segments[i + 1];
break;
}
}
if (!reportId) {
console.error("无法从当前 URL 解析报告编号,路径为", path);
restoreBtn();
return;
}
var reportId = match[1];
var pdfUrl = "/reports/qygl/" + encodeURIComponent(reportId) + "/pdf";
// 通过 fetch 获取 PDF 二进制并触发下载