feat: KPI通用化 — 五档评分/三级分解树/因果链追踪
This commit is contained in:
@@ -293,6 +293,19 @@ class BscLayerConfig(Base):
|
||||
kpi_count_max = Column(Integer, default=5, comment="最多KPI数")
|
||||
|
||||
|
||||
class KPIHierarchy(Base):
|
||||
"""KPI层级关系 — 公司→部门→个人三级分解"""
|
||||
__tablename__ = "kpi_hierarchy"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
entity_id = Column(Integer, ForeignKey("entities.id"), default=1, comment="企业ID")
|
||||
parent_kpi_id = Column(Integer, ForeignKey("kpi_definitions.id"), nullable=False, comment="上级KPI")
|
||||
child_kpi_id = Column(Integer, ForeignKey("kpi_definitions.id"), nullable=False, comment="下级KPI")
|
||||
level = Column(Integer, default=1, comment="1=公司级 2=部门级 3=个人级")
|
||||
weight = Column(Float, default=1.0, comment="下级对上级的贡献权重(%)")
|
||||
child_name = Column(String(200), nullable=True, comment="下级节点名称(个人或部门名)")
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
# 兼容性: P2开发新增的模板API需要的模型
|
||||
# KPIDefinition 已存在,KPITemplate映射到同一定义
|
||||
KPITemplate = KPIDefinition
|
||||
|
||||
Reference in New Issue
Block a user