fix(calls): 员工详情抽屉接线补全(函数体+状态变量,上轮断言中断只写入了模板)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-24 10:34:09 +08:00
parent 12d773ce91
commit f7e1f1d775
+19 -6
View File
@@ -72,6 +72,8 @@ const voiceClipStaffName = ref<string | null>(null)
// All-fields drawer state.
const drawerOpen = ref(false)
const drawerCall = ref<PhoneCall | null>(null)
const staffDrawerOpen = ref(false)
const staffDrawerCall = ref<PhoneCall | null>(null)
const tabs: { value: CallChannel; label: string }[] = [
{ value: 'voice_call', label: '微信语音' },
@@ -231,14 +233,25 @@ function openDrawer(row: PhoneCall): void {
* calls whose structured user_id is null still resolve.
*/
function goToStaffDetail(row: PhoneCall): void {
const id = row.user_id ?? (cell(row, 'userId') as string | undefined)
if (!id) {
ElMessage.info('该通话无员工 userId,无法查看员工详情')
return
}
router.push({ name: 'staff-detail', params: { userId: String(id) } })
staffDrawerCall.value = row
staffDrawerOpen.value = true
}
/** 员工信息抽屉的字段(从通话行的 raw_json 提取员工侧字段)。 */
const staffDrawerSections = computed(() => {
const row = staffDrawerCall.value
if (!row) return []
const fields: { label: string; text: string }[] = [
{ label: '姓名', text: String(cell(row, 'userName') ?? row.user_id_name ?? '--') },
{ label: '手机号', text: String(cell(row, 'userPhone') ?? '--') },
{ label: '工号', text: String(cell(row, 'jobNumber') ?? '--') },
{ label: '员工微信昵称', text: String(cell(row, 'weChatNickName') ?? '--') },
{ label: '员工微信', text: String(cell(row, 'weChatId') ?? '--') },
{ label: '部门', text: String(cell(row, 'departmentName') ?? '--') },
]
return [{ title: '员工信息', fields }]
})
/** 把通话类型(voice_call/wa_voice_call)映射到聊天渠道(wechat/whatsapp)。电话返回 null。 */
function chatChannel(ch: CallChannel): 'wechat' | 'whatsapp' | null {
return ch === 'voice_call' ? 'wechat' : ch === 'wa_voice_call' ? 'whatsapp' : null