| | |
| | | <template> |
| | | <div class="outcome-container"> |
| | | <el-form ref="searchRef" :model="searchParams" class="gd-search-form"> |
| | | <el-form-item label="巡查任务名称" prop="patrolTaskName"> |
| | | <el-form-item label="巡查任务名称" prop="patrolTaskIds"> |
| | | <el-select |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | v-model="searchParams.patrolTaskId" |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | collapse-tags |
| | | collapse-tags-tooltip |
| | | v-model="searchParams.patrolTaskIds" |
| | | placeholder="请选择" |
| | | clearable |
| | | filterable |
| | | |
| | | multiple |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | |
| | | /> |
| | | </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 class="search-btn" :icon="Search" @click="handleSearch"></el-button> --> |
| | | <el-button :icon="RefreshRight" @click="resetForm"></el-button> |
| | | <el-button :icon="Search" color="#383874" @click="handleSearch"></el-button> |
| | | <el-button :icon="Download" color="#4C34FF" :loading="exportLoading" :disabled="exportLoading" @click="handleBatchDownload">下载</el-button> |
| | | |
| | | </el-form-item> |
| | |
| | | <el-table class="gd-table" :data="list" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="46" /> |
| | | <el-table-column type="index" label="序号" width="80" /> |
| | | <el-table-column label="图片" width="120"> |
| | | <el-table-column label="图片/视频" > |
| | | <template v-slot="{ row }"> |
| | | <el-image |
| | | v-if="row.resultUrl" |
| | | :src="row.resultUrl" |
| | | :preview-src-list="[row.resultUrl]" |
| | | fit="cover" |
| | | style="width: 80px; height: 80px; border-radius: 4px;" |
| | | preview-teleported |
| | | /> |
| | | <span v-else>-</span> |
| | | <el-image |
| | | :key="row.thumbnail" |
| | | v-if="row.attachmentType === 1 || row.attachmentType === 2" |
| | | :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 && row.resultUrl" @click="videoClick(row)"> |
| | | <el-icon :size="30" color="#fff"> |
| | | <VideoPlay /> |
| | | </el-icon> |
| | | </div> |
| | | </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="150"> |
| | | <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> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <VideoPlayDialog |
| | | ref="videoPlayDialogRef" |
| | | v-if="VideoShow" |
| | | v-model="VideoShow" |
| | | :playUrl="currentVideo.resultUrl" |
| | | > |
| | | </VideoPlayDialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {gdTaskResultPageApi, gdTaskResultDownloadApi, gdTaskResultRemoveApi,listByWorkOrderId}from './orderManageApi' |
| | | import { Search, RefreshRight, Download } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { getDictLabel, appendAiImages } from '@ztzf/utils' |
| | | import dayjs from 'dayjs' |
| | | import VideoPlayDialog from '@/components/VideoPlayDialog.vue' |
| | | |
| | | const props = defineProps({ |
| | | workOrderId: { |
| | |
| | | const initSearchParams = () => ({ |
| | | current: 1, |
| | | size: 10, |
| | | patrolTaskId: '' |
| | | patrolTaskIds: [], |
| | | attachmentType: '' |
| | | }) |
| | | |
| | | const searchParams = ref(initSearchParams()) |
| | |
| | | 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) |
| | | // 获取巡查任务列表 |
| | |
| | | } |
| | | } |
| | | |
| | | // 缩略图加载失败时展示原图 |
| | | function handleThumbnailError(item) { |
| | | if (item.thumbnail !== item.resultUrl) { |
| | | item.thumbnail = item.resultUrl |
| | | } |
| | | } |
| | | |
| | | // 获取成果数据列表 |
| | | async function getList() { |
| | | loading.value = true |
| | | try { |
| | | const res = await gdTaskResultPageApi({ |
| | | ...searchParams.value, |
| | | id: props.workOrderId |
| | | workOrderId: props.workOrderId, |
| | | patrolTaskIds: searchParams.value.patrolTaskIds.length |
| | | ? searchParams.value.patrolTaskIds.join(',') |
| | | : '' |
| | | }) |
| | | list.value = res?.data?.data?.records || [] |
| | | 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 |
| | |
| | | |
| | | // 重置搜索 |
| | | function resetForm() { |
| | | searchRef.value?.resetFields() |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | searchRef.value?.resetFields() |
| | | searchParams.value = { ...initSearchParams() } |
| | | selectedRows.value = [] |
| | | getList() |
| | | } |
| | | |
| | | // 选择变化 |
| | |
| | | const url = URL.createObjectURL(blob) |
| | | const a = document.createElement('a') |
| | | a.href = url |
| | | a.download = `成果数据批量_${dayjs().format('YYYYMMDDHHmmss')}` |
| | | a.download = `成果数据_${dayjs().format('YYYYMMDDHHmmss')}` |
| | | document.body.appendChild(a) |
| | | a.click() |
| | | document.body.removeChild(a) |
| | |
| | | } |
| | | } |
| | | |
| | | // 点击视频 |
| | | let VideoShow = ref(false) |
| | | let currentVideo = ref({}) |
| | | function videoClick(row) { |
| | | currentVideo.value = row |
| | | VideoShow.value = true |
| | | } |
| | | |
| | | // 监听 workOrderId 变化 |
| | | watch( |
| | | () => props.workOrderId, |
| | | (newWorkOrderId) => { |
| | | if (newWorkOrderId) { |
| | | getList() |
| | | getPatrolTaskList() |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | () => props.workOrderId, |
| | | (newWorkOrderId) => { |
| | | if (newWorkOrderId) { |
| | | resetForm() |
| | | getList() |
| | | getPatrolTaskList() |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ) |
| | | |
| | | onMounted(() => { |
| | |
| | | |
| | | <style scoped lang="scss"> |
| | | .outcome-container { |
| | | height: 679px; |
| | | height: 680px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | overflow: hidden; |
| | | |
| | | |
| | | .gd-table-container { |
| | | flex: 1; |
| | | overflow: hidden; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | |
| | | .gd-table-content { |
| | | flex: 1; |
| | | overflow: auto; |
| | | } |
| | | .video-btn { |
| | | width: 80px; |
| | | height: 80px; |
| | | background-color: #9E9E9E; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border-radius: 4px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | </style> |
| | | </style> |