From 6d515bc5ea69bac73a656dfacee920aab85b1660 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 20 Jan 2026 16:28:15 +0800
Subject: [PATCH] feat:更新

---
 applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue |  122 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 107 insertions(+), 15 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..456821f 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
@@ -9,9 +9,9 @@
 			<div class="detail-right">
 				<!--				拒绝申请-->
 				<div class="reject-reason-container" v-if="detailDemandStatus === '3'">
-					<div class="label">拒绝原因 </div>
+					<div class="label">拒绝原因</div>
 					<div class="reject-reason">
-						这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因这是拒绝原因
+						{{reasonForRejection}}
 					</div>
 				</div>
 				<div>
@@ -81,9 +81,9 @@
 						</div>
 					</div>
 				</div>
-<!--				申请中-->
+				<!--				申请中-->
 				<div v-if="detailDemandStatus === '1'">
-					<div class="label">数据上传 </div>
+					<div class="label">数据上传</div>
 					<div class="upload-container">
 						<el-upload
 							ref="uploadRef"
@@ -118,11 +118,31 @@
 						</div>
 					</div>
 				</div>
+				<div v-if="detailDemandStatus === '2'">
+					<div class="label">数据详情</div>
+					<el-table :data="tableData" border style="width: 100%">
+						<el-table-column prop="fileOriginalName" 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>
-			<el-button class="save-btn" color="#4C34FF" @click="rejectTheApplication">拒绝申请</el-button>
-			<el-button color="#F2F3F5" @click="approvedByTheReview">审核通过</el-button>
+			<template v-if="detailDemandStatus === '1'">
+				<el-button class="save-btn" color="#4C34FF" @click="rejectTheApplication">拒绝申请</el-button>
+				<el-button color="#F2F3F5" @click="approvedByTheReview">审核通过</el-button>
+			</template>
+			<template v-if="detailDemandStatus === '2'">
+				<el-button class="save-btn" color="#4C34FF" @click="downloadAllFiles">全部下载</el-button>
+			</template>
+			<template v-if="detailDemandStatus === '3'">
+				<el-button class="save-btn" color="#4C34FF" @click="visible =false">关闭</el-button>
+			</template>
 		</template>
 	</el-dialog>
 
@@ -140,7 +160,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'
@@ -150,6 +171,7 @@
 const dictObj = inject('dictObj')
 const deptTree = inject('deptTree')
 const detailDemandStatus = inject('detailDemandStatus')
+const reasonForRejection = inject('reasonForRejection')
 const demandId = ref('')
 const visible = defineModel() // 弹框显隐
 const formData = ref({}) // 表单数据
@@ -161,7 +183,7 @@
 const responseData = ref([])
 // 拒绝申请弹框控制
 const rejectionDialogVisible = ref(false) // 拒绝申请弹框显隐
-
+const tableData = ref([]) // 附件表格数据
 // 文件选择变化
 const handleFileChange = (file, fileList) => {
 	if (fileList.length > 0) {
@@ -273,6 +295,52 @@
 	}
 }
 
+// 从表格下载文件
+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('文件链接无效')
+	}
+}
+
+// 下载所有文件
+const downloadAllFiles = () => {
+	if (!tableData.value || tableData.value.length === 0) {
+		ElMessage.warning('没有可下载的文件')
+		return
+	}
+
+	// 统计有效文件数量
+	const validFiles = tableData.value.filter(file => file.fileUrl)
+	if (validFiles.length === 0) {
+		ElMessage.warning('所有文件链接均无效')
+		return
+	}
+
+	ElMessage.success(`开始下载${validFiles.length}个文件`)
+
+	// 依次下载每个文件(添加延迟以避免浏览器限制)
+	validFiles.forEach((file, index) => {
+		setTimeout(() => {
+			if (file.fileUrl) {
+				const a = document.createElement('a')
+				a.href = file.fileUrl
+				a.download = file.name || `attachment_${index + 1}`
+				document.body.appendChild(a)
+				a.click()
+				document.body.removeChild(a)
+			}
+		}, index * 300) // 300ms delay between downloads
+	})
+}
+
 // 根据部门ID获取部门名称
 function getDeptNameById(deptId, deptList) {
 	// 处理类型转换,确保比较的是相同类型
@@ -317,6 +385,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 => ({
+			fileOriginalName: attachment.fileOriginalName ,
+			fileSize: attachment.fileSize ? `${attachment.fileSize}M` : '',
+			fileUrl: attachment.fileUrl,
+			id: attachment.id,
+		}))
+	} catch (error) {
+		console.error('加载附件数据失败:', error)
+		ElMessage.error('加载附件数据失败,请重试')
+		tableData.value = []
+	}
 }
 
 // 拒绝申请
@@ -379,12 +470,13 @@
 	width: 75%;
 	.reject-reason {
 		margin-bottom: 20px;
-		background: #F2F3F5;
+		background: #f2f3f5;
 		border-radius: 2px 2px 2px 2px;
 		padding: 15px;
+		height: 100px;
 	}
 	.requirementsDetailsBox {
-		background: #F2F3F5;
+		background: #f2f3f5;
 		border-radius: 2px 2px 2px 2px;
 	}
 
@@ -430,20 +522,20 @@
 /* 上传容器样式 */
 .upload-container {
 	padding: 15px;
-	background: #F2F3F5;
+	background: #f2f3f5;
 	border-radius: 2px 2px 2px 2px;
 }
 
 .uploaded-files {
 	margin-top: 15px;
-	
+
 	h4 {
 		margin-bottom: 10px;
 		font-size: 14px;
 		color: #333333;
 		font-weight: 500;
 	}
-	
+
 	.file-item {
 		display: flex;
 		align-items: center;
@@ -451,7 +543,7 @@
 		background: white;
 		border-radius: 4px;
 		margin-bottom: 5px;
-		
+
 		span {
 			flex: 1;
 			color: #333;
@@ -476,4 +568,4 @@
 :deep(.el-upload-list) {
 	margin-top: 10px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3