feat: full-field display for group/call/sms (raw_json + drawers)

Mirrors the Customer/Message/Staff/Accounts pattern: backend exposes the
verbatim upstream record on the response schema; the frontend list shows
source-matching columns and a row-click opens an all-fields el-drawer with
Chinese-labeled camelCase keys (unknown keys roll up under 其他).

Backend (yunke-server/app/api/schemas.py)
- GroupOut / PhoneCallOut / SmsOut: add raw_json: dict[str, Any] | None
  (Pydantic v2 from_attributes picks up the existing ORM column).
- Tests: extend tests/test_api_{groups,calls,sms}.py with a per-schema
  raw_json round-trip assertion (phone_call + voice_call payload shapes
  both covered for calls).

Frontend (yunkes)
- src/utils/{groupFields,callFields,smsFields}.ts: 中文 label map +
  grouped sections + readField (structured-column preference) +
  toDisplayField (image / time / audio / bool / status / direction).
- src/api/types.ts: add raw_json to Group / PhoneCall / Sms.
- src/views/GroupList.vue: richer columns (群名/群ID/成员数/群主/归属微信/
  消息数/最近聊天/渠道) + all-fields drawer (chatRoomId/chatRoomName,
  memberCount/memberIds, headImageUrl, wechatId/wechatNickName,
  userName/userPhone/userId, messageCount/ownMessageCount,
  lossMembers/addMembers, lastChatTime/updateTime).
- src/views/CallList.vue: keeps existing columns + adds all-fields drawer
  (id/startCallTime, callDuration/callSeconds/ringTime, callStatus/
  incomingCall, userId/userIdName/departmentId, callNumber/simPhone/
  simNumber/imei, recordFile/isUpload/downloadCount/aiAsr/qcStatus/
  planCustomerName/version + voice-call extras ossFileName/duration/
  startTime/endTime/remark). Drawer plays recording inline via audio
  render kind; existing play-record dialog retained.
- src/views/SmsList.vue: keeps existing columns + adds all-fields drawer
  (id/customerPhone, sms/smsSub, sender, direction, userId/
  senderDepartment, receiveName, createTime, simPhone/simNumber, source)
  with a full-body preview block at the top.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-05 10:12:49 +08:00
parent fd86adfb63
commit 0d466c4e4a
11 changed files with 1442 additions and 92 deletions
+31 -3
View File
@@ -152,7 +152,15 @@ class MessageOut(BaseModel):
class GroupOut(BaseModel):
"""Chat group summary row."""
"""Chat group summary row.
The structured columns power the list table; the verbatim upstream record
is exposed as ``raw_json`` so the frontend can render the all-fields drawer
(chatRoomId/chatRoomName, memberIds, headImageUrl, wechatId/wechatNickName,
userName/userPhone, messageCount/ownMessageCount, lossMembers/addMembers,
lastChatTime/updateTime, ...) without a second endpoint. Picked up
automatically via ``from_attributes``.
"""
model_config = ConfigDict(from_attributes=True)
@@ -164,6 +172,7 @@ class GroupOut(BaseModel):
member_count: int | None = None
message_count: int | None = None
last_chat_time: int | None = None
raw_json: dict[str, Any] | None = None
class GroupMemberOut(BaseModel):
@@ -180,7 +189,17 @@ class GroupMemberOut(BaseModel):
class PhoneCallOut(BaseModel):
"""Phone / voice call record. ``channel`` is the call-type."""
"""Phone / voice call record. ``channel`` is the call-type.
The structured columns power the list table; the verbatim upstream record
is exposed as ``raw_json`` so the frontend can render the all-fields drawer
(id/startCallTime, callDuration/callSeconds, ringTime, callStatus,
incomingCall, userId/userIdName, departmentId, callNumber,
simPhone/simNumber/imei, recordFile, isUpload, downloadCount, aiAsr,
qcStatus, planCustomerName, version + voice-call extras ossFileName/
duration/startTime/endTime/remark) without a second endpoint. Picked up
automatically via ``from_attributes``.
"""
model_config = ConfigDict(from_attributes=True)
@@ -197,10 +216,18 @@ class PhoneCallOut(BaseModel):
# OSS URL of the call recording — surfaced so the Calls view can offer a
# "播放录音" action when present.
record_file: str | None = None
raw_json: dict[str, Any] | None = None
class SmsOut(BaseModel):
"""SMS log row."""
"""SMS log row.
The structured columns power the list table; the verbatim upstream record
is exposed as ``raw_json`` so the frontend can render the all-fields drawer
(id/customerPhone, sms/smsSub, sender, direction, userId,
senderDepartment, receiveName, createTime, simPhone/simNumber, source)
without a second endpoint. Picked up automatically via ``from_attributes``.
"""
model_config = ConfigDict(from_attributes=True)
@@ -216,6 +243,7 @@ class SmsOut(BaseModel):
receive_name: str | None = None
create_time: int | None = None
sim_phone: str | None = None
raw_json: dict[str, Any] | None = None
# ---------------------------------------------------------------------------