feat: 预算按战略地图隔离(map_id) — 切换地图数据区分

问题: 预算数据无map_id, 两地图共用KPI时预算无法区分(切地图数据均显示)
修复:
- budget_plans 加 map_id 字段+索引
- list 支持 map_id 过滤(含NULL历史预算兼容迁移)
- create 收 map_id + 去重键含map_id(同KPI不同地图可各自预算)
- 前端: loadBudget/loadStrategyBudget 传 map_id, 保存带 map_id
- 端到端验证: 地图51 F_REVENUE 300(map_id=51) 地图51显示/地图32不显示 ✓
pytest 35+11 passed, 部署
This commit is contained in:
Hermes CI Fix
2026-08-27 17:33:57 +08:00
parent 3c64dc767e
commit fd814462a2
3 changed files with 15 additions and 6 deletions
+1
View File
@@ -9,6 +9,7 @@ class BudgetPlan(Base):
id = Column(Integer, primary_key=True, index=True)
entity_id = Column(Integer, default=1, comment="企业ID (P2多租户隔离 2026-08-23)")
map_id = Column(Integer, nullable=True, comment="归属战略地图ID (预算按地图隔离 2026-08-27)")
kpi_id = Column(Integer, ForeignKey("kpi_definitions.id"), nullable=False, comment="关联KPI")
period = Column(String(20), nullable=False, comment="预算期间 2026-05")
budget_value = Column(Float, nullable=False, comment="预算值")