diff --git a/AdminCost/app.py b/AdminCost/app.py index a793835..456b00c 100644 --- a/AdminCost/app.py +++ b/AdminCost/app.py @@ -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" ) ] diff --git a/AdminCost/index.html b/AdminCost/index.html index f596243..e427de9 100644 --- a/AdminCost/index.html +++ b/AdminCost/index.html @@ -307,6 +307,20 @@ .wrap.sheet-view{gap:0;} .sheet-bar{display:flex;align-items:center;gap:12px;margin:0 0 6px;min-height:30px;} .sheet-bar .spacer{margin-left:auto;} + .sheet-bar .view-sw{display:inline-flex;} + .sheet-bar .btn.on{border-color:#2b6cb8;color:#1d4e89;background:#eaf2fd;} + /* 字段对照矩阵 */ + table.sheet.mx td.mx-std{color:#6b7280;font-size:12px;white-space:nowrap;} + td.mx-cell{cursor:text;min-width:110px;height:28px;} + td.mx-cell[contenteditable="true"]{outline:2px solid #2b6cb8;background:#fff;} + td.mx-cell .mx-empty{color:#c9cfd8;} + /* 值设置弹框 */ + .val-pick{margin:8px 0 4px;font-size:13px;} + .val-pick select{font:inherit;padding:2px 6px;} + .val-grid{max-height:52vh;overflow:auto;border:1px solid #e3e7ee;margin-top:6px;} + .val-grid table{border-collapse:collapse;width:100%;} + .val-grid th,.val-grid td{border-bottom:1px solid #eef1f5;padding:5px 8px;font-size:13px;text-align:left;white-space:nowrap;} + .val-grid input{width:110px;font:inherit;padding:2px 6px;border:1px solid #d5dae2;} .sheet-rule{height:2px;border-radius:1px;background:var(--accent);margin:0 0 5px;} .save-flag{font-size:12px;color:#15803d;opacity:0;transition:opacity .25s;} .save-flag.show{opacity:1;} @@ -618,6 +632,19 @@ + +