From 8a7273dd578eecf1a2d71d4bf9674f9cd4792d79 Mon Sep 17 00:00:00 2001 From: duxin Date: Thu, 9 Jul 2026 13:27:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=BC=8F=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=AD=A5=E6=95=B0=E7=94=A8=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E8=84=89=E5=86=B2=E6=95=B0=E8=80=8C=E9=9D=9E=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8F=20(87=E2=86=9230)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 旧: total_steps = 4 + 63 + 20 = 87 (但大部分步骤不发脉冲) 新: total_steps = 4 + 63//10 + 20 = 30 (与 _next 调用次数一致) --- src/postprocessing/report_word.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/postprocessing/report_word.py b/src/postprocessing/report_word.py index 8d57cf2..ef3a022 100644 --- a/src/postprocessing/report_word.py +++ b/src/postprocessing/report_word.py @@ -956,14 +956,14 @@ class WaterQualityReportGenerator: else: output_path = Path(output_path) - # 扫描实际数据量 + # 扫描实际数据量,计算进度脉冲数(非数据量本身) csv_files = sorted(csv_dir.glob("*.csv")) if csv_dir.is_dir() else [] tif_files = (sorted(thematic_dir.glob("*.tif")) + sorted(thematic_dir.glob("*.png")) ) if thematic_dir.is_dir() else [] n_csv = len(csv_files) - n_maps = min(len(tif_files), 20) # 最多展示 20 张 - n_fixed = 4 # 封面 + 背景 + 预处理 + 总结 - total_steps = n_fixed + n_csv + n_maps + n_maps = min(len(tif_files), 20) + n_csv_pulses = max(1, n_csv // 10) # 每 10 个 CSV 一次脉冲 + total_steps = 4 + n_csv_pulses + n_maps # 固定章节 + 统计脉冲 + 每张专题图 print(f"[公式报告] 数据: {n_csv} CSV, {len(tif_files)} 专题图 → 总步数 {total_steps}") progress = self._create_progress(total=total_steps, desc="生成公式报告", on_step=on_progress)