From 33d1c0ba2e7233785ebf0ed0ed30124f524cb019 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Wed, 12 Aug 2026 15:14:30 +0800
Subject: [PATCH] feat: 绘制ai框导致图片右侧出现空白 bug修复
---
applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue | 76 ++++++++++++++++++++++++++++++-------
1 files changed, 61 insertions(+), 15 deletions(-)
diff --git a/applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue b/applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue
index 7db0c2e..c5b2f97 100644
--- a/applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue
+++ b/applications/task-work-order/src/views/orderView/orderManage/orderManage/outcomeData.vue
@@ -23,6 +23,24 @@
</el-select>
</el-form-item>
+ <el-form-item label="成果类型" prop="attachmentType">
+ <el-select
+ class="gd-select"
+ popper-class="gd-select-popper"
+ v-model="searchParams.attachmentType"
+ placeholder="请选择"
+ clearable
+ @change="handleSearch"
+ >
+ <el-option
+ v-for="item in attachmentTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+
<el-form-item >
<el-button :icon="RefreshRight" @click="resetForm"></el-button>
<el-button :icon="Search" color="#383874" @click="handleSearch"></el-button>
@@ -39,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">
@@ -54,8 +74,14 @@
</template>
</el-table-column>
<el-table-column prop="patrolTaskName" show-overflow-tooltip label="巡查任务名称" />
+ <el-table-column label="成果类型">
+ <template v-slot="{ row }">
+ {{ getAttachmentTypeLabel(row.attachmentType) }}
+ </template>
+ </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>
@@ -89,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'
@@ -106,7 +132,8 @@
const initSearchParams = () => ({
current: 1,
size: 10,
- patrolTaskIds: []
+ patrolTaskIds: [],
+ attachmentType: ''
})
const searchParams = ref(initSearchParams())
@@ -117,6 +144,16 @@
const selectedRows = ref([])
const patrolTaskList = ref([])
const dictObj = inject('dictObj')
+const attachmentTypeOptions = [
+ { label: '媒体文件', value: 1 },
+ { label: 'AI文件', value: 2 },
+ { label: '主视频', value: 3 },
+]
+
+function getAttachmentTypeLabel(attachmentType) {
+ return attachmentTypeOptions.find(item => item.value === Number(attachmentType))?.label || ''
+}
+
// 导出加载状态
const exportLoading = ref(false)
// 获取巡查任务列表
@@ -126,6 +163,13 @@
patrolTaskList.value = res?.data?.data || []
} catch (error) {
console.error('获取巡查任务列表失败:', error)
+ }
+}
+
+// 缩略图加载失败时展示原图
+function handleThumbnailError(item) {
+ if (item.thumbnail !== item.resultUrl) {
+ item.thumbnail = item.resultUrl
}
}
@@ -140,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
@@ -252,8 +298,8 @@
let VideoShow = ref(false)
let currentVideo = ref({})
function videoClick(row) {
+ currentVideo.value = row
VideoShow.value = true
- currentVideo.value = row
}
// 监听 workOrderId 变化
--
Gitblit v1.9.3