患者回话列表筛选

This commit is contained in:
xiaoxiao
2025-07-15 14:16:15 +08:00
parent b843007d7a
commit 63b13d7ccd
2 changed files with 51 additions and 13 deletions
@@ -236,21 +236,31 @@ export class LocalConversationViewModel {
}
this.offset = result.offset
this.isFinished = result.finished
let newConversation = result.conversationList
if (this.conversationList.length > 0 && newConversation.length > 0) {
this.conversationList =
this.conversationList.filter(conversation => !newConversation.find((m) => m.conversationId ===
conversation.conversationId))
}
this.conversationList?.push(...newConversation)
// let newConversation = result.conversationList
// if (this.conversationList.length > 0 && newConversation.length > 0) {
// this.conversationList =
// this.conversationList.filter(conversation => !newConversation.find((m) => m.conversationId ===
// conversation.conversationId))
// }
// this.conversationList?.push(...newConversation)
//异步有问题
if (this.conversationList.length > 0 ) {
const resultconversationList =await this.conversationList.filter(async conversation =>
await patientDbManager.getPatientByUuid(ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId))!=null
)
this.conversationList =resultconversationList;
// if (this.conversationList.length > 0 ) {
// const resultconversationList =await this.conversationList.filter(async conversation =>
// await patientDbManager.getPatientByUuid(ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId))!=null
// )
// this.conversationList =resultconversationList;
//
// }
const filteredConversations: V2NIMLocalConversation[] = [];
for (const conversation of result.conversationList) {
const uuid = ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId);
// 假设 selectUserStyleWithModel 返回 "1" 表示 type=1
const style = await patientDbManager.getPatientTypeByUuid(uuid);
if (style == 1) {
filteredConversations.push(conversation);
}
}
this.conversationList = filteredConversations;
this.conversationList?.sort((a, b) => this.sortConversation(a, b))
this.isFinishedSyncLoad = true