|
|
@@ -49,6 +49,20 @@
|
|
|
<el-table-column prop="unitName" label="单位" min-width="60" align="center" />
|
|
|
</el-table>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 对账附件 -->
|
|
|
+ <div v-if="form.annexAddress">
|
|
|
+ <el-divider content-position="left">对账附件</el-divider>
|
|
|
+ <el-table :data="attachmentList" border style="width: 100%">
|
|
|
+ <el-table-column type="index" label="序号" width="80" align="center" />
|
|
|
+ <el-table-column prop="name" label="文件名称" min-width="200" align="center" />
|
|
|
+ <el-table-column label="操作" width="150" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="primary" link @click="handlePreview(row.url)">预览</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
@@ -59,7 +73,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, getCurrentInstance, toRefs } from 'vue';
|
|
|
+import { ref, computed, getCurrentInstance, toRefs } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { getStatementInfo } from '@/api/pc/enterprise/statement';
|
|
|
import type { StatementOrder, StatementDetail, StatementProduct } from '@/api/pc/enterprise/statementTypes';
|
|
|
@@ -73,6 +87,57 @@ const visible = ref(false);
|
|
|
const loading = ref(false);
|
|
|
const form = ref<Partial<StatementOrder>>({});
|
|
|
|
|
|
+// 附件列表
|
|
|
+const attachmentList = computed(() => {
|
|
|
+ if (!form.value.annexAddress) return [];
|
|
|
+ const urls = form.value.annexAddress.split(',').filter(Boolean);
|
|
|
+ return urls.map((url, index) => {
|
|
|
+ const fileName = url.split('/').pop() || `附件${index + 1}`;
|
|
|
+ return {
|
|
|
+ name: decodeURIComponent(fileName),
|
|
|
+ url: url.trim()
|
|
|
+ };
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+// 预览附件
|
|
|
+const handlePreview = (url: string) => {
|
|
|
+ if (!url) {
|
|
|
+ ElMessage.warning('文件地址不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.open(url, '_blank');
|
|
|
+};
|
|
|
+
|
|
|
+// 下载附件
|
|
|
+const handleDownload = async (url: string, name: string) => {
|
|
|
+ if (!url) {
|
|
|
+ ElMessage.warning('文件地址不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const response = await fetch(url);
|
|
|
+ const blob = await response.blob();
|
|
|
+ const blobUrl = window.URL.createObjectURL(blob);
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = blobUrl;
|
|
|
+ link.download = name || '附件';
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ window.URL.revokeObjectURL(blobUrl);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('下载失败:', error);
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = url;
|
|
|
+ link.download = name || '附件';
|
|
|
+ link.target = '_blank';
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const open = async (id: number | string) => {
|
|
|
visible.value = true;
|
|
|
loading.value = true;
|