diff --git a/backend/app/__pycache__/main.cpython-312.pyc b/backend/app/__pycache__/main.cpython-312.pyc index 1ab30f56..e531c0e9 100644 Binary files a/backend/app/__pycache__/main.cpython-312.pyc and b/backend/app/__pycache__/main.cpython-312.pyc differ diff --git a/backend/scripts/seed_nonfinance_budget.py b/backend/scripts/seed_nonfinance_budget.py new file mode 100644 index 00000000..1c7a58da --- /dev/null +++ b/backend/scripts/seed_nonfinance_budget.py @@ -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() diff --git a/deploy.sh b/deploy.sh index c9965b52..9f7fda77 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,5 @@ #!/bin/bash -# 管理会计OS — 一键构建并部署到生产 +# 管理会计OS — 一键拉取、构建并部署到生产 set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" @@ -7,6 +7,12 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" echo "===== 管理会计OS 生产部署 =====" echo "" +# 0. 拉取最新代码 +echo "[0/4] 拉取最新代码..." +cd "$SCRIPT_DIR" +git pull origin main +echo " ✓ 代码已更新" + # 1. 构建前端 echo "[1/4] 构建前端..." cd "$SCRIPT_DIR/frontend" diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 339f87d7..1352c6b3 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -47,6 +47,7 @@ declare module 'vue' { ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] + ElSlider: typeof import('element-plus/es')['ElSlider'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] @@ -54,6 +55,7 @@ declare module 'vue' { ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElUpload: typeof import('element-plus/es')['ElUpload'] GaugeChart: typeof import('./src/components/charts/GaugeChart.vue')['default'] diff --git a/frontend/src/components/strategy-map/NodeEditDialog.vue b/frontend/src/components/strategy-map/NodeEditDialog.vue index 7f598b66..8220f69d 100644 --- a/frontend/src/components/strategy-map/NodeEditDialog.vue +++ b/frontend/src/components/strategy-map/NodeEditDialog.vue @@ -1,64 +1,56 @@ + + diff --git a/frontend/src/views/DeviationDashboard.vue b/frontend/src/views/DeviationDashboard.vue index 2dda9c50..0208a46c 100644 --- a/frontend/src/views/DeviationDashboard.vue +++ b/frontend/src/views/DeviationDashboard.vue @@ -10,13 +10,13 @@ - + - + @@ -26,37 +26,26 @@ 导出CSV - +
已录预算KPI
-
{{ stats.total_budget || 0 }}
+
{{ stats.total_kpis || 0 }}
- - + +
-
超预算(红色)
-
{{ stats.red_count || 0 }}
-
-
-
- - -
-
接近阈值(黄色)
-
{{ stats.yellow_count || 0 }}
-
-
-
- - -
-
正常达标
-
{{ stats.normal_count || 0 }}
+
{{ dim.icon }} {{ dim.name }}
+
+ {{ dim.summary.deviation_rate != null ? dim.summary.deviation_rate.toFixed(1) + '%' : '-' }} +
+
+ {{ dim.summary.has_budget }}/{{ dim.summary.count }} KPI有预算 +
@@ -97,71 +86,110 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +