1818 <div class =" mb-8" v-if =" document_list.length" >
1919 <el-space wrap >
2020 <template v-for =" (item , index ) in document_list " :key =" index " >
21- <el-card shadow =" never" style =" --el-card-padding : 8px " class =" file cursor" >
22- <div class =" flex align-center" >
21+ <el-card shadow =" never" style =" --el-card-padding : 8px " class =" download-file cursor" >
22+ <div class =" download-button flex align-center" @click =" downloadFile(item)" >
23+ <el-icon class =" mr-4" ><Download /></el-icon >点击下载文件
24+ </div >
25+ <div class =" show flex align-center" >
2326 <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
24- <div class =" ml-4 ellipsis" :title =" item && item?.name" >
27+ <div class =" ml-4 ellipsis" style = " max-width : 150 px " :title =" item && item?.name" >
2528 {{ item && item?.name }}
2629 </div >
2730 </div >
5558</template >
5659<script setup lang="ts">
5760import { type chatType } from ' @/api/type/application'
58- import { getImgUrl , getAttrsArray } from ' @/utils/utils'
61+ import { getImgUrl , getAttrsArray , downloadByURL } from ' @/utils/utils'
5962import { onMounted , computed } from ' vue'
6063const props = defineProps <{
6164 application: any
@@ -80,13 +83,33 @@ const image_list = computed(() => {
8083 }
8184})
8285
83- onMounted (() => {
84- // console.log(props.chatRecord.execution_details)
85- // if (props.chatRecord.execution_details?.length > 0) {
86- // props.chatRecord.execution_details[0].image_list?.forEach((image: any) => {
87- // console.log('image', image.name, image.url)
88- // })
89- // }
90- })
86+ function downloadFile(item : any ) {
87+ downloadByURL (item .url , item .name )
88+ }
89+
90+ onMounted (() => {})
9191 </script >
92- <style lang="scss" scoped></style >
92+ <style lang="scss" scoped>
93+ .download-file {
94+ width : 200px ;
95+ height : 43px ;
96+ & :hover {
97+ color : var (--el-color-primary );
98+ border : 1px solid var (--el-color-primary );
99+ .download-button {
100+ display : block ;
101+ text-align : center ;
102+ line-height : 26px ;
103+ }
104+ .show {
105+ display : none ;
106+ }
107+ }
108+ .show {
109+ display : block ;
110+ }
111+ .download-button {
112+ display : none ;
113+ }
114+ }
115+ </style >
0 commit comments