update 银川地图中心点做特殊处理

This commit is contained in:
zk
2024-05-21 16:07:12 +08:00
parent f3f100cd18
commit 16e85fe15d
5 changed files with 77 additions and 18 deletions
+31 -6
View File
@@ -48,7 +48,7 @@
</div>
<!-- <div class="level">地图层级{{ level }}</div>-->
</div>
<div class="center-footer">
<div class="center-footer" v-if="showFooter">
<div class="count-item">
<div class="num">{{ useDetail?.alerdyreceive || '0' }}</div>
<div class="text">累计受理</div>
@@ -67,6 +67,26 @@
import { aircraft, getKmStr, getTimeStr, legendList, mapApiSwitch, tabList, TabType } from '/@/components/chinaMap/chinaHooks';
import { useDetailStore } from '/@/store/modules/detailData.ts';
const props = defineProps({
showFooter: {
type: Boolean,
default: () => {
return true;
},
},
computedCenter: {
type: Boolean,
default: () => {
return true;
},
},
mapOptions: {
type: Object,
default: () => {
return {};
},
},
});
const useDetail = useDetailStore();
const formState = ref({
start: '',
@@ -116,17 +136,22 @@
const { code, result } = await mapApiSwitch(type, params);
if (code == 200) {
if (Array.isArray(result) && result.length > 0) {
Map.createOverlay(result, {
content: (val) => {
return `<div style="
Map.createOverlay(
result,
{
content: (val) => {
return `<div style="
width: 21px;
height: 44px;
position: absolute;
left: -20px;
top: -20px;" title="${val?.name}">
</div>`;
},
},
});
() => {},
props.computedCenter
);
} else {
Map.removeOverlayGroup();
}
@@ -137,7 +162,7 @@
}
onMounted(() => {
Map.initMap({ el: 'mapContainer' }).then(() => {
Map.initMap({ el: 'mapContainer', option: props.mapOptions }).then(() => {
getMapData(tabList[0].type);
Map.map && Map.map.on('zoomend', setLevel);
Map.map && Map.map.on('zoomend', setLevel);