地图添加企业标点

This commit is contained in:
wgx 2026-08-13 18:02:30 +08:00
parent ecdc6110f8
commit 5c28f8d61b
2 changed files with 36 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -203,6 +203,10 @@
<!-- <img src="@/assets/image/soil.png" class="xcdimg" alt="">--> <!-- <img src="@/assets/image/soil.png" class="xcdimg" alt="">-->
<!-- <span class="scdlist_tit">长期定位监测站</span>--> <!-- <span class="scdlist_tit">长期定位监测站</span>-->
<!-- </div>--> <!-- </div>-->
<div class="scdlist" @click="switchIcon('ent')">
<img src="@/assets/image/enticon.png" class="xcdimg" alt="">
<span class="scdlist_tit">企业信息</span>
</div>
</div> </div>
<transition enter-active-class="animate__animated animate__backInUp" <transition enter-active-class="animate__animated animate__backInUp"
leave-active-class="animate__animated animate__backOutDown"> leave-active-class="animate__animated animate__backOutDown">
@ -556,7 +560,8 @@ export default {
dialogVisible: false, dialogVisible: false,
inforname: '', inforname: '',
loading: true, loading: true,
zoomData: 10, iniZoomData: 11,
normalZoomData: 12,
focusZoomData: 14, focusZoomData: 14,
isShowLightNumber: '1', isShowLightNumber: '1',
switchValue: true, switchValue: true,
@ -633,7 +638,7 @@ export default {
setTimeout(() => { setTimeout(() => {
getCompanyList().then(res => { getCompanyList().then(res => {
that.entList = res.result.map(item => { that.entList = res.result.map(item => {
item.type = 'cusLocaltion'; item.type = 'ent';
item.longitude = item.entLong; item.longitude = item.entLong;
item.latitude = item.entLat; item.latitude = item.entLat;
item.name = item.entName; item.name = item.entName;
@ -656,7 +661,7 @@ export default {
// //
console.log(that.entList,'111222') console.log(that.entList,'111222')
that.$nextTick(() => { that.$nextTick(() => {
that.initMap(that.zoomData, that.isShowLightNumber); that.initMap(that.iniZoomData, that.isShowLightNumber);
}) })
}); });
}, 2000) }, 2000)
@ -687,13 +692,13 @@ export default {
mapTypeSwitch() { mapTypeSwitch() {
this.mapTypeFlag = !this.mapTypeFlag this.mapTypeFlag = !this.mapTypeFlag
if (this.mapTypeFlag == true) {// if (this.mapTypeFlag == true) {//
// this.zoomData = 14 // this.iniZoomData = 14
if (this.isShowLight == undefined) { if (this.isShowLight == undefined) {
let isShowLight = '1' let isShowLight = '1'
this.initMap(this.zoomData, isShowLight); this.initMap(this.iniZoomData, isShowLight);
} else { } else {
let isShowLight = this.isShowLight let isShowLight = this.isShowLight
this.initMap(this.zoomData, isShowLight); this.initMap(this.iniZoomData, isShowLight);
} }
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
@ -701,11 +706,11 @@ export default {
}) })
}, 1000) }, 1000)
} else {// } else {//
// this.zoomData = 15 // this.iniZoomData = 15
if (this.isShowLight == undefined) { if (this.isShowLight == undefined) {
this.initMap(this.zoomData, '1'); this.initMap(this.iniZoomData, '1');
} else { } else {
this.initMap(this.zoomData, this.isShowLight); this.initMap(this.iniZoomData, this.isShowLight);
} }
} }
}, },
@ -758,11 +763,11 @@ export default {
if (value == true) { if (value == true) {
let isShowLight = '1' let isShowLight = '1'
this.isShowLight = isShowLight this.isShowLight = isShowLight
this.initMap(this.zoomData, isShowLight) this.initMap(this.iniZoomData, isShowLight)
} else { } else {
let isShowLight = '' let isShowLight = ''
this.isShowLight = isShowLight this.isShowLight = isShowLight
this.initMap(this.zoomData, isShowLight) this.initMap(this.iniZoomData, isShowLight)
} }
}, },
scaleChange(e) { scaleChange(e) {
@ -840,7 +845,7 @@ export default {
offset: new AMap.Pixel(item.width, item.height),// offset: new AMap.Pixel(item.width, item.height),//
title: item.name, title: item.name,
label: { label: {
content: item.type == "cusLocaltion"? item.name : '', content: item.type == "ent"? item.name : '',
direction: 'top' direction: 'top'
}, },
extData: { extData: {
@ -866,7 +871,7 @@ export default {
// console.log('soil click', ) // console.log('soil click', )
}) })
this.markersSoil.push(marker); this.markersSoil.push(marker);
} else if(item.type == "cusLocaltion"){// } else if(item.type == "ent"){//
marker.on("click", e => { marker.on("click", e => {
this.qyinformation= e.target.getExtData().item this.qyinformation= e.target.getExtData().item
if(this.qyinformation.entPics){ if(this.qyinformation.entPics){
@ -877,6 +882,7 @@ export default {
console.log("this.qyinformation",this.qyinformation) console.log("this.qyinformation",this.qyinformation)
this.qyinfordtdialogTableVisible = true this.qyinfordtdialogTableVisible = true
}) })
this.markersOrient.push(marker);
} else { } else {
this.markersOther.push(marker) this.markersOther.push(marker)
} }
@ -886,7 +892,8 @@ export default {
// that.aMap.setFitView(null, false, [100,400,200,200], 16); // that.aMap.setFitView(null, false, [100,400,200,200], 16);
// that.aMap.setFitView(); // that.aMap.setFitView();
setTimeout(() => { setTimeout(() => {
that.aMap.setFitView(null, false, [130, 380, 480, 480], 12); that.switchIcon('1');
// that.aMap.setFitView(null, false, [130, 380, 480, 480], 12);
// let temp = that.aMap.getCenter();// // let temp = that.aMap.getCenter();//
// that.aMap.setZoomAndCenter(that.aMap.getZoom()-1, [temp.lng, temp.lat - 0.15]); // that.aMap.setZoomAndCenter(that.aMap.getZoom()-1, [temp.lng, temp.lat - 0.15]);
}, 2000) }, 2000)
@ -1172,15 +1179,22 @@ export default {
this.lastClickIcon = '' this.lastClickIcon = ''
} else { } else {
this.lastClickIcon = flag; this.lastClickIcon = flag;
if (flag == 'livestock') { if (flag == 'soil') {
arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("livestock") != -1);
} else if (flag == 'orient') {
arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("orient") != -1);
} else if (flag == 'watershed') {
arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("watershed") != -1);
} else if (flag == 'soil') {
arr = this.markersSoil; arr = this.markersSoil;
} else {
arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf(flag) != -1);
} }
// if (flag == 'livestock') {
// arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("livestock") != -1);
// } else if (flag == 'orient') {
// arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("orient") != -1);
// } else if (flag == 'watershed') {
// arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("watershed") != -1);
// } else if (flag == 'soil') {
// arr = this.markersSoil;
// } else if (flag == 'ent') {
// arr = this.markersSoil;
// }
} }
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
arr.map(item => { arr.map(item => {
@ -1192,7 +1206,7 @@ export default {
// that.aMap.setZoomAndCenter(that.aMap.getZoom()-2, [temp.lng, temp.lat - 0.15]); // that.aMap.setZoomAndCenter(that.aMap.getZoom()-2, [temp.lng, temp.lat - 0.15]);
// },2000) // },2000)
} else { } else {
that.aMap.setFitView(null, false, [100, 400, 360, 360], that.zoomData); that.aMap.setFitView(null, false, [100, 400, 360, 360], that.normalZoomData);
} }
} }
}, },