fix: 恢复5个被CI覆盖的前端文件+成本数据+预警定时器

- 从.bak恢复: BudgetManagement(72%代码丢失)/KPIList/DeviationDashboard/MapReview/NodeEditDialog
- 注册4个缺失后端API模块到main.py
- 新增3个前端路由(管理报表/战略执行看板/杜邦分析)
- 修复改善行动路由指向ActionPlanLibrary(原指向AlertList)
- deploy.sh增加git pull步骤
- 运行成本种子数据: 29标准成本+31实际成本+10ABC+25分配
- 补充非财务KPI预算: 72条(客户/流程/学习维度)
- 配置预警cron: 每30分钟自动检查
This commit is contained in:
Hermes CI Fix
2026-07-13 09:52:06 +08:00
parent b26046349c
commit 957dacd248
9 changed files with 994 additions and 507 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env python3
"""补充非财务KPI预算数据 — 客户/流程/学习维度
运行: python3 scripts/seed_nonfinance_budget.py
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app.database import get_session_local
from app.models import KPIDefinition, BudgetPlan
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] %(message)s')
logger = logging.getLogger("seed_nonfinance")
def seed():
db = get_session_local()()
try:
kpi_map = {k.kpi_code: k.id for k in db.query(KPIDefinition).all()}
codes = ["C_SATISFACTION", "C_NEW_CLIENTS", "P_DELIVERY", "P_BUG_RATE", "L_TRAINING", "L_EMPLOYEE_SAT"]
# 年度预算值
annual_budget = {
"C_SATISFACTION": 92, "C_NEW_CLIENTS": 120,
"P_DELIVERY": 95, "P_BUG_RATE": 2,
"L_TRAINING": 90, "L_EMPLOYEE_SAT": 85,
}
cnt = 0
existing = set((r.kpi_id, r.period) for r in db.query(BudgetPlan).all())
for code in codes:
kid = kpi_map.get(code)
if not kid: continue
annual = annual_budget[code]
for month in range(1, 13):
if (kid, f"2026-{month:02d}") in existing:
continue
db.add(BudgetPlan(
kpi_id=kid, period=f"2026-{month:02d}",
budget_value=annual if code != "C_NEW_CLIENTS" else annual / 12,
budget_year=2026, budget_month=month,
version="v1.0", status="active",
))
cnt += 1
db.commit()
logger.info(f"✅ 补充非财务预算: {cnt}")
logger.info(f"📊 预算总数: {db.query(BudgetPlan).count()}")
except Exception as e:
db.rollback()
logger.error(f"❌ 失败: {e}")
finally:
db.close()
if __name__ == "__main__":
seed()