Просмотр исходного кода

Merge branch 'stable' of http://39.98.153.250:9080/yudao/yudao-admin-yiqun into stable

xzc 4 дней назад
Родитель
Сommit
03783c69f3

+ 17 - 30
yudao-ui-admin-vue3/src/views/pressure2/reportArchivingBoiler/detail.vue

@@ -86,10 +86,11 @@ const getDetail = () => {
   FetchApis.getDetail(detailParams.value)
     .then((res) => {
       detailData.value = res || {}
-      // 附件数据已为 {url, name} 格式,直接使用
-      detailData.value.imageList = res.images || []
-      detailData.value.videoList = res.videos || []
-      detailData.value.attachmentList = res.attachments || []
+      // 合并图片、视频、文档附件到统一文件附件列表
+      const images = (res.images || []).map((item: any) => ({ ...item, fileType: 'image' }))
+      const videos = (res.videos || []).map((item: any) => ({ ...item, fileType: 'video' }))
+      const attachments = (res.attachments || []).map((item: any) => ({ ...item, fileType: 'attachment' }))
+      detailData.value.fileAttachList = [...images, ...videos, ...attachments]
     })
     .finally(() => {
       loadDone()
@@ -108,6 +109,11 @@ const fileTypeMap = {
   3: '非税缴费单',
   4: '重大问题线索告知单'
 }
+const fileAttachTypeMap: Record<string, string> = {
+  image: '图片',
+  video: '视频',
+  attachment: '文档'
+}
 const detailTableSchema = reactive<TableItem[]>([
   {
     title: '任务单相关文件',
@@ -353,40 +359,21 @@ const detailTableSchema = reactive<TableItem[]>([
     dataField: 'itemFiles'
   },
   {
-    title: '图片附件',
-    columns: [
-      { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
-      { label: '预览', prop: 'url', fieldProps: { align: 'center', minWidth: 200 },
-        render: (row) => <el-image style="width: 100px; height: 80px" src={buildFileUrl(row.url)} fit="cover" preview-teleported /> },
-      { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 100 },
-        render: (row) => <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button> }
-    ],
-    dataField: 'imageList'
-  },
-  {
-    title: '视频附件',
+    title: '文件附件',
     columns: [
       { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
       { label: '文件名称', prop: 'name', fieldProps: { align: 'center', minWidth: 200, showOverflowTooltip: true } },
-      { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 100 },
-        render: (row) => <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button> }
-    ],
-    dataField: 'videoList'
-  },
-  {
-    title: '文档附件',
-    columns: [
-      { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
-      { label: '文件名称', prop: 'name', fieldProps: { align: 'center', minWidth: 250, showOverflowTooltip: true } },
+      { label: '文件类型', prop: 'fileType', fieldProps: { align: 'center', minWidth: 100 },
+        render: (row) => fileAttachTypeMap[row.fileType] || '-' },
       { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 150 },
         render: (row) => (
           <>
             <el-button type="primary" link onClick={() => window.open(buildFileUrl(row.url), '_blank')}>预览</el-button>
-            <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button>
+            <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url, row.name)}>下载</el-button>
           </>
         ) }
     ],
-    dataField: 'attachmentList'
+    dataField: 'fileAttachList'
   }
 ])
 
@@ -856,14 +843,14 @@ const handlePreviewOrder = (row) => {
 const showAssociationOperationManual = ref(false)
 
 // 附件下载
-const handleAttachmentDownload = async (url: string) => {
+const handleAttachmentDownload = async (url: string, name?: string) => {
   try {
     const fullUrl = buildFileUrl(url)
     const blob = await request.download({ url: fullUrl })
     const blobUrl = URL.createObjectURL(blob as unknown as Blob)
     const link = document.createElement('a')
     link.href = blobUrl
-    link.download = url.substring(url.lastIndexOf('/') + 1) || '下载文件'
+    link.download = name || url.substring(url.lastIndexOf('/') + 1) || '下载文件'
     document.body.appendChild(link)
     link.click()
     document.body.removeChild(link)

+ 17 - 30
yudao-ui-admin-vue3/src/views/pressure2/reportArchivingPipe/detail.vue

@@ -86,10 +86,11 @@ const getDetail = () => {
   FetchApis.getDetail(detailParams.value)
     .then((res) => {
       detailData.value = res || {}
-      // 附件数据已为 {url, name} 格式,直接使用
-      detailData.value.imageList = res.images || []
-      detailData.value.videoList = res.videos || []
-      detailData.value.attachmentList = res.attachments || []
+      // 合并图片、视频、文档附件到统一文件附件列表
+      const images = (res.images || []).map((item: any) => ({ ...item, fileType: 'image' }))
+      const videos = (res.videos || []).map((item: any) => ({ ...item, fileType: 'video' }))
+      const attachments = (res.attachments || []).map((item: any) => ({ ...item, fileType: 'attachment' }))
+      detailData.value.fileAttachList = [...images, ...videos, ...attachments]
     })
     .finally(() => {
       loadDone()
@@ -108,6 +109,11 @@ const fileTypeMap = {
   3: '非税缴费单',
   4: '重大问题线索告知单'
 }
+const fileAttachTypeMap: Record<string, string> = {
+  image: '图片',
+  video: '视频',
+  attachment: '文档'
+}
 const detailTableSchema = reactive<TableItem[]>([
   {
     title: '任务单相关文件',
@@ -353,40 +359,21 @@ const detailTableSchema = reactive<TableItem[]>([
     dataField: 'itemFiles'
   },
   {
-    title: '图片附件',
-    columns: [
-      { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
-      { label: '预览', prop: 'url', fieldProps: { align: 'center', minWidth: 200 },
-        render: (row) => <el-image style="width: 100px; height: 80px" src={buildFileUrl(row.url)} fit="cover" preview-teleported /> },
-      { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 100 },
-        render: (row) => <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button> }
-    ],
-    dataField: 'imageList'
-  },
-  {
-    title: '视频附件',
+    title: '文件附件',
     columns: [
       { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
       { label: '文件名称', prop: 'name', fieldProps: { align: 'center', minWidth: 200, showOverflowTooltip: true } },
-      { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 100 },
-        render: (row) => <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button> }
-    ],
-    dataField: 'videoList'
-  },
-  {
-    title: '文档附件',
-    columns: [
-      { label: '序号', fieldProps: { type: 'index', align: 'center', width: 55 } },
-      { label: '文件名称', prop: 'name', fieldProps: { align: 'center', minWidth: 250, showOverflowTooltip: true } },
+      { label: '文件类型', prop: 'fileType', fieldProps: { align: 'center', minWidth: 100 },
+        render: (row) => fileAttachTypeMap[row.fileType] || '-' },
       { label: '操作', prop: 'operation', fieldProps: { align: 'center', minWidth: 150 },
         render: (row) => (
           <>
             <el-button type="primary" link onClick={() => window.open(buildFileUrl(row.url), '_blank')}>预览</el-button>
-            <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url)}>下载</el-button>
+            <el-button type="primary" link onClick={() => handleAttachmentDownload(row.url, row.name)}>下载</el-button>
           </>
         ) }
     ],
-    dataField: 'attachmentList'
+    dataField: 'fileAttachList'
   }
 ])
 
@@ -857,14 +844,14 @@ const handlePreviewOrder = (row) => {
 const showAssociationOperationManual = ref(false)
 
 // 附件下载
-const handleAttachmentDownload = async (url: string) => {
+const handleAttachmentDownload = async (url: string, name?: string) => {
   try {
     const fullUrl = buildFileUrl(url)
     const blob = await request.download({ url: fullUrl })
     const blobUrl = URL.createObjectURL(blob as unknown as Blob)
     const link = document.createElement('a')
     link.href = blobUrl
-    link.download = url.substring(url.lastIndexOf('/') + 1) || '下载文件'
+    link.download = name || url.substring(url.lastIndexOf('/') + 1) || '下载文件'
     document.body.appendChild(link)
     link.click()
     document.body.removeChild(link)