fix(staff): review fixes — CSS ellipsis, owner_account_id scoping, viewChat guard

1. .yk-staffinfo__nick display:block (ellipsis now applies to WA inline span). 2. openAdded/openTalked modal use owner_account_id (always present) instead of user_id! (null would leak whole customer table). 3. viewChat guards null talker+room + awaits router.push. 4. WA 添加人数 title → 客户列表 (honest: WA has no add_time, shows all).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-05 19:25:24 +08:00
parent 5bf43fc67b
commit 20b01ab849
+19 -11
View File
@@ -206,10 +206,16 @@ async function viewChat(row: Account) {
ElMessage.info('该账号暂无聊天记录')
return
}
const path = m.room_id
? `/group/${row.channel}/${row.account_id}/${m.room_id}`
: `/chat/${row.channel}/${row.account_id}/${m.talker_id}`
router.push(path)
const target = m.room_id ?? m.talker_id
if (!target) {
ElMessage.info('最近一条消息无会话标识')
return
}
await router.push(
m.room_id
? `/group/${row.channel}/${row.account_id}/${m.room_id}`
: `/chat/${row.channel}/${row.account_id}/${m.talker_id}`,
)
}
// ---------------------------------------------------------------------------
@@ -238,25 +244,26 @@ const baseCustomerCols = [
function openAddedModal(row: Account) {
// ⚠️ WA customer has no add_time (Task 2 confirmed: WA raw_json lacks
// addTime; createTime is owner-staff). Degrade: do NOT set add_time_since
// (would be empty); show all WA customers for this staff, sorted by
// last_chat_time.
detailTitle.value = `添加人数 · ${row.user_name ?? row.account_id}`
// (would be empty); show all customers of this account, sorted by last_chat_time.
// 用 owner_account_id(=account_id,始终存在)而非 user_id(可能 null 导致全表泄漏)。
// 标题如实写"客户列表"——非"添加人数",因 WA 无法按 add_time 精确筛新增。
detailTitle.value = `客户列表 · ${row.user_name ?? row.account_id}`
detailCols.value = baseCustomerCols
detailFetcher.value = (p, s) =>
getCustomers({ user_id: row.user_id!, channel: 'whatsapp', page: p, page_size: s })
getCustomers({ owner_account_id: row.account_id, channel: row.channel, page: p, page_size: s })
detailOpen.value = true
}
function openTalkedModal(row: Account) {
// 沟通人数: chatted within the last 7 days (last_chat_time exists on both
// channels).
// channels). 用 owner_account_id(始终存在)而非 user_id(可能 null)。
const since = Date.now() - 7 * 86400000
detailTitle.value = `沟通人数 · ${row.user_name ?? row.account_id}`
detailCols.value = baseCustomerCols
detailFetcher.value = (p, s) =>
getCustomers({
user_id: row.user_id!,
channel: 'whatsapp',
owner_account_id: row.account_id,
channel: row.channel,
last_chat_since: since,
page: p,
page_size: s,
@@ -785,6 +792,7 @@ onMounted(() => {
}
.yk-staffinfo__nick {
display: block;
font-weight: 600;
font-size: 13px;
color: #303133;