88 >
99 </div >
1010 <div class =" mt-8" v-if =" !isWorkFlow(props.type)" >
11- <el-space wrap >
12- <div v-for =" (paragraph, index) in uniqueParagraphList" :key =" index" >
13- <el-icon class =" mr-4" :size =" 25" >
14- <img :src =" getIconPath(paragraph.document_name)" style =" width : 90% " alt =" " />
15- </el-icon >
16- <span
17- v-if =" !paragraph.source_url"
18- class =" ellipsis"
19- :title =" paragraph?.document_name?.trim()"
20- >
21- {{ paragraph?.document_name }}
22- </span >
23- <a
24- v-else
25- @click =" openLink(paragraph.source_url)"
26- class =" ellipsis"
27- :title =" paragraph?.document_name?.trim()"
28- >
29- <span :title =" paragraph?.document_name?.trim()" >
30- {{ paragraph?.document_name }}
31- </span >
32- </a >
33- </div >
34- </el-space >
11+ <el-row :gutter =" 8" v-if =" uniqueParagraphList?.length" >
12+ <template v-for =" (item , index ) in uniqueParagraphList " :key =" index " >
13+ <el-col :span =" 12" class =" mb-8" >
14+ <el-card shadow =" never" class =" file-List-card" data-width =" 40" >
15+ <div class =" flex-between" >
16+ <div class =" flex" >
17+ <img :src =" getImgUrl(item && item?.document_name)" alt =" " width =" 20" />
18+ <div class =" ml-4" v-if =" !item.source_url" >
19+ <p >{{ item && item?.document_name }}</p >
20+ </div >
21+ <div class =" ml-8" v-else >
22+ <a
23+ @click =" openLink(item.source_url)"
24+ class =" ellipsis"
25+ :title =" item?.document_name?.trim()"
26+ >
27+ <span :title =" item?.document_name?.trim()" >{{ item?.document_name }}</span >
28+ </a >
29+ </div >
30+ </div >
31+ </div >
32+ </el-card >
33+ </el-col >
34+ </template >
35+ </el-row >
3536 </div >
3637
3738 <div class =" border-t color-secondary flex-between mt-12" style =" padding-top : 12px " >
@@ -59,7 +60,7 @@ import { computed, ref } from 'vue'
5960import ParagraphSourceDialog from ' ./ParagraphSourceDialog.vue'
6061import ExecutionDetailDialog from ' ./ExecutionDetailDialog.vue'
6162import { isWorkFlow } from ' @/utils/application'
62-
63+ import { getImgUrl } from ' @/utils/utils '
6364const props = defineProps ({
6465 data: {
6566 type: Object ,
@@ -70,15 +71,6 @@ const props = defineProps({
7071 default: ' '
7172 }
7273})
73- const iconMap: { [key : string ]: string } = {
74- doc: ' ../../assets/doc-icon.svg' ,
75- docx: ' ../../assets/docx-icon.svg' ,
76- pdf: ' ../../assets/pdf-icon.svg' ,
77- md: ' ../../assets/md-icon.svg' ,
78- txt: ' ../../assets/txt-icon.svg' ,
79- xls: ' ../../assets/xls-icon.svg' ,
80- xlsx: ' ../../assets/xlsx-icon.svg'
81- }
8274
8375const ParagraphSourceDialogRef = ref ()
8476const ExecutionDetailDialogRef = ref ()
@@ -106,15 +98,16 @@ const uniqueParagraphList = computed(() => {
10698 }) || []
10799 )
108100})
109-
110- function getIconPath( documentName : string ) {
111- const extension = documentName . split ( ' . ' ). pop ()?. toLowerCase ()
112- if ( ! documentName || ! extension ) return new URL ( ` ${ iconMap [ ' doc ' ]} ` , import . meta . url ). href
113- if ( iconMap && extension && iconMap [ extension ]) {
114- return new URL ( ` ${ iconMap [ extension ]} ` , import . meta . url ). href
115- }
116- return new URL ( ` ${ iconMap [ ' doc ' ]} ` , import . meta . url ). href
101+ function fileType( name : string ) {
102+ const suffix = name . split ( ' . ' )
103+ return suffix [ suffix . length - 1 ]
104+ }
105+ const typeList : any = {
106+ txt: [ ' txt ' , ' pdf ' , ' docx ' , ' csv ' , ' md ' , ' html ' ],
107+ table: [ ' xlsx ' , ' xls ' , ' csv ' ],
108+ QA: [ ' xlsx ' , ' csv ' , ' xls ' ]
117109}
110+
118111function openLink(url : string ) {
119112 // 如果url不是以/结尾,加上/
120113 if (url && ! url .endsWith (' /' )) {
0 commit comments