From 847b2af27faaf21c50bb1c2c75560325b59d631d Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 20 Jan 2026 14:04:10 +0800
Subject: [PATCH] feat:附件接口
---
applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
index 5e9f0d5..fa3078e 100644
--- a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
+++ b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -118,6 +118,18 @@
</div>
</div>
</div>
+ <div v-if="detailDemandStatus === '2'">
+ <div class="label">数据详情 </div>
+ <el-table :data="tableData" border style="width: 100%">
+ <el-table-column prop="name" label="文件名称" />
+ <el-table-column prop="fileSize" label="文件大小" />
+ <el-table-column fixed="right" label="操作" min-width="100">
+ <template #default="scope">
+ <el-button link type="text" @click="downloadFileFromTable(scope.row)">下载</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
</div>
</div>
<template #footer>
@@ -140,7 +152,8 @@
gdSupplyDemandDetailApi,
putFileAttachApi,
gdSupplyDemandAuditPassApi,
- gdSupplyDemandAuditRejectApi
+ gdSupplyDemandAuditRejectApi,
+ gdSupplyDemandAuditAttachmentListApi
} from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi'
import { ElMessage } from 'element-plus'
import reasonForRejectionDialog from '@/views/orderView/orderDataManage/supplyAdd/reasonForRejectionDialog.vue'
@@ -161,7 +174,7 @@
const responseData = ref([])
// 拒绝申请弹框控制
const rejectionDialogVisible = ref(false) // 拒绝申请弹框显隐
-
+const tableData = ref([]) // 附件表格数据
// 文件选择变化
const handleFileChange = (file, fileList) => {
if (fileList.length > 0) {
@@ -273,6 +286,21 @@
}
}
+// 从表格下载文件
+const downloadFileFromTable = file => {
+ if (file.fileUrl) {
+ // 创建一个隐藏的a标签来触发下载
+ const a = document.createElement('a')
+ a.href = file.fileUrl
+ a.download = file.name || 'attachment'
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+ } else {
+ ElMessage.warning('文件链接无效')
+ }
+}
+
// 根据部门ID获取部门名称
function getDeptNameById(deptId, deptList) {
// 处理类型转换,确保比较的是相同类型
@@ -317,6 +345,29 @@
data.responsibleDeptName = getDeptNameById(data.responsibleDeptId, deptTree.value)
}
formData.value = data
+
+ // 加载附件数据
+ await loadAttachments(id)
+}
+
+// 加载附件数据
+async function loadAttachments(demandId) {
+ try {
+ const res = await gdSupplyDemandAuditAttachmentListApi({ demandId:demandId })
+ const attachments = res?.data?.data ?? []
+
+ // 格式化附件数据以匹配表格结构
+ tableData.value = attachments.map(attachment => ({
+ name: attachment.attachId ? `附件ID: ${attachment.attachId}` : '未知附件',
+ fileSize: attachment.fileSize ? `${attachment.fileSize}M` : '未知大小',
+ fileUrl: attachment.fileUrl,
+ id: attachment.id
+ }))
+ } catch (error) {
+ console.error('加载附件数据失败:', error)
+ ElMessage.error('加载附件数据失败,请重试')
+ tableData.value = []
+ }
}
// 拒绝申请
--
Gitblit v1.9.3