feat: customer full-field display (raw_json + cloud-matching list + all-fields drawer)
Backend: - CustomerOut now exposes raw_json (verbatim upstream friend record) so the frontend can render every 云客 field without per-field structured columns. - The verbatim blob round-trips via from_attributes; no model change needed. Frontend: - CustomerList table mirrors the 云客 客户列表 column set (头像/微信昵称/微信号/ 备注/真实姓名/手机/性别/地区/描述/销售员工/部门/来源/添加方式/添加时间/最近 聊天/消息数/渠道). A readField helper reads the structured column first and falls back to raw_json.<camelCase>. - Row click opens an all-fields drawer (right side) rendering EVERY field of the record with Chinese labels, grouped (基本信息/联系方式/归属员工与部门/时间 与来源/消息统计/好友状态/其他). Timestamps format to local datetime, flags render 是/否, image URLs render as el-image thumbnails, empty values show —. - New src/utils/customerFields.ts holds the camelCase→中文 label map, the structured-column alias map, group definitions, and value-type formatters; unknown raw_json keys auto-flow into an 其他 section so new upstream fields surface without code changes. - Drawer 查看聊天记录 action navigates to /chat/:channel/:ownerId/:talkerId (owner_account_id + friend_id + channel), preserving the existing path. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime as dt
|
||||
from typing import Generic, TypeVar
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
@@ -13,8 +13,10 @@ T = TypeVar("T")
|
||||
class CustomerOut(BaseModel):
|
||||
"""Public Customer view — a subset of :class:`app.db.models.Customer`.
|
||||
|
||||
Only the fields the viewing frontend needs today are exposed; the verbatim
|
||||
``raw_json`` blob and internal audit columns stay server-side.
|
||||
The structured columns power the list table; the verbatim upstream record
|
||||
is exposed as ``raw_json`` so the frontend can render the full ~60-field
|
||||
云客 客户详情 (all-fields drawer) without a second endpoint. The model's
|
||||
``raw_json`` column is picked up automatically via ``from_attributes``.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -33,6 +35,11 @@ class CustomerOut(BaseModel):
|
||||
last_chat_time: int | None = None
|
||||
message_count: int | None = None
|
||||
version: str | None = None
|
||||
# Verbatim upstream friend record (~60 camelCase fields). Surfaced so the
|
||||
# all-fields drawer can render every column the 云客 source page shows
|
||||
# (friendWxAlias/addTime/createTime/fromType/addType/...) without the
|
||||
# backend having to enumerate each one as a structured column.
|
||||
raw_json: dict[str, Any] | None = None
|
||||
|
||||
|
||||
class Page(BaseModel, Generic[T]):
|
||||
|
||||
Reference in New Issue
Block a user