| | |
| | | <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 |
| | |
| | | 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') { |
| | |
| | | }; |
| | | //#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; |