feat(calls): callStatusLabel channel-aware + callTypeLabel WA + 补 WA/微信语音字段 label
call_status 极性随 channel 不同(phone 0未接/2接通;voice/WA 1接通/2未接通), 仅值 2 按 channel 分支。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,17 @@ export const CALL_FIELD_LABELS: Record<string, string> = {
|
||||
// 关联与版本
|
||||
planCustomerName: '关联客户',
|
||||
version: '版本',
|
||||
// 微信/WA 语音
|
||||
userWeChatNickName: '员工微信昵称',
|
||||
userWeChatAlias: '员工微信号',
|
||||
userPhone: '员工手机',
|
||||
talker: '客户号',
|
||||
talkerNickName: '客户昵称',
|
||||
talkerAlias: '客户微信号',
|
||||
weChatId: '员工微信ID',
|
||||
callFileId: '录音文件ID',
|
||||
from: '通话来源',
|
||||
isRoom: '是否群通话',
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,13 +82,15 @@ export function wechatTypeLabel(typeRaw?: number | null): string {
|
||||
// Phone / voice call rendering
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Call-type (PhoneCall.channel) label — 电话 vs 语音通话. */
|
||||
/** Call-type (PhoneCall.channel) label — 电话 vs 语音通话 vs WA 语音通话. */
|
||||
export function callTypeLabel(channel?: string | null): string {
|
||||
switch (channel) {
|
||||
case 'phone_call':
|
||||
return '电话'
|
||||
case 'voice_call':
|
||||
return '语音通话'
|
||||
case 'wa_voice_call':
|
||||
return 'WA 语音通话'
|
||||
default:
|
||||
return channel ?? '未知'
|
||||
}
|
||||
@@ -101,17 +103,26 @@ export function callDirectionLabel(incoming?: number | null): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call status. The upstream schema uses 1 = 已接通 (answered/connected) and
|
||||
* 0 = 未接通 (missed/failed); other codes fall back to the raw value so the UI
|
||||
* never hides information.
|
||||
* Call connected/missed label. The upstream ``call_status`` polarity differs by
|
||||
* channel (verified against smoke.db recording correlation + scraper code):
|
||||
* • phone_call: 0 = 未接通, 2 = 已接通.
|
||||
* • voice_call / wa_voice_call: 1 = 已接通, 2 = 未接通.
|
||||
* Value 2 is the only code that flips meaning across channels, so it alone
|
||||
* branches on ``channel``; 0/1 are stable. Unknown codes pass through so the
|
||||
* UI never hides information.
|
||||
*/
|
||||
export function callStatusLabel(status?: number | null): string {
|
||||
export function callStatusLabel(
|
||||
status?: number | null,
|
||||
channel?: string | null,
|
||||
): string {
|
||||
if (status == null) return '--'
|
||||
switch (status) {
|
||||
case 1:
|
||||
return '已接通'
|
||||
case 0:
|
||||
return '未接通'
|
||||
case 1:
|
||||
return '已接通'
|
||||
case 2:
|
||||
return channel === 'phone_call' ? '已接通' : '未接通'
|
||||
default:
|
||||
return `状态 ${status}`
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ onMounted(load)
|
||||
<template v-if="callType === 'voice_call'">
|
||||
<el-table-column label="通话信息" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<div>通话状态:{{ callStatusLabel(row.call_status) }}</div>
|
||||
<div>通话状态:{{ callStatusLabel(row.call_status, row.channel) }}</div>
|
||||
<div class="yk-cell__sub">类型:{{ callTypeLabel(row.channel) }}</div>
|
||||
<div class="yk-cell__sub">来源:{{ cell(row, 'from') || '--' }}</div>
|
||||
</template>
|
||||
@@ -196,7 +196,7 @@ onMounted(load)
|
||||
<template v-if="callType === 'wa_voice_call'">
|
||||
<el-table-column label="状态" width="160">
|
||||
<template #default="{ row }">
|
||||
<div>{{ callStatusLabel(row.call_status) }}</div>
|
||||
<div>{{ callStatusLabel(row.call_status, row.channel) }}</div>
|
||||
<div class="yk-cell__sub">时长 {{ formatCallDuration(row.call_duration) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -246,7 +246,7 @@ onMounted(load)
|
||||
<template #default="{ row }">{{ formatCallDuration(row.call_duration) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="90">
|
||||
<template #default="{ row }">{{ callStatusLabel(row.call_status) }}</template>
|
||||
<template #default="{ row }">{{ callStatusLabel(row.call_status, row.channel) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="录音" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
|
||||
Reference in New Issue
Block a user