feat(ui): 列表页移除tab结构(每渠道独立页面,由侧栏菜单驱动)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-15 13:41:49 +08:00
parent 9b21584e9a
commit aa90d9d8f2
4 changed files with 72 additions and 88 deletions
+17 -19
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage, type TabPaneName } from 'element-plus'
import { ElMessage } from 'element-plus'
import { Download } from '@element-plus/icons-vue'
import { getCalls } from '@/api'
import type { CallChannel, PhoneCall } from '@/api/types'
@@ -88,13 +88,20 @@ function handlePageSizeChange(s: number): void {
load()
}
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()
}
// 侧栏菜单在同一页面内切换 ?channel= 时组件复用(不重挂载)→ watch 同步通话类型并重载。
watch(
() => route.query.channel,
(q) => {
const next: CallChannel = q === 'whatsapp' ? 'wa_voice_call' : 'voice_call'
if (next !== callType.value) {
callType.value = next
page.value = 1
// 复位 scope,避免把 微信群/好友 筛选带到 WA语音。
voiceScope.value = 'all'
load()
}
},
)
// ---- header 导出:当前 tab 通话类型全量记录 CSV ----
const exporting = ref(false)
@@ -249,7 +256,7 @@ onMounted(load)
<div class="yk-calls">
<div class="yk-calls__header">
<div>
<h2 style="margin: 0 0 4px; font-size: 16px">通话记录</h2>
<h2 style="margin: 0 0 4px; font-size: 16px">{{ tabs.find(t => t.value === callType)?.label }}通话记录</h2>
<span class="yk-calls__sub">
共 {{ total }} 条 · 类型:{{ tabs.find(t => t.value === callType)?.label }}
</span>
@@ -261,15 +268,6 @@ onMounted(load)
</div>
</div>
<el-tabs v-model="callType" class="yk-calls__tabs" @tab-change="onTabChange">
<el-tab-pane
v-for="t in tabs"
:key="t.value"
:label="t.label"
:name="t.value"
/>
</el-tabs>
<el-alert
v-if="errorMsg"
:title="errorMsg"