MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / bindReportsEvents

Function bindReportsEvents

deployments/desktop/static/reports.js:409–449  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407 }
408
409 function bindReportsEvents() {
410 byId("userSelect")?.addEventListener("change", () => {
411 if (document.querySelector('[data-view="reports"]')?.classList.contains("active")) {
412 refreshReports({ keepSelection: false }).catch(console.error);
413 }
414 });
415 byId("refreshReportsBtn")?.addEventListener("click", () => runAction(() => refreshReports({ keepSelection: true })));
416 byId("reportDays")?.addEventListener("change", () => runAction(() => refreshReports({ keepSelection: false })));
417 byId("reportDate")?.addEventListener("change", () => runAction(() => refreshReports({ keepSelection: false })));
418 byId("reportsCurrentOnly")?.addEventListener("change", () => runAction(() => refreshReports({ keepSelection: false })));
419 byId("reportQuery")?.addEventListener("keydown", (event) => {
420 if (event.key === "Enter") runAction(() => refreshReports({ keepSelection: false }));
421 });
422 byId("reportTodayBtn")?.addEventListener("click", () => {
423 byId("reportDate").value = new Date().toISOString().slice(0, 10);
424 runAction(() => refreshReports({ keepSelection: false }));
425 });
426 byId("reportsList")?.addEventListener("click", (event) => {
427 const button = event.target.closest("[data-report-id]");
428 if (button) runAction(() => loadReportContent(button.dataset.reportId));
429 });
430 ["reportList", "directReportList"].forEach((id) => {
431 byId(id)?.addEventListener("click", (event) => {
432 const button = event.target.closest("[data-open-report]");
433 if (button) runAction(() => jumpToReport(button.dataset.openReport));
434 });
435 });
436 ["openReportAbsBtn", "openReportPdfBtn", "openReportDocBtn"].forEach((id) => {
437 byId(id)?.addEventListener("click", () => {
438 const href = byId(id).dataset.href;
439 if (href) window.open(href, "_blank", "noopener,noreferrer");
440 });
441 });
442 byId("copyReportPathBtn")?.addEventListener("click", async () => {
443 const path = byId("copyReportPathBtn").dataset.path || "";
444 if (!path) return;
445 if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(path);
446 else window.prompt("复制报告路径", path);
447 setStatus("报告路径已复制");
448 });
449 }
450
451 function init() {
452 ensureReportsDom();

Callers 1

initFunction · 0.85

Calls 6

byIdFunction · 0.85
jumpToReportFunction · 0.85
refreshReportsFunction · 0.70
runActionFunction · 0.70
loadReportContentFunction · 0.70
setStatusFunction · 0.70

Tested by

no test coverage detected