吉安感知网项目-前端
罗广辉
5 days ago 7320bc8910fbfe1488a236aa1588e4d388c3f36c
applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue
@@ -57,12 +57,14 @@
          <el-table-column label="图片/视频" >
            <template v-slot="{ row }">
                     <el-image
                        :key="row.thumbnail"
                        v-if="row.attachmentType === 1 || row.attachmentType === 2"
                        :src="row.attachmentType === 1 ? row.resultUrl : row.aiImg"
                        :preview-src-list="[row.attachmentType === 1 ? row.resultUrl : row.aiImg]"
                        :src="row.thumbnail"
                        :preview-src-list="[row.resultUrl]"
                        fit="cover"
                  style="width: 80px; height: 80px"
                  preview-teleported
                     style="width: 80px; height: 80px"
                     preview-teleported
                        @error="handleThumbnailError(row)"
                     />
                     <div class="video-btn" v-if="row.attachmentType === 3 && row.resultUrl" @click="videoClick(row)">
                        <el-icon :size="30" color="#fff">
@@ -113,7 +115,7 @@
import {gdTaskResultPageApi, gdTaskResultDownloadApi, gdTaskResultRemoveApi,listByWorkOrderId}from './orderManageApi'
import { Search, RefreshRight, Download } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getAiImg, getDictLabel } from '@ztzf/utils'
import { getDictLabel, appendAiImages } from '@ztzf/utils'
import dayjs from 'dayjs'
import VideoPlayDialog from '@/components/VideoPlayDialog.vue'
@@ -164,6 +166,13 @@
  }
}
// 缩略图加载失败时展示原图
function handleThumbnailError(item) {
  if (item.thumbnail !== item.resultUrl) {
    item.thumbnail = item.resultUrl
  }
}
// 获取成果数据列表
async function getList() {
  loading.value = true
@@ -175,13 +184,15 @@
        ? searchParams.value.patrolTaskIds.join(',')
        : ''
    })
      list.value = await Promise.all(
         (res?.data?.data?.records ?? []).map(async item => {
            if (item.attachmentType !== 2) return item
            const aiImg = await getAiImg(item.resultUrl,item.geojson)
            return { ...item, aiImg }
         })
      )
    list.value = (res?.data?.data?.records ?? []).map(item => ({
      ...item,
      thumbnail: item.resultUrl.replace(/(\.[^./?]+)(\?.*)?$/, '_thumbnail$1$2'),
    }))
    list.value.forEach(item => {
      if (item.attachmentType === 2 && item.geojson !== '[]' && item.geojson?.length) {
        appendAiImages(item)
      }
    })
    total.value = res?.data?.data?.total || 0
  } finally {
    loading.value = false