feat(groups): 微信群操作列加「导出HTML聊天记录」(补 Plan3 漏的操作)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getGroups } from '@/api'
|
||||
import { downloadBlob } from '@/api/client'
|
||||
import type { Channel, Group } from '@/api/types'
|
||||
import { useChannelStore } from '@/stores/channel'
|
||||
import { channelLabel, formatTime } from '@/utils/format'
|
||||
@@ -151,6 +152,28 @@ function viewChatFromDrawer(): void {
|
||||
viewChat(row)
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信群「导出HTML聊天记录」→ 后端 /api/export/chat-html(room_id)。
|
||||
* 云客群列表导出按钮直接导出,无时间选择 modal(仅微信客户有「请选择时间」)。
|
||||
* WA 群 tab 无此操作(云客 WA 群列表无导出)。
|
||||
*/
|
||||
async function exportGroupHtml(row: Group): Promise<void> {
|
||||
if (!row.owner_account_id || !row.room_id) {
|
||||
ElMessage.warning('该群缺少归属账号/群标识,无法导出')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await downloadBlob('/export/chat-html', {
|
||||
channel: row.channel,
|
||||
owner_account_id: row.owner_account_id,
|
||||
room_id: row.room_id,
|
||||
})
|
||||
ElMessage.success('导出已开始')
|
||||
} catch (e) {
|
||||
ElMessage.error(`导出失败,请稍后重试:${(e as Error).message}`)
|
||||
}
|
||||
}
|
||||
|
||||
/** 清除 owner_account_id query(保留其余 query)。 */
|
||||
function clearOwnerFilter(): void {
|
||||
const { owner_account_id: _drop, ...rest } = route.query
|
||||
@@ -267,11 +290,10 @@ onMounted(() => {
|
||||
<el-table-column label="消息数量" width="100" align="right">
|
||||
<template #default="{ row }">{{ cellNum(row, 'messageCount') }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="130" fixed="right" align="center">
|
||||
<el-table-column label="操作" width="220" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click.stop="viewChat(row)">
|
||||
查看聊天记录
|
||||
</el-button>
|
||||
<el-button link type="primary" size="small" @click.stop="viewChat(row)">查看聊天记录</el-button>
|
||||
<el-button link type="primary" size="small" @click.stop="exportGroupHtml(row)">导出HTML聊天记录</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
Reference in New Issue
Block a user