perf(chat): 优化后台客服会话查询与状态

This commit is contained in:
yml2213
2026-08-25 15:53:10 +08:00
parent 87327fbd91
commit 417f7398e4
14 changed files with 461 additions and 141 deletions
@@ -87,8 +87,7 @@ const activeMembers = computed(() => {
const participants = active.value?.participants || []
return participants
.map(item => {
const remark = getParticipantRemark()
const name = remark ? `${remark}(${item.display_name})` : item.display_name
const name = item.remark ? `${item.remark}(${item.display_name})` : item.display_name
return `${roleLabel(item.role)}${name}`
})
.join(' / ')
@@ -121,14 +120,6 @@ let orderLoadToken = 0
// 桌面通知
const desktopNotification = useDesktopNotification('admin')
function getParticipantRemark() {
if (!active.value) return ''
const myParticipant = active.value.participants?.find(
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
)
return myParticipant?.remark || ''
}
function handleSSEEvent(event: ChatEvent) {
if (event.type === 'conversation_updated') {
loadConversations(false)
@@ -433,10 +424,7 @@ function handleTransferSuccess() {
async function startEditRemark() {
if (!active.value) return
const myParticipant = active.value.participants?.find(
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
)
remarkValue.value = myParticipant?.remark || active.value.title
remarkValue.value = active.value.admin_remark || active.value.title
remarkEditing.value = true
}
@@ -483,10 +471,7 @@ function senderLabel(item: ChatMessage) {
}
function getConversationTitle(item: ChatConversation) {
const myParticipant = item.participants?.find(
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
)
return myParticipant?.remark || item.title
return item.admin_remark || item.title
}
function getSupportName(item: ChatConversation) {