feat(calls): 微信语音 好友/群 scope 筛选(对齐云客,client-side isRoom 过滤)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,10 @@ import VoiceClipModal from '@/components/VoiceClipModal.vue'
|
||||
// doesn't fight the shared top-bar wechat/whatsapp store used by customers/groups.
|
||||
const callType = ref<CallChannel>('voice_call')
|
||||
|
||||
// 微信语音 tab scope filter: 对齐云客 微信好友/微信群 二分(isRoom 0=好友, 1=群)。
|
||||
// 仅在 voice_call tab 生效;client-side 过滤当前页。
|
||||
const voiceScope = ref<'all' | 'friend' | 'group'>('all')
|
||||
|
||||
const calls = ref<PhoneCall[]>([])
|
||||
const total = ref(0)
|
||||
const page = ref(1)
|
||||
@@ -82,9 +86,27 @@ function handlePageSizeChange(s: number): void {
|
||||
function onTabChange(_name: TabPaneName): void {
|
||||
// v-model has already updated callType; just reset paging and reload.
|
||||
page.value = 1
|
||||
// 切 tab 时复位 scope,避免把 微信群/好友 筛选带到 WA语音/电话 tab。
|
||||
voiceScope.value = 'all'
|
||||
load()
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前表格要渲染的行。非 voice_call tab 原样返回;voice_call tab 按 voiceScope
|
||||
* 依 isRoom(0=好友, 1=群)做页内过滤。云客 isRoom 可能是 number/string/boolean,
|
||||
* 三种都判一下。
|
||||
*/
|
||||
const displayCalls = computed<PhoneCall[]>(() => {
|
||||
if (callType.value !== 'voice_call' || voiceScope.value === 'all') {
|
||||
return calls.value
|
||||
}
|
||||
return calls.value.filter((row) => {
|
||||
const v = cell(row, 'isRoom')
|
||||
const isGroup = v === 1 || v === '1' || v === true
|
||||
return voiceScope.value === 'group' ? isGroup : !isGroup
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* Read a raw_json camelCase key off a call, preferring the structured
|
||||
* snake_case column when it is populated. The first argument is the row so the
|
||||
@@ -200,9 +222,20 @@ onMounted(load)
|
||||
style="margin-bottom: 12px"
|
||||
/>
|
||||
|
||||
<el-radio-group
|
||||
v-if="callType === 'voice_call'"
|
||||
v-model="voiceScope"
|
||||
size="small"
|
||||
style="margin-bottom: 8px"
|
||||
>
|
||||
<el-radio-button value="all">全部</el-radio-button>
|
||||
<el-radio-button value="friend">微信好友</el-radio-button>
|
||||
<el-radio-button value="group">微信群</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="calls"
|
||||
:data="displayCalls"
|
||||
stripe
|
||||
border
|
||||
row-key="call_id"
|
||||
|
||||
Reference in New Issue
Block a user