| | |
| | | )" |
| | | > |
| | | <el-image |
| | | :key="item.thumbnail" |
| | | v-if="item.attachmentType === 1 || item.attachmentType === 2" |
| | | :src="item.attachmentType === 1 ? item.resultUrl : item.aiImg" |
| | | :preview-src-list="[item.attachmentType === 1 ? item.resultUrl : item.aiImg]" |
| | | :src="item.thumbnail" |
| | | :preview-src-list="[item.resultUrl]" |
| | | fit="cover" |
| | | preview-teleported |
| | | @error="handleThumbnailError(item)" |
| | | /> |
| | | <div class="video-btn" v-if="item.attachmentType === 3" @click="videoClick(item)"> |
| | | <el-icon :size="30" color="#fff"> |
| | |
| | | <script setup> |
| | | import { computed, ref, onMounted, inject } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { fieldRules, flyVisual, geomAnalysis, getAiImg } from '@ztzf/utils' |
| | | import { fieldRules, flyVisual, geomAnalysis, appendAiImages } from '@ztzf/utils' |
| | | import { |
| | | gdPatrolTaskRepublish, |
| | | gdFlyerPageApi, |
| | |
| | | } |
| | | |
| | | let taskResultList = ref([]) |
| | | // 缩略图加载失败时展示原图 |
| | | function handleThumbnailError(item) { |
| | | if (item.thumbnail !== item.resultUrl) { |
| | | item.thumbnail = item.resultUrl |
| | | } |
| | | } |
| | | |
| | | // 获取成果列表 |
| | | async function getTaskResultList() { |
| | | if (!formData.value?.id) return |
| | | try { |
| | | const res = await gdTaskResultListApi({ patrolTaskId: formData.value.id }) |
| | | taskResultList.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 } |
| | | }) |
| | | ) |
| | | taskResultList.value = (res?.data?.data ?? []).map(item => ({ |
| | | ...item, |
| | | thumbnail: item.resultUrl.replace(/(\.[^./?]+)(\?.*)?$/, '_thumbnail$1$2'), |
| | | })) |
| | | taskResultList.value.forEach(item => { |
| | | if (item.attachmentType === 2 && item.geojson !== '[]' && item.geojson?.length) { |
| | | appendAiImages(item) |
| | | } |
| | | }) |
| | | } finally { |
| | | } |
| | | } |