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/components/searchData.vue | 4
src/hooks/components/EventPopUpBox.vue | 15 ++-
src/views/dataCenter/dataCenter.vue | 85 ++++++++++-----------
src/views/dataCenter/components/dataCenterMap.vue | 91 +++++++++-------------
4 files changed, 88 insertions(+), 107 deletions(-)
diff --git a/src/hooks/components/EventPopUpBox.vue b/src/hooks/components/EventPopUpBox.vue
index 2eecb86..1ebcc68 100644
--- a/src/hooks/components/EventPopUpBox.vue
+++ b/src/hooks/components/EventPopUpBox.vue
@@ -59,9 +59,12 @@
<style scoped lang="scss">
.mapPopUpBox {
width: 271px;
- height: 173px;
- background: url('@/assets/images/dataCenter/datamap/popUpBox.png') no-repeat center / 100% 100%;
- padding: 13px 15px;
+ height: 153px;
+ // background: url('@/assets/images/dataCenter/datamap/popUpBox.png') no-repeat center / 100% 100%;
+ border-radius: 20px;
+ background-color: #fff;
+
+ padding: 13px 13px 1px 13px;
pointer-events: all;
.title {
@@ -87,7 +90,7 @@
line-height: 100%;
display: flex;
align-items: center;
- color: #9cd5ff;
+ color: black;
pointer-events: all;
cursor: pointer;
}
@@ -117,7 +120,7 @@
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
- color: #7babd7;
+ color: black;
line-height: 16px;
margin-bottom: 2px;
}
@@ -126,7 +129,7 @@
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
- color: #d8edff;
+ color: black;
line-height: 16px;
margin-bottom: 2px;
}
diff --git a/src/views/dataCenter/components/dataCenterMap.vue b/src/views/dataCenter/components/dataCenterMap.vue
index 0d80134..2936f99 100644
--- a/src/views/dataCenter/components/dataCenterMap.vue
+++ b/src/views/dataCenter/components/dataCenterMap.vue
@@ -31,20 +31,7 @@
const isMapInitialized = ref(false); //地图加载
const dataPointList = ref([]);
const activeEntity = ref(null); // 当前激活的点
-watch(
- () => props.dotData,
- newVal => {
- if (newVal) {
- // console.log(newVal, 999);
- // currentClickEntity = newVal;
- // activeEntity.value = newVal;
- // singleMachineEvent(newVal);
- // // createLabelDom(newVal);
- // console.log('cccc', activeEntity.value);
- }
- },
- { immediate: true }
-);
+
// 获取弹框box
const detailId = ref('');
const createLabelDom = data => {
@@ -55,7 +42,7 @@
tooltipContainer.style.position = 'absolute';
tooltipContainer.style.transform = 'translate(-50%,-125%)';
tooltipContainer.style.pointerEvents = 'none';
- document.querySelector('#dataCenterMap').append(tooltipContainer);
+ document.querySelector('#dataCenterMap')?.append(tooltipContainer);
render(vNode, tooltipContainer);
return tooltipContainer;
};
@@ -118,7 +105,6 @@
}
currentClickEntity = clickedEntities[0];
- console.log(currentClickEntity);
// 恢复所有点的默认图标
restoreAllIcons();
@@ -126,6 +112,7 @@
// 设置当前点击点为激活状态
if (currentClickEntity.billboard) {
currentClickEntity.billboard.image = activeIcon;
+ currentClickEntity.billboard.scale = 1 // 可选缩放效果
activeEntity.value = currentClickEntity;
}
@@ -164,7 +151,7 @@
// 添加新实体
mapList.forEach((item, index) => {
- const entity = viewer.entities.add({
+ const entity = viewer?.entities.add({
id: `dataCenter-point-${index}-${Date.now()}`,
position: Cesium.Cartesian3.fromDegrees(
Number(item.metadata.shootPosition.lng),
@@ -202,42 +189,6 @@
dataPointEntities.value.push(entity);
});
};
-
-const flyToEntity = position => {
- const longitude = Number(position.lng);
- const latitude = Number(position.lat);
-
- console.log(longitude, viewer, 1);
- viewer?.camera.flyTo({
- destination: Cesium.Cartesian3.fromDegrees(longitude, latitude, 1000),
- duration: 1,
- orientation: {
- heading: Cesium.Math.toRadians(0.0),
- pitch: Cesium.Math.toRadians(-90.0),
- roll: 0.0,
- },
- });
-};
-
-const isViewerReady = ref(false);
-
-/**
- * 初始化标注添加
- * @param data 数据
- */
-const initEntityOrPopup = data => { //地图点在范围内
- watch(
- () => isViewerReady.value,
- ready => {
- if (ready) {
- flyToEntity(data.metadata.shootPosition);
- labelBoxUpdate();
- }
- },
- { deep: true, immediate: true } // 初始化时立即执行
- );
-};
-
const initMap = () => {
if (viewer || isMapInitialized.value) return;
@@ -270,6 +221,19 @@
console.error('地图初始化失败:', error);
}
};
+const flyToEntity = position => {
+ const longitude = Number(position.lng);
+ const latitude = Number(position.lat);
+ viewer?.camera.flyTo({
+ destination: Cesium.Cartesian3.fromDegrees(longitude, latitude, 1000),
+ duration: 1,
+ orientation: {
+ heading: Cesium.Math.toRadians(0.0),
+ pitch: Cesium.Math.toRadians(-90.0),
+ roll: 0.0,
+ },
+ });
+};
// 地图接口
const loading = ref(false);
@@ -277,8 +241,6 @@
try {
const res = await getMapInfoAPI(ids);
dataPointList.value = res.data.data || [];
- console.log('dataPointList.value', dataPointList.value);
-
// 确保地图已初始化后再渲染
if (isMapInitialized.value && viewer) {
renderDataPoint(dataPointList.value);
@@ -287,7 +249,26 @@
console.error('获取地图数据失败:', error);
}
};
+const isViewerReady = ref(false);
+/**
+ * 初始化标注添加
+ * @param data 数据
+ */
+const initEntityOrPopup = data => {
+ //地图点在范围内
+ watch(
+ [() => isMapInitialized.value],
+ ready => {
+
+ if (ready) {
+ flyToEntity(data.metadata.shootPosition);
+ labelBoxUpdate();
+ }
+ },
+ { deep: true, immediate: true } // 初始化时立即执行
+ );
+};
watch(
() => props.jobId,
newVal => {
diff --git a/src/views/dataCenter/components/searchData.vue b/src/views/dataCenter/components/searchData.vue
index 4972c2e..ec23ee8 100644
--- a/src/views/dataCenter/components/searchData.vue
+++ b/src/views/dataCenter/components/searchData.vue
@@ -88,7 +88,7 @@
</div>
<div class="search-first">
<el-form-item label="文件名称:">
- <el-input v-model="searchForm.nickName" placeholder="请输入" clearable />
+ <el-input v-model="searchForm.name" placeholder="请输入" clearable />
</el-form-item>
<div class="search-btn">
<el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
@@ -163,7 +163,7 @@
const timeFormat = 'YYYY-MM-DD HH:mm:ss';
const searchForm = reactive({
jobName: '', //任务名称
- nickName: '', //文件名称
+ name: '', //文件名称
areaCode: userAreaCode.value, // 区域code
endTime: endTime.format(timeFormat), // 结束时间
startTime: startTime.format(timeFormat), // 开始时间
diff --git a/src/views/dataCenter/dataCenter.vue b/src/views/dataCenter/dataCenter.vue
index 9a25111..609ffe5 100644
--- a/src/views/dataCenter/dataCenter.vue
+++ b/src/views/dataCenter/dataCenter.vue
@@ -99,13 +99,7 @@
<template #header="{ titleId, titleClass }">
<div class="my-header">
<h4 :id="titleId" :class="titleClass">{{ dialogDetailList?.nickName }}</h4>
- <el-button
- type="success"
- plain
- icon="el-icon-download"
- @click="detailDownLoad(dialogDetailList)"
- >下载</el-button
- >
+
</div>
</template>
<div class="detailContainer">
@@ -122,7 +116,7 @@
<div class="title">
<div class="inputEdit">
文件名称:<span class="fileTitle" v-if="!dialogDetailList?.checkedinput">{{
- dialogDetailList.nickName
+ dialogDetailList?.nickName
}}</span>
<el-input
v-else
@@ -132,8 +126,8 @@
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">
@@ -155,6 +149,13 @@
<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>
@@ -211,7 +212,7 @@
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) {
@@ -239,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,
@@ -306,10 +322,9 @@
.then(() => {
deleteFileMultipleApi(val.id)
.then(res => {
- console.log('删除成功', res);
ElMessage.success('删除成功');
getaiImagesPage();
- })
+ })
.catch(error => {
ElMessage.error('删除失败');
});
@@ -332,12 +347,12 @@
if (list.length === 1) {
list.forEach((item, index) => {
setTimeout(() => {
- 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: '',
@@ -364,7 +379,7 @@
fileDownload();
};
const detailDownLoad = val => {
- aLinkDownload(val.link, val.nickName);
+ aLinkDownload(val.link, val?.nickName);
};
// 全部下载
const aLLDownloadFile = () => {
@@ -377,9 +392,9 @@
downloadApi(params).then(res => {
console.log('res.data.data', res.data.data);
aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
- // loading.close()
+
});
- console.log('全部下载');
+
};
// 查看弹框
const dialogVisible = ref(false);
@@ -389,7 +404,6 @@
getAttachInfoAPI(val.id).then(res => {
dialogDetailList.value = res.data.data;
dialogDetailList.value = { ...res.data.data, checkedinput: false };
- console.log('val111', dialogDetailList.value);
});
dialogVisible.value = true;
};
@@ -397,13 +411,14 @@
const fileNameedit = ref('');
// 编辑文件名
const editTitle = val => {
+
val.checkedinput = true;
- fileNameedit.value = val.nickName;
+ fileNameedit.value = val?.nickName;
};
+// 取消
const cancelEditSuffix = item => {
item.nickName = fileNameedit.value;
- dialogDetailList.value.checkedinput = false;
- console.log('item', item);
+ item.checkedinput = false;
};
const submitEditSuffix = item => {
saveTitle(item);
@@ -414,16 +429,13 @@
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),
@@ -434,7 +446,6 @@
item.checkedinput = false;
updataTitleApi(updateparams)
.then(res => {
- console.log('updateparams', updateparams);
if (res.status === 200) {
ElMessage.success('修改成功');
} else {
@@ -446,24 +457,8 @@
console.error('API error:', error);
});
};
-// 全景预览
-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 mapComponent = ref(null);// 创建子组件引用
const mapList = ref(null);
const dataCenterMapVisible = ref(false);
@@ -480,6 +475,7 @@
}
});
};
+
onMounted(() => {
getaiImagesPage();
});
@@ -579,6 +575,7 @@
}
.my-header :deep(.el-dialog__title) {
margin: 0 !important;
+ height: 19px;
}
.my-header {
display: flex;
--
Gitblit v1.9.3