feat: 对话增加历史记录

This commit is contained in:
wangdan-fit2cloud 2024-05-17 13:04:25 +08:00
parent 5de78cf446
commit e8f1bd9991
3 changed files with 13 additions and 8 deletions

View File

@ -4,7 +4,7 @@
<template v-for="(item, index) in data" :key="index">
<li
@click.prevent="clickHandle(item, index)"
:class="current === index ? 'active' : ''"
:class="current === item[props.valueKey] ? 'active' : ''"
class="cursor"
>
<slot :row="item" :index="index"> </slot>
@ -23,10 +23,12 @@ const props = withDefaults(
defineProps<{
data: Array<any>
defaultActive?: string
valueKey?: string //
}>(),
{
data: () => [],
defaultActive: ''
defaultActive: '',
valueKey: 'id'
}
)
@ -35,9 +37,7 @@ const current = ref<Number | String>(0)
watch(
() => props.defaultActive,
(val) => {
if (val) {
current.value = props.data.findIndex((v) => v.id === val)
}
current.value = val
},
{ immediate: true }
)
@ -45,7 +45,7 @@ watch(
const emit = defineEmits(['click'])
function clickHandle(row: any, index: number) {
current.value = index
current.value = row[props.valueKey]
emit('click', row)
}
</script>

View File

@ -141,7 +141,6 @@ const clickListHandle = (item: any) => {
}
function refresh(id: string) {
console.log(id)
getChatLog(applicationDetail.value.id)
currentChatId.value = id
}

View File

@ -3,7 +3,13 @@
<div class="template-manage flex main-calc-height">
<div class="template-manage__left p-8 border-r">
<h4 class="p-16" style="padding-bottom: 8px">供应商</h4>
<common-list :data="provider_list" v-loading="loading" @click="clickListHandle">
<common-list
:data="provider_list"
v-loading="loading"
@click="clickListHandle"
value-key="provider"
default-active=""
>
<template #default="{ row, index }">
<div class="flex" v-if="index === 0">
<AppIcon