feat: add DOCX export endpoint and button with watermark support

This commit is contained in:
hmo
2026-04-28 11:13:04 +08:00
parent 8067e0587e
commit f3233e2374
2 changed files with 130 additions and 1 deletions
+10 -1
View File
@@ -81,7 +81,10 @@ async function loadPlan() {
<button onclick="downloadPDFWithTemplate()" class="btn btn-sm btn-primary">
<i class="bi bi-download"></i> 下载PDF
</button>
<button onclick="downloadMDWithTemplate()" class="btn btn-sm btn-outline-primary">
<button onclick="downloadDOCXWithTemplate()" class="btn btn-sm btn-outline-primary">
<i class="bi bi-file-word"></i> 下载DOCX
</button>
<button onclick="downloadMDWithTemplate()" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-file-markdown"></i> 下载MD
</button>
</div>
@@ -138,6 +141,12 @@ function downloadMDWithTemplate() {
window.open(`/api/plans/${currentPlanId}/md${suffix}`, '_blank');
}
function downloadDOCXWithTemplate() {
const templateId = document.getElementById('reportTemplateSelect')?.value;
const suffix = templateId ? `?template_id=${templateId}` : '';
window.open(`/api/plans/${currentPlanId}/docx${suffix}`, '_blank');
}
async function loadTemplates() {
try {
const resp = await fetch('/templates/templates?type=report');