框架(看板): 作品详情增规划区块(读 example_planning_section,大纲/细纲/设定+状态)

This commit is contained in:
zizi 2026-07-31 22:43:39 +08:00
parent e7b5100ba5
commit 777a0f3cd1

View File

@ -335,10 +335,21 @@ def view_work(wid):
f"<tbody>{trs}</tbody></table></div>")
else:
chap = empty_gap("还没有章节", "")
if table_exists("example_planning_section"):
_, secs = q("SELECT section_type, target_chapter, version, state FROM example_planning_section "
"WHERE work_id=%s AND deleted=false ORDER BY section_type, target_chapter NULLS FIRST, version DESC",
(wid,))
plan = ("<div class='card'><div class='hd'>规划(大纲 / 细纲 / 设定)</div><table><thead>"
"<tr><th>类型</th><th class='num'>章</th><th class='num'>版本</th><th>状态</th></tr></thead><tbody>"
+ "".join(f"<tr><td>{esc(s[0])}</td><td class='num'>{esc(s[1]) if s[1] is not None else '—'}</td>"
f"<td class='num'>{esc(s[2])}</td><td>{chip(s[3])}</td></tr>" for s in secs)
+ "</tbody></table></div>") if secs else "<div class='empty'>规划表已建 · 暂无规划(planner 落库后显示)</div>"
else:
plan = empty_gap("规划 · 待落库", "规划表(100)未建。")
body = (f"<div class='crumb'><a href='/works'>作品</a> / {esc(title)}</div>"
f"<h1>{esc(title)} <span style='font-size:14px'>{chip(status)}</span></h1>"
f"<p class='note'>{esc(genre)} · {fmt_num(wc)} 字 · {esc(cc)} 章</p>"
f"<p class='note'>{esc(summary)}</p>{chap}")
f"<p class='note'>{esc(summary)}</p>{chap}<h2>规划</h2>{plan}")
return layout(title, body, "/works")