diff --git a/docs/drift/fetch-baseline.sh b/docs/drift/fetch-baseline.sh index 7ed43f9..387ff6c 100755 --- a/docs/drift/fetch-baseline.sh +++ b/docs/drift/fetch-baseline.sh @@ -176,6 +176,10 @@ if "report" in MODULES: print(f" reports: {len(result['reports'])}", file=sys.stderr) # ---- datascreen (大屏,独立子项目 blade_visual) ---- +# Round 15 (2026-07-15): 增补 config/component 字段 +# - baseline JSON 仅含元数据时, 组件级 diff 不可行 (BS-drift-DS-1 持久化问题无法定位) +# - 加 config (blade_visual_config) + component (blade_visual_component) 后 +# 可派生组件数 + 组件 name/title/prop/type if "datascreen" in MODULES: cur.execute(""" SELECT id, title, category, status, password, create_user, create_time, system_id @@ -184,8 +188,34 @@ if "datascreen" in MODULES: ORDER BY create_time """, (sysids,)) cols = [d[0] for d in cur.description] - result["datascreens"] = [dict(zip(cols, row)) for row in cur.fetchall()] - print(f" datascreens: {len(result['datascreens'])}", file=sys.stderr) + ds_rows = [] + for row in cur.fetchall(): + d = dict(zip(cols, row)) + visual_id = d["id"] + # 拉 config JSON + cur.execute("SELECT content FROM blade_visual_config WHERE visual_id = %s", (visual_id,)) + cfg_row = cur.fetchone() + cfg = None + if cfg_row and cfg_row[0]: + try: cfg = json.loads(cfg_row[0]) if isinstance(cfg_row[0], str) else cfg_row[0] + except: cfg = {"_raw": str(cfg_row[0])[:200]} + d["config"] = cfg + # 拉组件列表 + cur.execute(""" + SELECT name, component_type, prop_value + FROM blade_visual_component + WHERE visual_id = %s + ORDER BY name + """, (visual_id,)) + comps = [] + for crow in cur.fetchall(): + comps.append({"name": crow[0], "component_type": crow[1], "prop_value": crow[2]}) + d["components"] = comps + d["componentCount"] = len(comps) + d["componentNames"] = [c["name"] for c in comps][:50] + ds_rows.append(d) + result["datascreens"] = ds_rows + print(f" datascreens: {len(result['datascreens'])} (含 config + components)", file=sys.stderr) # 输出 with open("$OUTPUT", "w", encoding="utf-8") as f: