feat: 优化回路数计算逻辑,提升报表准确性

This commit is contained in:
dmy
2026-01-07 16:55:11 +08:00
parent 87cea6ed86
commit f2a960e789
3 changed files with 59 additions and 54 deletions

10
gui.py
View File

@@ -781,8 +781,12 @@ def index():
total_length_m = sum(d["length"] for d in res["eval"]["details"])
total_length_km = total_length_m / 1000
# 获取回路数 (通过统计从升压站发出的连接)
n_circuits = sum(1 for d in res["eval"]["details"] if d["source"] == "substation" or d["target"] == "substation")
row_dict = {
"name": name_display,
"n_circuits": n_circuits,
"cost_wan": f"{res['cost'] / 10000:.2f}",
"loss_kw": f"{res['loss']:.2f}",
"total_length": f"{total_length_km:.2f}",
@@ -938,6 +942,12 @@ def index():
"required": True,
"align": "left",
},
{
"name": "n_circuits",
"label": "回路数",
"field": "n_circuits",
"sortable": True,
},
{
"name": "cost_wan",
"label": "总投资 (万元)",