Files
cma-management/backend/app/models/budget_plan.py
T
Hermes CI Fix 3dddd36866 init: 管理会计OS初始代码
包含前后端完整代码:
- 前端:Vue3+Vite+ElementPlus
- 后端:FastAPI+SQLAlchemy
- 模块:驾驶舱/KPI/战略地图/预警/预算/成本/预测/改善行动
- 当前版本:v1.0.0
2026-05-28 17:32:22 +08:00

22 lines
1.1 KiB
Python

"""预算计划模型 — 管理会计OS"""
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey, Text, func
from app.database import Base
class BudgetPlan(Base):
"""预算计划 — 按KPI按月分解的目标值"""
__tablename__ = "budget_plans"
id = Column(Integer, primary_key=True, index=True)
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="预算值")
budget_year = Column(Integer, nullable=False, comment="预算年份")
budget_month = Column(Integer, nullable=False, comment="预算月份 1-12")
version = Column(String(20), default="v1.0", comment="版本号 v1.0/v2.0")
status = Column(String(20), default="active", comment="active/archived")
remark = Column(String(500), nullable=True, comment="备注")
created_by = Column(String(100), nullable=True)
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())