f
This commit is contained in:
@@ -2207,13 +2207,19 @@
|
|||||||
try {
|
try {
|
||||||
// 从当前 URL 中解析报告编号,路径形如 /reports/qygl/:id
|
// 从当前 URL 中解析报告编号,路径形如 /reports/qygl/:id
|
||||||
var path = window.location.pathname || "";
|
var path = window.location.pathname || "";
|
||||||
var match = path.match(/\\/reports\\/qygl\\/([^/]+)/);
|
var segments = path.split("/");
|
||||||
if (!match || !match[1]) {
|
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);
|
console.error("无法从当前 URL 解析报告编号,路径为", path);
|
||||||
restoreBtn();
|
restoreBtn();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var reportId = match[1];
|
|
||||||
var pdfUrl = "/reports/qygl/" + encodeURIComponent(reportId) + "/pdf";
|
var pdfUrl = "/reports/qygl/" + encodeURIComponent(reportId) + "/pdf";
|
||||||
|
|
||||||
// 通过 fetch 获取 PDF 二进制并触发下载
|
// 通过 fetch 获取 PDF 二进制并触发下载
|
||||||
|
|||||||
Reference in New Issue
Block a user