feat: 决策240/241——子级工料机二次合并视野与换码贯通、AdminCost 封存及台账更新

This commit is contained in:
lianjianwei2024
2026-10-30 12:39:32 +08:00
parent b79c0df557
commit 386e1ad624
15 changed files with 15885 additions and 29 deletions

View File

@@ -737,14 +737,17 @@ def rows_of(conn, tab_id):
def sheet_payload(conn, tab_id):
if conn.execute("SELECT id FROM tabs WHERE id = ?", (tab_id,)).fetchone() is None:
tab_row = conn.execute(
"SELECT id, element FROM tabs WHERE id = ?", (tab_id,)
).fetchone()
if tab_row is None:
raise AppError(404, "标签不存在")
# 打开工作区时再对一次:行的多少 / 顺序 / 后缀名永远跟后缀设置一致
if sync_rows_to_suffixes(conn):
conn.commit()
columns = []
for r in conn.execute(
"SELECT id, name, kind, width FROM columns WHERE tab_id = ?"
"SELECT id, name, kind, width, std_name FROM columns WHERE tab_id = ?"
" ORDER BY sort_order ASC, id ASC",
(tab_id,),
):
@@ -754,7 +757,8 @@ def sheet_payload(conn, tab_id):
"name": r["name"],
"kind": r["kind"],
"width": r["width"],
"locked": r["kind"] in ("index", "suffix", "anchor", "action", "anchorline"),
"stdName": r["std_name"] or "",
"locked": r["kind"] in ("index", "suffix", "action", "anchorline"),
"hasValues": has_value(conn, r["id"])
if r["kind"] in ("custom", "anchor")
else False,
@@ -786,7 +790,14 @@ def sheet_payload(conn, tab_id):
):
if r["value"]:
cells["%d:%d" % (r["col_id"], r["row_id"])] = r["value"]
return {"tabId": tab_id, "columns": columns, "groups": groups, "rows": rows, "cells": cells}
return {
"tabId": tab_id,
"element": tab_row["element"] or "",
"columns": columns,
"groups": groups,
"rows": rows,
"cells": cells,
}
# ---------------------------------------------------------------- 业务逻辑
@@ -834,9 +845,10 @@ def build_state():
"parentId": r["parent_id"],
"nodeKind": r["node_kind"],
"collapsed": bool(r["collapsed"]),
"element": r["element"] or "",
}
for r in conn.execute(
"SELECT id, name, is_fixed, parent_id, node_kind, collapsed FROM tabs"
"SELECT id, name, is_fixed, parent_id, node_kind, collapsed, element FROM tabs"
" ORDER BY is_fixed DESC, sort_order ASC, id ASC"
)
]