Explorar el Código

pms 瑞都日报 附件回显

zhangcl hace 4 días
padre
commit
67f9caaf65
Se han modificado 1 ficheros con 15 adiciones y 2 borrados
  1. 15 2
      src/views/pms/iotrddailyreport/FillDailyReportForm.vue

+ 15 - 2
src/views/pms/iotrddailyreport/FillDailyReportForm.vue

@@ -284,7 +284,7 @@
         <!-- 第六行:上传附件 -->
         <el-row>
           <el-col :span="24">
-            <el-form-item label="上传附件">
+            <el-form-item label="附件">
               <!-- 文件上传组件 -->
               <FileUpload
                 v-if="!isApprovalMode"
@@ -856,6 +856,19 @@ watch(() => formData.value.techniqueIds, async (newTechniqueIds, oldTechniqueIds
 
 // 初始化表单数据
 const initFormData = (reportData: any) => {
+  // 处理附件数据格式转换
+  const formattedAttachments = (reportData.attachments || []).map((attachment: any) => ({
+    id: attachment.id,
+    category: attachment.category?.toLowerCase() || 'daily_report',
+    bizId: attachment.bizId,
+    type: attachment.type?.toLowerCase() || 'attachment',
+    filename: attachment.filename,
+    fileType: attachment.fileType, // 使用辅助函数获取文件类型
+    filePath: attachment.filePath,
+    fileSize: attachment.fileSize,
+    remark: attachment.remark || ''
+  }))
+
   formData.value = {
     ...formData.value,
     id: reportData.id,
@@ -870,7 +883,7 @@ const initFormData = (reportData: any) => {
     companyId: reportData.companyId || '',
     dynamicFields: {}, // 确保有初始值
     // 初始化附件数据
-    attachments: reportData.attachments || []
+    attachments: formattedAttachments
   }
   queryParams.deptId = reportData.companyId
   // 设置时间范围选择器