feat(staff): 员工详情独立页(StaffDetail.vue,替代 drawer 降级,对齐云客 userDetailNew)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -156,6 +156,21 @@ function openDrawer(row: PhoneCall): void {
|
||||
drawerOpen.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工姓名 click → standalone 员工详情 page (mirrors 云客 userDetailNew).
|
||||
* Distinct from row-click which still opens the all-fields call drawer.
|
||||
* Prefer the structured `user_id`; fall back to the raw_json `userId` cell so
|
||||
* 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) } })
|
||||
}
|
||||
|
||||
/** 把通话类型(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
|
||||
@@ -268,7 +283,7 @@ onMounted(load)
|
||||
</el-table-column>
|
||||
<el-table-column label="员工信息" min-width="130">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="row.user_id_name" link type="primary" size="small" @click.stop="openDrawer(row)">{{ row.user_id_name }}</el-button>
|
||||
<el-button v-if="row.user_id_name" link type="primary" size="small" @click.stop="goToStaffDetail(row)">{{ row.user_id_name }}</el-button>
|
||||
<span v-else>--</span>
|
||||
<div class="yk-cell__sub">{{ cell(row, 'userPhone') || '--' }}</div>
|
||||
</template>
|
||||
@@ -303,7 +318,7 @@ onMounted(load)
|
||||
<el-table-column label="员工信息" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<el-button v-if="row.user_id_name" link type="primary" size="small" @click.stop="openDrawer(row)">{{ row.user_id_name }}</el-button>
|
||||
<el-button v-if="row.user_id_name" link type="primary" size="small" @click.stop="goToStaffDetail(row)">{{ row.user_id_name }}</el-button>
|
||||
<span v-else>--</span>
|
||||
<span> · {{ cell(row, 'userPhone') || '--' }}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user