- 修复前端路由守卫:未登录时不显示提示,直接跳转登录页 - 修复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>
139 lines
4.4 KiB
Python
139 lines
4.4 KiB
Python
"""
|
|
资产调拨相关的Pydantic Schema
|
|
"""
|
|
from typing import Optional, List, Dict, Any
|
|
from datetime import datetime
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
# ===== 调拨单Schema =====
|
|
|
|
class AssetTransferOrderBase(BaseModel):
|
|
"""调拨单基础Schema"""
|
|
source_org_id: int = Field(..., gt=0, description="调出网点ID")
|
|
target_org_id: int = Field(..., gt=0, description="调入网点ID")
|
|
transfer_type: str = Field(..., description="调拨类型(internal=内部调拨/external=跨机构调拨)")
|
|
title: str = Field(..., min_length=1, max_length=200, description="标题")
|
|
remark: Optional[str] = Field(None, description="备注")
|
|
|
|
|
|
class AssetTransferOrderCreate(AssetTransferOrderBase):
|
|
"""创建调拨单Schema"""
|
|
asset_ids: List[int] = Field(..., min_items=1, description="资产ID列表")
|
|
|
|
|
|
class AssetTransferOrderUpdate(BaseModel):
|
|
"""更新调拨单Schema"""
|
|
title: Optional[str] = Field(None, min_length=1, max_length=200, description="标题")
|
|
remark: Optional[str] = Field(None, description="备注")
|
|
|
|
|
|
class AssetTransferOrderStart(BaseModel):
|
|
"""开始调拨Schema"""
|
|
remark: Optional[str] = Field(None, description="开始备注")
|
|
|
|
|
|
class AssetTransferOrderComplete(BaseModel):
|
|
"""完成调拨Schema"""
|
|
remark: Optional[str] = Field(None, description="完成备注")
|
|
|
|
|
|
class AssetTransferOrderInDB(BaseModel):
|
|
"""数据库中的调拨单Schema"""
|
|
id: int
|
|
order_code: str
|
|
source_org_id: int
|
|
target_org_id: int
|
|
transfer_type: str
|
|
title: str
|
|
asset_count: int
|
|
apply_user_id: int
|
|
apply_time: datetime
|
|
approval_status: str
|
|
approval_user_id: Optional[int]
|
|
approval_time: Optional[datetime]
|
|
approval_remark: Optional[str]
|
|
execute_status: str
|
|
execute_user_id: Optional[int]
|
|
execute_time: Optional[datetime]
|
|
remark: Optional[str]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class AssetTransferOrderResponse(AssetTransferOrderInDB):
|
|
"""调拨单响应Schema"""
|
|
pass
|
|
|
|
|
|
class AssetTransferOrderWithRelations(AssetTransferOrderResponse):
|
|
"""带关联信息的调拨单响应Schema"""
|
|
source_organization: Optional[Dict[str, Any]] = None
|
|
target_organization: Optional[Dict[str, Any]] = None
|
|
apply_user: Optional[Dict[str, Any]] = None
|
|
approval_user: Optional[Dict[str, Any]] = None
|
|
execute_user: Optional[Dict[str, Any]] = None
|
|
items: Optional[List[Dict[str, Any]]] = None
|
|
|
|
|
|
class AssetTransferOrderQueryParams(BaseModel):
|
|
"""调拨单查询参数"""
|
|
transfer_type: Optional[str] = Field(None, description="调拨类型")
|
|
approval_status: Optional[str] = Field(None, description="审批状态")
|
|
execute_status: Optional[str] = Field(None, description="执行状态")
|
|
source_org_id: Optional[int] = Field(None, gt=0, description="调出网点ID")
|
|
target_org_id: Optional[int] = Field(None, gt=0, description="调入网点ID")
|
|
keyword: Optional[str] = Field(None, description="搜索关键词")
|
|
page: int = Field(default=1, ge=1, description="页码")
|
|
page_size: int = Field(default=20, ge=1, le=100, description="每页数量")
|
|
|
|
|
|
class AssetTransferOrderListResponse(BaseModel):
|
|
"""调拨单列表响应Schema"""
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
total_pages: int
|
|
items: List[AssetTransferOrderWithRelations]
|
|
|
|
|
|
class AssetTransferStatistics(BaseModel):
|
|
"""调拨单统计Schema"""
|
|
total: int = Field(..., description="总数")
|
|
pending: int = Field(..., description="待审批数")
|
|
approved: int = Field(..., description="已审批数")
|
|
rejected: int = Field(..., description="已拒绝数")
|
|
executing: int = Field(..., description="执行中数")
|
|
completed: int = Field(..., description="已完成数")
|
|
|
|
|
|
# ===== 调拨单明细Schema =====
|
|
|
|
class AssetTransferItemBase(BaseModel):
|
|
"""调拨单明细基础Schema"""
|
|
asset_id: int = Field(..., gt=0, description="资产ID")
|
|
remark: Optional[str] = Field(None, description="备注")
|
|
|
|
|
|
class AssetTransferItemInDB(BaseModel):
|
|
"""数据库中的调拨单明细Schema"""
|
|
id: int
|
|
order_id: int
|
|
asset_id: int
|
|
asset_code: str
|
|
source_organization_id: int
|
|
target_organization_id: int
|
|
transfer_status: str
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class AssetTransferItemResponse(AssetTransferItemInDB):
|
|
"""调拨单明细响应Schema"""
|
|
pass
|