style: 优化引用知识库样式
This commit is contained in:
parent
3ceefa37cb
commit
d276bc928f
@ -8,30 +8,31 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-8" v-if="!isWorkFlow(props.type)">
|
<div class="mt-8" v-if="!isWorkFlow(props.type)">
|
||||||
<el-space wrap>
|
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
|
||||||
<div v-for="(paragraph, index) in uniqueParagraphList" :key="index">
|
<template v-for="(item, index) in uniqueParagraphList" :key="index">
|
||||||
<el-icon class="mr-4" :size="25">
|
<el-col :span="12" class="mb-8">
|
||||||
<img :src="getIconPath(paragraph.document_name)" style="width: 90%" alt="" />
|
<el-card shadow="never" class="file-List-card" data-width="40">
|
||||||
</el-icon>
|
<div class="flex-between">
|
||||||
<span
|
<div class="flex">
|
||||||
v-if="!paragraph.source_url"
|
<img :src="getImgUrl(item && item?.document_name)" alt="" width="20" />
|
||||||
class="ellipsis"
|
<div class="ml-4" v-if="!item.source_url">
|
||||||
:title="paragraph?.document_name?.trim()"
|
<p>{{ item && item?.document_name }}</p>
|
||||||
>
|
</div>
|
||||||
{{ paragraph?.document_name }}
|
<div class="ml-8" v-else>
|
||||||
</span>
|
|
||||||
<a
|
<a
|
||||||
v-else
|
@click="openLink(item.source_url)"
|
||||||
@click="openLink(paragraph.source_url)"
|
|
||||||
class="ellipsis"
|
class="ellipsis"
|
||||||
:title="paragraph?.document_name?.trim()"
|
:title="item?.document_name?.trim()"
|
||||||
>
|
>
|
||||||
<span :title="paragraph?.document_name?.trim()">
|
<span :title="item?.document_name?.trim()">{{ item?.document_name }}</span>
|
||||||
{{ paragraph?.document_name }}
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</el-space>
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="border-t color-secondary flex-between mt-12" style="padding-top: 12px">
|
<div class="border-t color-secondary flex-between mt-12" style="padding-top: 12px">
|
||||||
@ -59,7 +60,7 @@ import { computed, ref } from 'vue'
|
|||||||
import ParagraphSourceDialog from './ParagraphSourceDialog.vue'
|
import ParagraphSourceDialog from './ParagraphSourceDialog.vue'
|
||||||
import ExecutionDetailDialog from './ExecutionDetailDialog.vue'
|
import ExecutionDetailDialog from './ExecutionDetailDialog.vue'
|
||||||
import { isWorkFlow } from '@/utils/application'
|
import { isWorkFlow } from '@/utils/application'
|
||||||
|
import { getImgUrl } from '@/utils/utils'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -70,15 +71,6 @@ const props = defineProps({
|
|||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const iconMap: { [key: string]: string } = {
|
|
||||||
doc: '../../assets/doc-icon.svg',
|
|
||||||
docx: '../../assets/docx-icon.svg',
|
|
||||||
pdf: '../../assets/pdf-icon.svg',
|
|
||||||
md: '../../assets/md-icon.svg',
|
|
||||||
txt: '../../assets/txt-icon.svg',
|
|
||||||
xls: '../../assets/xls-icon.svg',
|
|
||||||
xlsx: '../../assets/xlsx-icon.svg'
|
|
||||||
}
|
|
||||||
|
|
||||||
const ParagraphSourceDialogRef = ref()
|
const ParagraphSourceDialogRef = ref()
|
||||||
const ExecutionDetailDialogRef = ref()
|
const ExecutionDetailDialogRef = ref()
|
||||||
@ -106,15 +98,16 @@ const uniqueParagraphList = computed(() => {
|
|||||||
}) || []
|
}) || []
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
function fileType(name: string) {
|
||||||
function getIconPath(documentName: string) {
|
const suffix = name.split('.')
|
||||||
const extension = documentName.split('.').pop()?.toLowerCase()
|
return suffix[suffix.length - 1]
|
||||||
if (!documentName || !extension) return new URL(`${iconMap['doc']}`, import.meta.url).href
|
|
||||||
if (iconMap && extension && iconMap[extension]) {
|
|
||||||
return new URL(`${iconMap[extension]}`, import.meta.url).href
|
|
||||||
}
|
|
||||||
return new URL(`${iconMap['doc']}`, import.meta.url).href
|
|
||||||
}
|
}
|
||||||
|
const typeList: any = {
|
||||||
|
txt: ['txt', 'pdf', 'docx', 'csv', 'md', 'html'],
|
||||||
|
table: ['xlsx', 'xls', 'csv'],
|
||||||
|
QA: ['xlsx', 'csv', 'xls']
|
||||||
|
}
|
||||||
|
|
||||||
function openLink(url: string) {
|
function openLink(url: string) {
|
||||||
// 如果url不是以/结尾,加上/
|
// 如果url不是以/结尾,加上/
|
||||||
if (url && !url.endsWith('/')) {
|
if (url && !url.endsWith('/')) {
|
||||||
|
|||||||
@ -18,45 +18,8 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="footer-content flex-between">
|
<div class="footer-content flex-between">
|
||||||
<el-text class="flex align-center" style="width: 70%">
|
<el-text class="flex align-center" style="width: 70%">
|
||||||
<el-icon class="mr-4" :size="25">
|
<img :src="getImgUrl(data?.document_name?.trim())" alt="" width="20" class="mr-4" />
|
||||||
<img
|
|
||||||
src="@/assets/doc-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-if="data?.document_name?.includes('doc')"
|
|
||||||
/>
|
|
||||||
<img
|
|
||||||
src="@/assets/docx-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-else-if="data?.document_name?.includes('docx')"
|
|
||||||
/>
|
|
||||||
<img
|
|
||||||
src="@/assets/pdf-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-else-if="data?.document_name?.includes('pdf')"
|
|
||||||
/>
|
|
||||||
<img
|
|
||||||
src="@/assets/md-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-else-if="data?.document_name?.includes('md')"
|
|
||||||
/>
|
|
||||||
<img
|
|
||||||
src="@/assets/xls-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-else-if="data?.document_name?.includes('xls')"
|
|
||||||
/>
|
|
||||||
<img
|
|
||||||
src="@/assets/txt-icon.svg"
|
|
||||||
style="width: 90%"
|
|
||||||
alt=""
|
|
||||||
v-else-if="data?.document_name?.includes('txt')"
|
|
||||||
/>
|
|
||||||
<img src="@/assets/doc-icon.svg" style="width: 90%" alt="" v-else />
|
|
||||||
</el-icon>
|
|
||||||
<span class="ellipsis" :title="data?.document_name?.trim()">
|
<span class="ellipsis" :title="data?.document_name?.trim()">
|
||||||
{{ data?.document_name.trim() }}</span
|
{{ data?.document_name.trim() }}</span
|
||||||
>
|
>
|
||||||
@ -73,6 +36,7 @@
|
|||||||
</CardBox>
|
</CardBox>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { getImgUrl } from '@/utils/utils'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -83,23 +47,6 @@ const props = defineProps({
|
|||||||
default: 0
|
default: 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const iconMap: { [key: string]: string } = {
|
|
||||||
doc: '../../assets/doc-icon.svg',
|
|
||||||
docx: '../../assets/docx-icon.svg',
|
|
||||||
pdf: '../../assets/pdf-icon.svg',
|
|
||||||
md: '../../assets/md-icon.svg',
|
|
||||||
txt: '../../assets/txt-icon.svg',
|
|
||||||
xls: '../../assets/xls-icon.svg',
|
|
||||||
xlsx: '../../assets/xlsx-icon.svg'
|
|
||||||
}
|
|
||||||
function getIconPath(documentName: string) {
|
|
||||||
const extension = documentName.split('.').pop()?.toLowerCase()
|
|
||||||
if (!documentName || !extension) return new URL(`${iconMap['doc']}`, import.meta.url).href
|
|
||||||
if (iconMap && extension && iconMap[extension]) {
|
|
||||||
return new URL(`${iconMap[extension]}`, import.meta.url).href
|
|
||||||
}
|
|
||||||
return new URL(`${iconMap['doc']}`, import.meta.url).href
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.paragraph-source-card-height {
|
.paragraph-source-card-height {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user