| | |
| | | </div> |
| | | </template> |
| | | </div> |
| | | <div v-if="attachmentList.length" |
| | | <div v-for="group in attachmentGroups" |
| | | :key="group.title" |
| | | class="detail-block"> |
| | | <div class="detail-block-title">附件列表</div> |
| | | <div class="detail-block-title">{{ group.title }}</div> |
| | | <div class="attachment-list"> |
| | | <div v-for="file in attachmentList" |
| | | <div v-for="file in group.files" |
| | | :key="file.id" |
| | | class="attachment-item"> |
| | | <el-icon class="file-icon"> |
| | |
| | | <el-link v-if="file.previewURL || file.url" |
| | | type="primary" |
| | | :underline="false" |
| | | @click="openFile(file.previewURL || file.url)">预览</el-link> |
| | | @click="previewFile(file.previewURL || file.url)">预览</el-link> |
| | | <el-divider v-if="(file.previewURL || file.url) && file.downloadURL" |
| | | direction="vertical" /> |
| | | <el-link v-if="file.downloadURL" |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <filePreview ref="filePreviewRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed } from "vue"; |
| | | import { computed, ref } from "vue"; |
| | | import { Paperclip } from "@element-plus/icons-vue"; |
| | | import filePreview from "@/components/filePreview/index.vue"; |
| | | import { formatDisplayTime } from "../../approve-template/approveTemplateConstants.js"; |
| | | import { |
| | | approvalTypeLabel, |
| | |
| | | |
| | | const formResolved = computed(() => resolveInstanceFormFields(props.row)); |
| | | |
| | | const filePreviewRef = ref(); |
| | | |
| | | |
| | | // 是否为特殊审批类型(采购、发货、报价、销售台账) |
| | | const isSpecialApprovalType = computed(() => { |
| | |
| | | return Array.isArray(list) ? list : []; |
| | | }); |
| | | |
| | | // 台账自身附件:销售台账 listPage 返回 storageBlobVOs,采购台账 getPurchaseByCode 返回 storageBlobVOS |
| | | const businessAttachments = computed(() => { |
| | | if (![5, 19].includes(props.row.businessType)) return []; |
| | | const detail = props.detailData || {}; |
| | | const candidates = [detail.storageBlobVOs, detail.storageBlobVOS, detail.storageBlobVOList]; |
| | | return candidates.find(list => Array.isArray(list) && list.length) || []; |
| | | }); |
| | | |
| | | const attachmentGroups = computed(() => { |
| | | const groups = []; |
| | | if (businessAttachments.value.length) { |
| | | groups.push({ title: "台账附件", files: businessAttachments.value }); |
| | | } |
| | | if (attachmentList.value.length) { |
| | | groups.push({ title: "审批附件", files: attachmentList.value }); |
| | | } |
| | | return groups; |
| | | }); |
| | | |
| | | function previewFile(url) { |
| | | if (!url) return; |
| | | filePreviewRef.value?.open(url); |
| | | } |
| | | |
| | | function openFile(url) { |
| | | if (!url) return; |
| | | window.open(url, "_blank"); |