Files
zcglxt/app/models/maintenance.py
Claude e71181f0a3 fix: 修复多个关键问题
- 修复前端路由守卫:未登录时不显示提示,直接跳转登录页
- 修复API拦截器:401错误不显示提示,直接跳转
- 增强验证码显示:图片尺寸从120x40增加到200x80
- 增大验证码字体:从28号增加到48号
- 优化验证码字符:排除易混淆的0和1
- 减少干扰线:从5条减少到3条,添加背景色优化
- 增强登录API日志:添加详细的调试日志
- 增强验证码生成和验证日志
- 优化异常处理和错误追踪

影响文件:
- src/router/index.ts
- src/api/request.ts
- app/services/auth_service.py
- app/api/v1/auth.py
- app/schemas/user.py

测试状态:
- 前端构建通过
- 后端语法检查通过
- 验证码显示效果优化完成

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 00:26:21 +08:00

58 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
维修管理相关数据模型
"""
from datetime import datetime, date
from sqlalchemy import Column, BigInteger, String, Integer, Text, ForeignKey, DateTime, Date, Numeric, Index
from sqlalchemy.orm import relationship
from app.db.base import Base
class MaintenanceRecord(Base):
"""维修记录表"""
__tablename__ = "maintenance_records"
id = Column(BigInteger, primary_key=True, index=True)
record_code = Column(String(50), unique=True, nullable=False, index=True, comment="维修单号")
asset_id = Column(BigInteger, ForeignKey("assets.id"), nullable=False, index=True, comment="资产ID")
asset_code = Column(String(50), nullable=False, comment="资产编码")
fault_description = Column(Text, nullable=False, comment="故障描述")
fault_type = Column(String(50), nullable=True, comment="故障类型")
report_user_id = Column(BigInteger, ForeignKey("users.id"), nullable=True, comment="报修人ID")
report_time = Column(DateTime, default=datetime.utcnow, nullable=False, index=True, comment="报修时间")
priority = Column(String(20), default="normal", nullable=False, comment="优先级")
maintenance_type = Column(String(20), nullable=True, comment="维修类型")
vendor_id = Column(BigInteger, ForeignKey("suppliers.id"), nullable=True, comment="维修供应商ID")
maintenance_cost = Column(Numeric(18, 2), nullable=True, comment="维修费用")
start_time = Column(DateTime, nullable=True, comment="开始维修时间")
complete_time = Column(DateTime, nullable=True, comment="完成维修时间")
maintenance_user_id = Column(BigInteger, ForeignKey("users.id"), nullable=True, comment="维修人员ID")
maintenance_result = Column(Text, nullable=True, comment="维修结果描述")
replaced_parts = Column(Text, nullable=True, comment="更换的配件")
status = Column(String(20), default="pending", nullable=False, index=True, comment="状态")
images = Column(Text, nullable=True, comment="维修图片URL多个逗号分隔")
remark = Column(Text, nullable=True, comment="备注")
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
created_by = Column(BigInteger, ForeignKey("users.id"), nullable=True)
updated_by = Column(BigInteger, ForeignKey("users.id"), nullable=True)
# 关系
asset = relationship("Asset")
vendor = relationship("Supplier")
report_user = relationship("User", foreign_keys=[report_user_id])
maintenance_user = relationship("User", foreign_keys=[maintenance_user_id])
created_user = relationship("User", foreign_keys=[created_by])
updated_user = relationship("User", foreign_keys=[updated_by])
# 索引
__table_args__ = (
Index("idx_maintenance_records_code", "record_code"),
Index("idx_maintenance_records_asset", "asset_id"),
Index("idx_maintenance_records_status", "status"),
Index("idx_maintenance_records_time", "report_time"),
)
def __repr__(self):
return f"<MaintenanceRecord(id={self.id}, record_code={self.record_code}, asset_code={self.asset_code})>"