From f46302b20191c720c8ff9467fdfcf62f87c24b7b Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 13 Jun 2025 15:56:59 +0800
Subject: [PATCH] feat:地图修改样式
---
src/views/dataCenter/dataCenter.vue | 278 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 186 insertions(+), 92 deletions(-)
diff --git a/src/views/dataCenter/dataCenter.vue b/src/views/dataCenter/dataCenter.vue
index 131a552..609ffe5 100644
--- a/src/views/dataCenter/dataCenter.vue
+++ b/src/views/dataCenter/dataCenter.vue
@@ -34,21 +34,21 @@
<img
class="quanjing"
@click="clickpanorama(scope.row)"
- v-if="scope.row?.resultType === 3"
- :src="scope.row.link"
+ v-if="scope.row?.resultType === 5"
+ :src="scope.row?.link"
alt=""
/>
<img
v-else-if="scope.row?.resultType === 1"
- :src="convertVideoUrlToThumbnail(scope.row.link)"
+ :src="convertVideoUrlToThumbnail(scope.row?.link)"
alt=""
class="imageBox"
@click="enterFullScreen(scope.row)"
/>
<el-image
v-else
- :src="scope.row.smallUrl"
- :preview-src-list="[scope.row.showUrl]"
+ :src="scope.row?.smallUrl"
+ :preview-src-list="[scope.row?.showUrl]"
fit="cover"
preview-teleported
/>
@@ -68,13 +68,13 @@
<el-table-column label="操作" width="150" align="center">
<template #default="scope">
<span class="look" @click="lookDetail(scope.row)">查看</span>
- <span
- class="delete"
- @click="deleteDetail(scope.row)"
- v-if="scope.row.fileformat !== 'AI识别'"
+ <span class="delete" @click="deleteDetail(scope.row)" v-if="scope.row.resultType !== 2"
>删除</span
>
- <span class="location" @click="positionDetail()" v-if="scope.row.fileformat !== '视频'"
+ <span
+ class="location"
+ @click="positionDetail(scope.row)"
+ v-if="scope.row.resultType !== 1"
>定位</span
>
</template>
@@ -98,53 +98,64 @@
<el-dialog v-model="dialogVisible" width="60%" append-to-body>
<template #header="{ titleId, titleClass }">
<div class="my-header">
- <h4 :id="titleId" :class="titleClass">{{ dialogDetailList?.filename }}</h4>
- <el-button type="success" plain icon="el-icon-download">下载</el-button>
+ <h4 :id="titleId" :class="titleClass">{{ dialogDetailList?.nickName }}</h4>
+
</div>
</template>
<div class="detailContainer">
<div class="leftImg">
<img
v-if="dialogDetailList?.resultType === 1"
- :src="convertVideoUrlToThumbnail(dialogDetailList.link)"
+ :src="convertVideoUrlToThumbnail(dialogDetailList?.link)"
alt=""
class="imageBox"
/>
- <img v-else :src="dialogDetailList.link" alt="" />
+ <img v-else :src="getSmallImg(dialogDetailList?.link)" alt="" />
</div>
<div class="rightDetail">
<div class="title">
<div class="inputEdit">
- 文件名称:<span v-if="!dialogDetailList.checkedinput">{{
- dialogDetailList?.filename
+ 文件名称:<span class="fileTitle" v-if="!dialogDetailList?.checkedinput">{{
+ dialogDetailList?.nickName
}}</span>
<el-input
v-else
- v-model="dialogDetailList.filename"
+ v-model="dialogDetailList.nickName"
@keyup.enter="saveTitle()"
class="title-input"
clearable
/>
</div>
- <div class="editname" @click="editTitle(dialogDetailList)">
- <span v-if="!dialogDetailList.checkedinput"
+ <div class="editname" >
+ <span v-if="!dialogDetailList?.checkedinput" @click="editTitle(dialogDetailList)"
><el-icon><Edit /></el-icon
></span>
<div v-else class="suffixBoxEdit">
- <div class="editText" @click="submitEditSuffix(item, index)">✔</div>
- <div class="editText" @click="cancelEditSuffix(item, index)">✖</div>
+ <div class="editText" @click="submitEditSuffix(dialogDetailList)">✔</div>
+ <div class="editText" @click="cancelEditSuffix(dialogDetailList)">✖</div>
</div>
</div>
</div>
<div>任务名称:{{ dialogDetailList?.jobName }}</div>
<div>所属区域:{{ dialogDetailList?.regionName }}</div>
- <div>拍摄机巢:{{ dialogDetailList?.nickName }}</div>
- <div>照片位置:{{ dialogDetailList?.longitude }},{{ dialogDetailList?.latitude }}</div>
+ <div>拍摄机巢:{{ dialogDetailList?.nestName }}</div>
+ <div>
+ 照片位置:{{ _.round(dialogDetailList?.longitude, 3) }},{{
+ _.round(dialogDetailList?.latitude, 3)
+ }}
+ </div>
<div>任务时间:{{ dialogDetailList?.jobTime }}</div>
<div>拍摄时间:{{ dialogDetailList?.createTime }}</div>
<div>文件类型:{{ photoTypeMap[dialogDetailList?.photoType] }}</div>
<div>文件格式:{{ resultTypeMap[dialogDetailList?.resultType] }}</div>
<div>照片文件大小:{{ dialogDetailList?.attachSize }}</div>
+ <div> <el-button
+ type="success"
+ plain
+ icon="el-icon-download"
+ @click="detailDownLoad(dialogDetailList)"
+ >下载</el-button
+ ></div>
</div>
</div>
</el-dialog>
@@ -176,7 +187,13 @@
</div>
</el-dialog>
<!-- 地图弹框 -->
- <dataCenterMap v-model:show="dataCenterMapVisible"></dataCenterMap>
+ <dataCenterMap
+ ref="mapComponent"
+ v-model:show="dataCenterMapVisible"
+ :jobId="jobId"
+ @lookDetail="lookDetail"
+ :dotData="mapList"
+ ></dataCenterMap>
</div>
</template>
@@ -186,14 +203,16 @@
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
import searchData from '@/views/dataCenter/components/searchData.vue';
import fy1 from '@/assets/images/dataCenter/1.jpeg';
+import _ from 'lodash';
import {
getaiImagesPageAPI,
getAttachInfoAPI,
deleteFileMultipleApi,
downloadApi,
+ updataTitleApi,
} from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg } from '@/utils/util';
-import { onMounted } from 'vue';
+import { onMounted, watch } from 'vue';
import dayjs from 'dayjs';
// 视频一帧
function convertVideoUrlToThumbnail(videoUrl) {
@@ -209,7 +228,7 @@
0: '照片',
1: '视频',
2: 'AI识别',
- 3: '全景',
+ 5: '全景',
4: '正射',
};
const photoTypeMap = {
@@ -221,7 +240,22 @@
const startTime = dayjs().subtract(6, 'day').startOf('day');
const endTime = dayjs().endOf('day');
const timeRange = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
-
+// 全景预览
+const panoramaParamsShow = ref(false);
+const panoramaParamsUrl = ref(null);
+const clickpanorama = val => {
+ panoramaParamsShow.value = true;
+ panoramaParamsUrl.value = val.link;
+};
+// 视频
+const currentVideoTitle = ref('');
+const VideoShow = ref(false);
+const currentVideoUrl = ref(null);
+const enterFullScreen = val => {
+ currentVideoTitle.value = val?.nickName;
+ currentVideoUrl.value = val?.link;
+ VideoShow.value = true;
+};
const jobListParams = reactive({
current: 1,
size: 10,
@@ -232,25 +266,26 @@
// 获取列表数据
const getaiImagesPage = () => {
- getaiImagesPageAPI({
- current: jobListParams.current,
- size: jobListParams.size,
+ const params = {
orderByCreateTime: jobListParams.orderByCreateTime,
...jobListParams.searchParams,
- }).then(res => {
- loading.value = true;
- total.value = res.data.data.total;
- tableData.value = res.data.data.records.map(i => ({
- ...i,
- checked: false,
- url: i.link,
- smallUrl: getSmallImg(i.link),
- showUrl: getShowImg(i.link),
- file_name: i.name.split('/').pop(),
- }));
- console.log('res', tableData.value);
- loading.value = false;
- });
+ };
+ getaiImagesPageAPI(params, { current: jobListParams.current, size: jobListParams.size }).then(
+ res => {
+ loading.value = true;
+ total.value = res.data.data.total;
+ tableData.value = res.data.data.records.map(i => ({
+ ...i,
+ checked: false,
+ url: i?.link,
+ smallUrl: getSmallImg(i?.link),
+ showUrl: getShowImg(i?.link),
+ file_name: i.name.split('/').pop(),
+ }));
+ // console.log('res', tableData.value);
+ loading.value = false;
+ }
+ );
};
// 查询
const searchClick = params => {
@@ -262,13 +297,10 @@
const handleSizeChange = val => {
jobListParams.size = val;
getaiImagesPage();
-
- console.log('jobListParams.size', jobListParams.size);
};
const handleCurrentChange = val => {
jobListParams.current = val;
getaiImagesPage();
- console.log('jobListParams.current', jobListParams.current);
};
// 多选
const selectedRows = ref([]);
@@ -279,6 +311,25 @@
});
selectedRows.value = val;
+};
+// 删除
+const deleteDetail = val => {
+ ElMessageBox.confirm('您确定删除吗?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteFileMultipleApi(val.id)
+ .then(res => {
+ ElMessage.success('删除成功');
+ getaiImagesPage();
+ })
+ .catch(error => {
+ ElMessage.error('删除失败');
+ });
+ })
+ .catch(() => {});
};
// url下载
function aLinkDownload(url, name) {
@@ -296,13 +347,12 @@
if (list.length === 1) {
list.forEach((item, index) => {
setTimeout(() => {
- // console.log('item.url, item.file_name', item.url, item.nickName)
- aLinkDownload(item.url, item.nickName);
+ aLinkDownload(item.url, item?.nickName);
}, index * 500); // 每个文件下载间隔50毫秒
});
} else {
// loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' })
- const fileIds = list.map(i => Number(i.id));
+ const fileIds = list.map(i =>i.id);
console.log('fileIds', fileIds, list);
let aaa = {
areaCode: '',
@@ -319,7 +369,7 @@
downloadApi(aaa).then(res => {
console.log('res.data.data', res.data.data);
- // aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
+ aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
// loading.close()
});
}
@@ -328,68 +378,104 @@
const downloadFile = () => {
fileDownload();
};
+const detailDownLoad = val => {
+ aLinkDownload(val.link, val?.nickName);
+};
// 全部下载
const aLLDownloadFile = () => {
- console.log('全部下载');
+
+ const params = {
+ ...jobListParams.searchParams,
+ };
+ console.log('params',params);
+
+ downloadApi(params).then(res => {
+ console.log('res.data.data', res.data.data);
+ aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
+
+ });
+
};
// 查看弹框
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
-const lookDetail = val => {
-console.log('val',val);
+const lookDetail = val => {
getAttachInfoAPI(val.id).then(res => {
dialogDetailList.value = res.data.data;
+ dialogDetailList.value = { ...res.data.data, checkedinput: false };
});
dialogVisible.value = true;
};
-// 删除
-const deleteDetail = val => {
- ElMessageBox.confirm('您确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- deleteFileMultipleApi(val.id)
- .then(res => {
- console.log('删除成功', res);
- ElMessage.success('删除成功');
- getaiImagesPage();
- })
- .catch(error => {
- ElMessage.error('删除失败');
- });
- })
- .catch(() => {});
-};
+
+const fileNameedit = ref('');
// 编辑文件名
const editTitle = val => {
- // console.log('val', val);
- val.checkedinput = !val.checkedinput;
+
+ val.checkedinput = true;
+ fileNameedit.value = val?.nickName;
};
-// 全景预览
-const panoramaParamsShow = ref(false);
-const panoramaParamsUrl = ref(null);
-const clickpanorama = val => {
- panoramaParamsShow.value = true;
- panoramaParamsUrl.value = val.img;
- // console.log('全景', val);
+// 取消
+const cancelEditSuffix = item => {
+ item.nickName = fileNameedit.value;
+ item.checkedinput = false;
};
-// 视频
-const currentVideoTitle = ref('');
-const VideoShow = ref(false);
-const currentVideoUrl = ref(null);
-const enterFullScreen = val => {
- currentVideoTitle.value = val.nickName;
- currentVideoUrl.value = val.link;
- VideoShow.value = true;
+const submitEditSuffix = item => {
+ saveTitle(item);
};
+// 通用空值检查函数
+const validateNickname = (name, fieldName) => {
+ if (!name || name.trim() === '') {
+ ElMessage.warning(`${fieldName}不能为空`);
+ return false;
+ }
+ if (name.length > 50) {
+ ElMessage.warning(`${fieldName}不能超过50个字符`);
+ return false;
+ }
+ return true;
+};
+// 保存文件名
+const saveTitle = item => {
+ const updateparams = {
+ id: Number(item.id),
+ nickName: item.nickName,
+ };
+ // 验证并提示
+ if (!validateNickname(updateparams.nickName, '名称')) return;
+ item.checkedinput = false;
+ updataTitleApi(updateparams)
+ .then(res => {
+ if (res.status === 200) {
+ ElMessage.success('修改成功');
+ } else {
+ ElMessage.error(res.data.message || '修改失败');
+ }
+ })
+ .catch(error => {
+ ElMessage.error('请求失败,请稍后重试');
+ console.error('API error:', error);
+ });
+};
+
// 地图弹框
+const mapComponent = ref(null);// 创建子组件引用
+const mapList = ref(null);
const dataCenterMapVisible = ref(false);
-const positionDetail = () => {
+const jobId = ref('');
+const positionDetail = val => {
+ jobId.value = val.wayLineJobId;
+ mapList.value = val;
dataCenterMapVisible.value = true;
+ // 确保地图组件加载完成
+ nextTick(() => {
+ if (mapComponent.value) {
+ // 调用子组件方法并传递数据
+ mapComponent.value.initEntityOrPopup(val)
+ }
+ });
};
+
onMounted(() => {
getaiImagesPage();
});
@@ -473,6 +559,13 @@
.inputEdit {
display: flex;
align-items: center;
+ width: 100%;
+ .fileTitle{
+ width: 70%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
}
}
div {
@@ -482,6 +575,7 @@
}
.my-header :deep(.el-dialog__title) {
margin: 0 !important;
+ height: 19px;
}
.my-header {
display: flex;
--
Gitblit v1.9.3