4453ee2ca0
后端: - 5个模块的 Create/Update schema 新增可选 manager_id 字段 - POST 端点: director/leader 可指定 manager_id,manager 角色自动用自身 - PUT 端点: director/leader 可修改 manager_id,manager 角色禁止修改 前端(移动端+桌面端共10个页面): - 支局长/领导可见「客户经理」下拉选择框 - 创建和编辑时均可指定记录归属的客户经理 - 涵盖今日拜访、今日纪要、工作计划、商机跟单、要客拜访五个模块 Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
2.0 KiB
Python
72 lines
2.0 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
import uuid
|
|
from datetime import date, datetime
|
|
|
|
|
|
class VisitCreate(BaseModel):
|
|
customer_id: uuid.UUID
|
|
visit_date: str # "YYYY-MM-DD"
|
|
visit_method: str = "上门"
|
|
time_range: str = ""
|
|
visitor_name: str = ""
|
|
visitor_phone: str = ""
|
|
communication_content: str = ""
|
|
customer_demand: str = ""
|
|
companions: list[uuid.UUID] = []
|
|
companion_names: list[str] = []
|
|
photos: list[str] = []
|
|
manager_id: Optional[uuid.UUID] = None # director/leader can specify
|
|
|
|
|
|
class VisitUpdate(BaseModel):
|
|
customer_id: Optional[uuid.UUID] = None
|
|
visit_date: Optional[str] = None
|
|
visit_method: Optional[str] = None
|
|
time_range: Optional[str] = None
|
|
visitor_name: Optional[str] = None
|
|
visitor_phone: Optional[str] = None
|
|
communication_content: Optional[str] = None
|
|
customer_demand: Optional[str] = None
|
|
companions: Optional[list[uuid.UUID]] = None
|
|
manager_id: Optional[uuid.UUID] = None
|
|
companion_names: Optional[list[str]] = None
|
|
photos: Optional[list[str]] = None
|
|
|
|
|
|
class VisitOut(BaseModel):
|
|
id: uuid.UUID
|
|
customer_id: uuid.UUID
|
|
visit_date: date
|
|
visit_method: str
|
|
time_range: str
|
|
visitor_name: str = ""
|
|
visitor_phone: str = ""
|
|
communication_content: str
|
|
customer_demand: str
|
|
companions: Optional[list[uuid.UUID]] = None
|
|
companion_names: list[str] = []
|
|
photos: Optional[list[str]] = None
|
|
manager_id: uuid.UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
# Joined fields
|
|
customer_name: Optional[str] = None
|
|
manager_name: Optional[str] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class VisitListOut(BaseModel):
|
|
id: uuid.UUID
|
|
customer_id: uuid.UUID
|
|
visit_date: date
|
|
visit_method: str
|
|
time_range: str
|
|
manager_id: uuid.UUID
|
|
customer_name: Optional[str] = None
|
|
manager_name: Optional[str] = None
|
|
has_photos: bool = False
|
|
|
|
model_config = {"from_attributes": True}
|