KPI通用化: bsc_layer_config表+API+企业选择器+企业CRUD

This commit is contained in:
Hermes CI Fix
2026-07-19 10:07:46 +08:00
parent 59f4ab2c76
commit c57f377e04
7 changed files with 194 additions and 10 deletions
+11
View File
@@ -282,6 +282,17 @@ class BiReport(Base):
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
class BscLayerConfig(Base):
"""BSC四层配置 — 不同企业的权重配置"""
__tablename__ = "bsc_layer_config"
id = Column(Integer, primary_key=True, index=True)
entity_id = Column(Integer, ForeignKey("entities.id"), nullable=False, comment="企业ID")
layer = Column(String(20), nullable=False, comment="financial/customer/process/learning")
weight = Column(Float, nullable=False, comment="该层权重(%")
kpi_count_min = Column(Integer, default=2, comment="最少KPI数")
kpi_count_max = Column(Integer, default=5, comment="最多KPI数")
# 兼容性: P2开发新增的模板API需要的模型
# KPIDefinition 已存在,KPITemplate映射到同一定义
KPITemplate = KPIDefinition