地图弹窗添加

This commit is contained in:
13713575202 2025-04-24 17:16:44 +08:00
parent d225f1be79
commit 050ec197ea
6 changed files with 44 additions and 12 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 717 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -2,8 +2,11 @@
<div class="map-center-warp"> <div class="map-center-warp">
<!-- <img :src="getAssetsFile('images/vsualized/gmmap.png')" class="map-img" /> --> <!-- <img :src="getAssetsFile('images/vsualized/gmmap.png')" class="map-img" /> -->
<div class="map-pos"> <div class="map-pos">
<custom-echart-maps height="100%" width="100%" :option="chartsData.option" :geo="geoData" :name="mapName" /> <custom-echart-maps height="100%" width="100%" :option="chartsData.option" :geo="geoData" :name="mapName" @click="mapClick" />
</div> </div>
<el-dialog v-model="isShow" :title="currentMap.name + dialogTitle" width="360" :before-close="handleClose" custom-class="map-info-dialog">
</el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -12,7 +15,12 @@ import { ref, reactive, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import geoJsonData from '../components/530926geo.json'; // import geoJsonData from '../components/530926geo.json'; //
const route = useRoute(); const route = useRoute();
const props = defineProps({
dialogTitle: {
type: String,
default: '首页',
},
});
var aspectScale = 0.8807505292367753; var aspectScale = 0.8807505292367753;
// var iconUrl = 'http://localhost:9529/sub-government-screen-service/src/assets/images/vsualized/home/partbg.png'; // var iconUrl = 'http://localhost:9529/sub-government-screen-service/src/assets/images/vsualized/home/partbg.png';
// var iconUrl = getAssetsFile('images/vsualized/gmmap.png').href; // var iconUrl = getAssetsFile('images/vsualized/gmmap.png').href;
@ -150,10 +158,16 @@ const chartsData = reactive({
}, },
}); });
let currentMap = reactive({});
const mapClick = (data) => { const mapClick = (data) => {
isShow.value = true; isShow.value = true;
currentMap = data;
console.info('mapClick', data); console.info('mapClick', data);
}; };
const handleClose = () => {
isShow.value = false;
};
onMounted(() => { onMounted(() => {
console.info('iconUrl', iconUrl); console.info('iconUrl', iconUrl);
}); });
@ -162,6 +176,28 @@ onMounted(() => {
div { div {
box-sizing: border-box; box-sizing: border-box;
} }
::v-deep() {
.el-dialog {
background: url('@/assets/images/vsualized/mapopup.png') no-repeat left top;
min-height: 200px;
max-height: 500px;
overflow-y: auto;
background-size: 100% 100%;
padding: 16px;
}
.el-dialog__header {
margin-top: 10px;
text-align: left;
padding-left: 48px;
.el-dialog__title,
i {
color: #fff !important;
}
.el-dialog__headerbtn {
top: 8px !important;
}
}
}
.map-center-warp { .map-center-warp {
width: 100%; width: 100%;
text-align: center; text-align: center;

View File

@ -70,8 +70,8 @@ export default {
onMapClick(({ name, data }) => { onMapClick(({ name, data }) => {
console.info('onMapClick点击区域:', name); console.info('onMapClick点击区域:', name);
// console.info('onMapClick:', data); console.info('onMapClick关联数据:', data);
// emit('click', { name, data }); emit('click', { name, data });
}); });
startAutoPlay({ startAutoPlay({
interval: 2000, interval: 2000,

View File

@ -110,12 +110,13 @@ export const useEcharts = (elRef, theme = 'default') => {
} }
function handleMapClick(params) { function handleMapClick(params) {
console.info('handleMapClick', params);
// 过滤非地图区域的点击事件 // 过滤非地图区域的点击事件
if (params.componentType === 'geo3D' || params.componentType === 'geo') { if (params.seriesType === 'map3D' || params.seriesType === 'map') {
// 获取点击区域信息 // 获取点击区域信息
const mapName = params.name; const mapName = params.name;
const regionData = params.data || {}; const regionData = params.data || {};
console.info('seriesType', params.seriesType);
// 执行注册的回调函数 // 执行注册的回调函数
if (typeof mapClickHandler === 'function') { if (typeof mapClickHandler === 'function') {
mapClickHandler({ mapClickHandler({

View File

@ -24,7 +24,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<centerMap></centerMap> <centerMap :dialog-title="'土地资源'"></centerMap>
</el-col> </el-col>
<el-col :span="6" class="right-charts"> <el-col :span="6" class="right-charts">
<div class="right-charts-item"> <div class="right-charts-item">