吉安感知网项目-前端
罗广辉
8 days ago 1d552a3bad95caae4af15322df28e6240b797693
applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue
@@ -57,14 +57,21 @@
          <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)">
                     <div
                        class="video-btn"
                        v-if="row.attachmentType === 3 && row.resultUrl"
                        :style="row.thumbnailUrl ? { backgroundImage: `url(${row.thumbnailUrl})`, backgroundSize: 'cover', backgroundPosition: 'center' } : {}"
                        @click="videoClick(row)"
                     >
                        <el-icon :size="30" color="#fff">
                           <VideoPlay />
                        </el-icon>
@@ -79,7 +86,7 @@
          </el-table-column>
          
          <el-table-column prop="shootTime" show-overflow-tooltip label="拍摄时间" />
          <el-table-column label="操作" class-name="operation-btns" width="120">
          <el-table-column label="操作" class-name="operation-btns" width="120" fixed="right">
            <template v-slot="{ row }">
              <!-- <el-link type="primary" @click="handleDownload(row)">下载</el-link> -->
              <el-link type="primary" @click="handleDelete(row)">删除</el-link>
@@ -113,7 +120,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 +171,13 @@
  }
}
// 缩略图加载失败时展示原图
function handleThumbnailError(item) {
  if (item.thumbnail !== item.resultUrl) {
    item.thumbnail = item.resultUrl
  }
}
// 获取成果数据列表
async function getList() {
  loading.value = true
@@ -175,13 +189,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