地图添加marker

This commit is contained in:
13713575202 2025-04-29 15:08:12 +08:00
parent 7874be1d2e
commit 364dbb45d3
8 changed files with 474 additions and 95 deletions

2
components.d.ts vendored
View File

@ -9,8 +9,10 @@ declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
BaseBg: typeof import('./src/components/baseBg.vue')['default'] BaseBg: typeof import('./src/components/baseBg.vue')['default']
CenterMap: typeof import('./src/components/centerMap.vue')['default'] CenterMap: typeof import('./src/components/centerMap.vue')['default']
'CenterMap copy': typeof import('./src/components/centerMap copy.vue')['default']
CodeDialog: typeof import('./src/components/code-dialog/index.vue')['default'] CodeDialog: typeof import('./src/components/code-dialog/index.vue')['default']
Components: typeof import('./src/components/index.js')['default'] Components: typeof import('./src/components/index.js')['default']
copy: typeof import('./src/components/centerMap copy.vue')['default']
CurrentTime: typeof import('./src/components/currentTime.vue')['default'] CurrentTime: typeof import('./src/components/currentTime.vue')['default']
CustomBack: typeof import('./src/components/customBack.vue')['default'] CustomBack: typeof import('./src/components/customBack.vue')['default']
CustomCarouselPicture: typeof import('./src/components/custom-carousel-picture/index.vue')['default'] CustomCarouselPicture: typeof import('./src/components/custom-carousel-picture/index.vue')['default']

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -18524,7 +18524,6 @@
23.547411 23.547411
] ]
] ]
] ]
] ]
} }

View File

