fix: 战略地图模板KPI字段同步到map_objectives表
This commit is contained in:
@@ -285,6 +285,7 @@ def _sync_map_objectives(m, db):
|
|||||||
name=obj.get("name", ""),
|
name=obj.get("name", ""),
|
||||||
description=obj.get("description", ""),
|
description=obj.get("description", ""),
|
||||||
icon=obj.get("icon", "target"),
|
icon=obj.get("icon", "target"),
|
||||||
|
kpis=obj.get("kpis", []),
|
||||||
sort_order=i,
|
sort_order=i,
|
||||||
)
|
)
|
||||||
db.add(mo)
|
db.add(mo)
|
||||||
@@ -307,7 +308,7 @@ def _merge_map_objectives(m, db):
|
|||||||
for dim in dims:
|
for dim in dims:
|
||||||
key = dim.get("key", "")
|
key = dim.get("key", "")
|
||||||
if key in grouped:
|
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
|
m.dimensions = dims
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ class MapObjective(Base):
|
|||||||
name = Column(String(200), nullable=False, comment="目标名称")
|
name = Column(String(200), nullable=False, comment="目标名称")
|
||||||
description = Column(Text, nullable=True, comment="描述")
|
description = Column(Text, nullable=True, comment="描述")
|
||||||
icon = Column(String(50), default="target", comment="图标标识")
|
icon = Column(String(50), default="target", comment="图标标识")
|
||||||
|
kpis = Column(JSON, nullable=True, comment="关联KPI编码数组")
|
||||||
sort_order = Column(Integer, default=0, comment="排序")
|
sort_order = Column(Integer, default=0, comment="排序")
|
||||||
created_at = Column(DateTime, server_default=func.now())
|
created_at = Column(DateTime, server_default=func.now())
|
||||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
||||||
|
|||||||
Reference in New Issue
Block a user