fix: 战略地图模板KPI字段同步到map_objectives表

This commit is contained in:
Hermes CI Fix
2026-07-20 15:20:11 +08:00
parent 1e0262e162
commit 4ef50d083e
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -285,6 +285,7 @@ def _sync_map_objectives(m, db):
name=obj.get("name", ""),
description=obj.get("description", ""),
icon=obj.get("icon", "target"),
kpis=obj.get("kpis", []),
sort_order=i,
)
db.add(mo)
@@ -307,7 +308,7 @@ def _merge_map_objectives(m, db):
for dim in dims:
key = dim.get("key", "")
if key in grouped:
dim["objectives"] = [{"name": o.name, "description": o.description or "", "icon": o.icon or "target"} for o in grouped[key]]
dim["objectives"] = [{"name": o.name, "description": o.description or "", "icon": o.icon or "target", "kpis": o.kpis or []} for o in grouped[key]]
m.dimensions = dims
+1
View File
@@ -223,6 +223,7 @@ class MapObjective(Base):
name = Column(String(200), nullable=False, comment="目标名称")
description = Column(Text, nullable=True, comment="描述")
icon = Column(String(50), default="target", comment="图标标识")
kpis = Column(JSON, nullable=True, comment="关联KPI编码数组")
sort_order = Column(Integer, default=0, comment="排序")
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())