@ -0,0 +1,250 @@
<template>
<div class="map-center-warp">
<!-- <img :src="getAssetsFile('images/vsualized/gmmap.png')" class="map-img" /> -->
<div class="map-pos">
<custom-echart-maps height="100%" width="100%" :option="chartsData.option" :geo="geoData" :name="mapName" @click="mapClick" />
</div>
<el-dialog
v-model="isShow"
:title="currentMap.name + dialogTitle"
width="360"
:show-close="false"
:before-close="handleClose"
custom-class="map-info-dialog"
>
<template #header="{ close, titleId, titleClass }">
<slot name="header"></slot>
</template>
<slot name="dialogContent"></slot>
</el-dialog>
</div>
</template>
<script setup>
import { isEmpty, getAssetsFile } from '@/utils';
import { ref, reactive, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import geoJsonData from '../components/530926geo.json'; //
const route = useRoute();
const props = defineProps({
dialogTitle: {
type: String,
default: '首页',
},
});
var aspectScale = 0.8807505292367753;
// 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/gmmap2.png').href;
const isShow = ref(false);
let geoData = geoJsonData;
let mapName = ref('ZJ' + route.name);
let mapConfig = reactive({
map: mapName.value,
zoom: 1,
viewControl: {
distance: 115,
alpha: 60,
beta: 0,
minBeta: -360,
maxBeta: 720,
// 使
// rotateSensitivity: 0,
// zoomSensitivity: 0,
// panSensitivity: 0,
},
itemStyle: {
//
color: 'rgba(75,255,180,0.2)', //
opacity: 1, // [ default: 1 ]
borderWidth: 1.5, // (线) [ default: 0 ]
borderColor: '#4bffb4', // [ default: #333 ]
},
label: {
show: true,
distance: 0,
color: '#000',
padding: [6, 4, 2, 4],
borderRadius: 4,
backgroundColor: 'rgba(255,255,255,0.2)',
textStyle: {
fontSize: 12,
color: '#000', //
borderWidth: 0,
borderColor: '#000',
},
},
emphasis: {
//
label: {
show: true,
color: '#fff',
},
itemStyle: {
color: 'rgba(75,255,180,0.3)', //
},
},
});
const coordTransform = (lng, lat) => {
//
//
return [lng + 0.003, lat + 0.002];
};
const chartsData = reactive({
option: {
title: {
text: '',
left: 'center',
},
tooltip: {
trigger: 'item',
formatter: function (params) {
if (params.seriesType === 'effectScatter') {
return `${params.name}: (${params.value[0]}, ${params.value[1]})`;
}
return params.name;
},
},
toolbox: {
show: false,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
// dataView: { readOnly: false },
// restore: {},
// saveAsImage: {},
},
},
geo3D: {
roam: true,
left: '30px',
show: true,
zlevel: -1, //
...mapConfig,
},
series: [
{
type: 'map',
left: '30px',
...mapConfig,
},
// {
// name: '',
// type: 'effectScatter', // 使 effectScatter
// coordinateSystem: 'geo',
// data: [
// //
// {
// name: '111',
// value: [99.081993, 23.554045, 100], // , ,
// itemStyle: {
// color: '#4bffb4', //
// },
// },
// {
// name: '',
// value: [99.402267, 23.538889, 80], // , ,
// itemStyle: {
// color: '#4bffb4', //
// },
// },
// ],
// symbolSize: function (val) {
// return val[2] ? val[2] / 10 : 10; //
// },
// label: {
// formatter: '{b}',
// position: 'right',
// show: false,
// },
// rippleEffect: {
// period: 4, //
// scale: 3, //
// brushType: 'stroke', // 'stroke' 'fill'
// },
// hoverAnimation: false,
// },
],
},
});
let currentMap = reactive({});
const mapClick = (data) => {
isShow.value = true;
currentMap = data;
emit('mapclick', currentMap);
};
const handleClose = () => {
isShow.value = false;
};
onMounted(() => {
console.info('iconUrl', iconUrl);
});
const emit = defineEmits(['mapclick']);
</script>
<style lang="scss" scoped>
div {
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;
margin-top: 15%;
}
.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-dialog-my-header {
margin-top: 4px;
display: inline-flex;
justify-content: space-between;
h4 {
font-weight: normal !important;
}
}
}
.map-center-warp {
width: 100%;
text-align: center;
position: relative;
height: 90%;
.map-img {
width: 80%;
height: 80%;
position: absolute;
bottom: 0;
left: 50%;
object-fit: contain;
transform: translateX(-50%);
max-width: 1000px;
max-height: 1000px;
}
.map-pos {
width: 100%;
height: 100%;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
}
</style>

View File

@ -25,6 +25,7 @@ import { isEmpty, getAssetsFile } from '@/utils';
import { ref, reactive, onMounted } from 'vue'; 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'; //
import { Select } from '@element-plus/icons-vue';
const route = useRoute(); const route = useRoute();
const props = defineProps({ const props = defineProps({
dialogTitle: { dialogTitle: {
@ -40,6 +41,84 @@ var iconUrl = getAssetsFile('images/vsualized/gmmap2.png').href;
const isShow = ref(false); const isShow = ref(false);
let geoData = geoJsonData; let geoData = geoJsonData;
let mapName = ref('ZJ' + route.name); let mapName = ref('ZJ' + route.name);
let mapConfig = reactive({
map: mapName.value,
zoom: 1,
viewControl: {
distance: 115,
alpha: 60,
beta: 0,
minBeta: -360,
maxBeta: 720,
// 使
// rotateSensitivity: 0,
// zoomSensitivity: 0,
// panSensitivity: 0,
},
// itemStyle: {
// //
// color: 'rgba(75,255,180,0.2)', //
// opacity: 1, // [ default: 1 ]
// borderWidth: 1.5, // (线) [ default: 0 ]
// borderColor: '#4bffb4', // [ default: #333 ]
// },
itemStyle: {
normal: {
borderColor: '#4bffb4', //
borderWidth: 1, //
areaColor: 'rgba(75,255,180,0.2)', //
},
emphasis: {
borderColor: '#4bffb4',
borderWidth: 2,
areaColor: 'rgba(75,255,180,0.5)', //
label: {
color: '#fff',
},
},
},
select: {
// :ml-citation{ref="2,7" data="citationList"}
itemStyle: {
areaColor: 'rgba(75,255,180,0.6)',
borderColor: '#4bffb4',
borderWidth: 2,
},
label: {
color: '#fff',
},
},
label: {
show: true,
distance: 0,
color: '#fff',
padding: [6, 4, 2, 4],
borderRadius: 4,
textStyle: {
fontSize: 12,
color: '#fff', //
borderWidth: 0,
borderColor: '#000',
},
},
// emphasis: {
// //
// label: {
// show: true,
// color: '#fff',
// },
// itemStyle: {
// color: 'rgba(75,255,180,0.3)', //
// },
// },
});
const coordTransform = (lng, lat) => {
//
//
return [lng + 0.003, lat + 0.002];
};
const chartsData = reactive({ const chartsData = reactive({
option: { option: {
title: { title: {
@ -66,104 +145,57 @@ const chartsData = reactive({
// saveAsImage: {}, // saveAsImage: {},
}, },
}, },
geo3D: { geo: {
map: mapName.value,
roam: true, roam: true,
zoom: 1,
left: '30px', left: '30px',
show: true, show: false,
zlevel: -1, // zlevel: -1, //
viewControl: { ...mapConfig,
distance: 115,
alpha: 60,
beta: 0,
minBeta: -360,
maxBeta: 720,
// 使
// rotateSensitivity: 0,
// zoomSensitivity: 0,
// panSensitivity: 0,
},
itemStyle: {
//
color: 'rgba(75,255,180,0.2)', //
opacity: 1, // [ default: 1 ]
borderWidth: 1.5, // (线) [ default: 0 ]
borderColor: '#4bffb4', // [ default: #333 ]
},
label: {
show: true,
distance: 0,
color: '#000',
padding: [6, 4, 2, 4],
borderRadius: 4,
backgroundColor: 'rgba(255,255,255,0.2)',
textStyle: {
fontSize: 12,
color: '#E87813', //
borderWidth: 0,
borderColor: '#000',
},
},
emphasis: {
//
label: {
show: true,
color: '#fff',
},
itemStyle: {
color: 'rgba(75,255,180,0.3)', //
},
},
}, },
series: [ series: [
{ {
type: 'map3D', roam: true,
map: mapName.value, type: 'map',
zoom: 1,
left: '30px', left: '30px',
viewControl: { ...mapConfig,
distance: 115,
alpha: 60,
beta: 0,
minBeta: -360,
maxBeta: 720,
// 使
// rotateSensitivity: 0,
// zoomSensitivity: 0,
// panSensitivity: 0,
}, },
{
name: '闪烁散点',
type: 'effectScatter', // 使 effectScatter
coordinateSystem: 'geo',
data: [
//
{
name: '永星食品加工厂',
value: [99.081993, 23.554045, 150], // , ,
symbol: 'image://' + getAssetsFile('images/vsualized/marker.png'),
itemStyle: { itemStyle: {
// color: '#4bffb4', //
color: 'rgba(75,255,180,0.2)', // },
opacity: 1, // [ default: 1 ] },
borderWidth: 1.5, // (线) [ default: 0 ] {
borderColor: '#4bffb4', // [ default: #333 ] name: '耿马镇',
value: [99.402267, 23.538889, 150], // , ,
symbol: 'image://' + getAssetsFile('images/vsualized/marker.png'),
itemStyle: {
color: '#4bffb4', //
},
},
],
symbolSize: function (val) {
return val[2] ? val[2] / 10 : 10; //
}, },
label: { label: {
show: true, formatter: '{b}',
distance: 0, position: 'right',
color: '#000', show: false,
padding: [6, 4, 2, 4],
borderRadius: 4,
backgroundColor: 'rgba(255,255,255,0.2)',
textStyle: {
fontSize: 12,
color: '#E87813', //
borderWidth: 0,
borderColor: '#000',
},
},
emphasis: {
//
label: {
show: true,
color: '#fff',
},
itemStyle: {
color: 'rgba(75,255,180,0.3)', //
}, },
rippleEffect: {
period: 4, //
scale: 3, //
brushType: 'stroke', // 'stroke' 'fill'
}, },
hoverAnimation: false,
}, },
], ],
}, },
@ -189,6 +221,7 @@ const emit = defineEmits(['mapclick']);
div { div {
box-sizing: border-box; box-sizing: border-box;
} }
::v-deep() { ::v-deep() {
.el-dialog { .el-dialog {
background: url('@/assets/images/vsualized/mapopup.png') no-repeat left top; background: url('@/assets/images/vsualized/mapopup.png') no-repeat left top;

View File

@ -110,7 +110,9 @@ const handleCommand = (data) => {
.down-menu { .down-menu {
background: transparent; background: transparent;
} }
.el-dropdown {
display: inline-block;
}
.el-dropdown-link { .el-dropdown-link {
color: $color-custom-main !important; color: $color-custom-main !important;
i { i {
@ -173,11 +175,6 @@ const handleCommand = (data) => {
border-radius: 4px; border-radius: 4px;
padding: 6px; padding: 6px;
text-align: center; text-align: center;
::v-deep() {
.el-dropdown {
display: inline-block;
}
}
} }
} }
</style> </style>

View File

@ -0,0 +1,97 @@
<template>
<centerMap :dialog-title="'投入品'" @mapclick="doMapclick">
<template #header>
<div class="land-map-pop-header">
<div class="title">{{ currentRegion && currentRegion.name ? currentRegion.name : '投入品' }}</div>
</div>
</template>
<template #dialogContent>
<div class="land-map-pop-content">
<div v-for="(n, index) in list" :key="index" class="list-item">
<div class="title">
<span class="title-val"> {{ n.title }}</span>
</div>
<div class="value">{{ n.value }}{{ n.unit }}</div>
</div>
</div>
</template>
</centerMap>
</template>
<script setup>
import { ref, reactive } from 'vue';
const unit = ref('家');
const list = reactive([
{ title: '年总产值', value: 3.49, color: '#01FEFD', unit: '亿元' },
{ title: '年人均收入', value: 6.98, color: '#FEF906', unit: '万元' },
]);
let currentRegion = ref(null);
const doMapclick = (data) => {
currentRegion.value = data;
};
</script>
<style lang="scss" scoped>
.land-map-pop-header {
display: inline-flex;
justify-content: space-between;
width: 100%;
margin-top: 3px;
.title,
.value {
display: inline-block;
vertical-align: middle;
color: $color-white;
}
.title {
font-size: 18px;
}
.value {
font-size: 14px;
}
}
.land-map-pop-content {
width: 100%;
gap: 10px;
display: inline-flex;
justify-content: flex-start;
flex-wrap: wrap;
.list-item {
width: calc((100% - 10px) / 1);
display: inline-flex;
justify-content: space-between;
padding: 6px 0;
.title {
display: inline-flex;
justify-content: flex-start;
.before {
display: inline-flex;
flex-direction: column;
justify-content: center;
}
.b-content {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
}
.before,
.title-val {
display: inline-block;
vertical-align: middle;
padding: 0 5px 0 2px;
color: $color-custom-main;
}
}
.value {
display: inline-block;
text-align: right;
color: $color-white;
font-size: 12px;
}
}
}
</style>

View File

@ -24,7 +24,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<centerMap></centerMap> <entitiesMap></entitiesMap>
</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">
@ -59,6 +59,7 @@ import hotCharts from './components/hotCharts.vue';
import benefitCharts from './components/benefitCharts.vue'; import benefitCharts from './components/benefitCharts.vue';
import entitiesStatistics from './components/entitiesStatistics.vue'; import entitiesStatistics from './components/entitiesStatistics.vue';
import entitiesCategoryCharts from './components/entitiesCategoryCharts.vue'; import entitiesCategoryCharts from './components/entitiesCategoryCharts.vue';
import entitiesMap from './components/entitiesMap.vue';
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.data-home-index { .data-home-index {