fix: 市场改为勾选列表,楼宇结果输出改为 GBK

This commit is contained in:
nixevol
2026-09-16 17:33:41 +08:00
parent 53c5979917
commit 4cef0b769e
6 changed files with 27 additions and 21 deletions
+15 -10
View File
@@ -23,15 +23,20 @@ def render():
except (OSError, sqlite3.Error, ValueError) as error:
st.warning(f"市场边界不可用:{error}")
st.markdown("#### 2 · 选择市场与参数")
# 市场勾选必须放在 form 外,否则取消“全部”后多选框不会立刻解除 disabled。
all_markets = st.checkbox("处理全部市场", value=True, disabled=not options)
labels = {fid: f"{fid} · {name}" for fid, name in options}
chosen = st.multiselect(
"指定市场",
list(labels),
format_func=labels.get,
disabled=all_markets or not options,
)
# 勾选交互放在 form 外;用复选框列表代替 multiselect,避免下拉被页面样式挡住。
all_markets = st.checkbox("处理全部市场", value=True, disabled=not options, key="market_all")
chosen = []
if options and not all_markets:
st.caption("指定市场")
with st.container(height=280, border=True):
for fid, name in options:
if st.checkbox(f"{fid} · {name}", key=f"market_pick_{fid}"):
chosen.append(fid)
elif options:
st.caption(f"将处理全部 {len(options)} 个市场")
else:
st.caption("请先导入可用的市场边界。")
with st.form("market_run"):
c1, c2, c3 = st.columns(3)
params["MAX_WORKERS"] = c1.number_input("并行进程数", 1, 16, 4)
@@ -48,7 +53,7 @@ def render():
params["PROJECT_EXTENT_PADDING_RATIO"] = st.number_input("地图留白比例", 0.0, 1.0, 0.05, 0.01)
submitted = st.form_submit_button("开始生成", type="primary", disabled=not options)
if submitted:
params["SELECTED_MARKET_IDS"] = list(labels) if all_markets else chosen
params["SELECTED_MARKET_IDS"] = [fid for fid, _ in options] if all_markets else chosen
try:
if any(value is None for key, value in params.items() if key in SOURCES and (key != "CELL_DATA_GPKG" or params["SUMMARY_OUTPUT_ENABLED"])):
raise ValueError("请完成所需数据的导入。")