吉安感知网项目-前端
罗广辉
5 days ago 7320bc8910fbfe1488a236aa1588e4d388c3f36c
applications/task-work-order/src/views/orderView/orderManage/clueEvents/ViewDiaLog.vue
@@ -5,12 +5,14 @@
            <el-table-column label="线索缩略图" width="120">
               <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
                     @error="handleThumbnailError(row)"
                  />
                  <div class="video-btn" v-if="row.attachmentType === 3" @click="videoClick(row)">
                     <el-icon :size="30" color="#fff">
@@ -67,7 +69,7 @@
import { ref } from 'vue'
import { gdTaskResultListApi } from './achievementApi'
import DistributeDiaLog from './DistributeDiaLog.vue'
import { getAiImg } from '@ztzf/utils'
import { appendAiImages } from '@ztzf/utils'
import { VideoPlay } from '@element-plus/icons-vue'
import VideoPlayDialog from '@/components/VideoPlayDialog.vue'
@@ -110,19 +112,28 @@
   return row.areaCode || '-'
}
// 缩略图加载失败时展示原图
function handleThumbnailError(item) {
   if (item.thumbnail !== item.resultUrl) {
      item.thumbnail = item.resultUrl
   }
}
// 获取成果列表
async function getList() {
   if (!currentRow.value?.id) return
   loading.value = true
   try {
      const res = await gdTaskResultListApi({ patrolTaskId: currentRow.value.id })
      list.value = await Promise.all(
         (res?.data?.data ?? []).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 ?? []).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)
         }
      })
   } finally {
      loading.value = false
   }