wujingjing
2025-03-11 c144c39d9f3f86e1b52ae4247f8322f6396a4320
src/components/chat/user/index.vue
@@ -10,9 +10,8 @@
                     <div
                        v-for="(item, index) in msg.attachList"
                        :key="index"
                        class="flex items-center gap-2 bg-[#e9e9e9] px-2 py-3 rounded-lg w-[220px] relative group"
                        class="flex items-center gap-2 bg-[#e9e9e9] px-2 py-3 rounded-lg w-[220px] relative group cursor-pointer"
                        @click="openAttachPreview(item)"
                        :class="{ 'cursor-pointer': item.type === 'table' }"
                     >
                        <template v-if="item.type === 'file'">
                           <el-image
@@ -183,8 +182,9 @@
const attachPreviewIsShow = ref(false);
const attachPreviewData = ref<Attach>();
const openAttachPreview = (item: Attach) => {
   if (item.type === 'file') return;
   if (item.type === 'table') {
   if (item.type === 'file') {
      openFileContent(item);
   } else if (item.type === 'table') {
      attachPreviewIsShow.value = true;
      attachPreviewData.value = item;
   } else if (item.type === 'metric') {
@@ -200,6 +200,15 @@
};
//#endregion
//#region ====================== 查看文件文本内容 ======================
const openFileContent = (item: Attach) => {
   emitter.emit('setFileContent', {
      title: item.title,
      content: item.model?.file_content ?? '',
   });
};
//#endregion
//#region ====================== 附件下载 ======================
const downloadAttach = async (item: Attach) => {
   const fileId = item.model?.file_id;