This commit is contained in:
@@ -1,5 +1,33 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="凭证查看" width="560px" @closed="handleClose">
|
||||
<div v-if="inline" class="voucher-preview voucher-preview--inline">
|
||||
<div v-if="loading" class="voucher-preview__loading">加载中...</div>
|
||||
<div v-else-if="files.length" class="voucher-preview__list">
|
||||
<div v-for="file in files" :key="file.key" class="voucher-preview__item">
|
||||
<ElImage
|
||||
v-if="file.isImage"
|
||||
class="voucher-preview__image"
|
||||
:src="file.url"
|
||||
:preview-src-list="imageUrls"
|
||||
:initial-index="getImageIndex(file.url)"
|
||||
fit="cover"
|
||||
preview-teleported
|
||||
/>
|
||||
<div v-else class="voucher-preview__file">
|
||||
<ElIcon><component :is="getFileIcon(file)" /></ElIcon>
|
||||
<span class="voucher-preview__file-type">{{ file.fileType }}</span>
|
||||
</div>
|
||||
<div class="voucher-preview__meta">
|
||||
<div class="voucher-preview__name" :title="file.name">{{
|
||||
getDisplayName(file.name)
|
||||
}}</div>
|
||||
<ElButton link type="primary" @click="openFile(file)">查看/下载</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ElEmpty v-else description="暂无凭证" />
|
||||
</div>
|
||||
|
||||
<ElDialog v-else v-model="visible" title="凭证查看" width="560px" @closed="handleClose">
|
||||
<div v-if="loading" class="voucher-preview__loading">加载中...</div>
|
||||
<div v-else-if="files.length" class="voucher-preview__list">
|
||||
<div v-for="file in files" :key="file.key" class="voucher-preview__item">
|
||||
@@ -48,6 +76,7 @@
|
||||
interface Props {
|
||||
fileKey?: string | string[]
|
||||
fileKeys?: string[]
|
||||
inline?: boolean
|
||||
}
|
||||
|
||||
interface VoucherFile {
|
||||
@@ -59,7 +88,9 @@
|
||||
fileType: string
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
inline: false
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
@@ -165,7 +196,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
visible.value = true
|
||||
visible.value = !props.inline
|
||||
loading.value = true
|
||||
files.value = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user