|
@@ -28,6 +28,7 @@ import {
|
|
farmInfo
|
|
farmInfo
|
|
} from '@/service/index.js';
|
|
} from '@/service/index.js';
|
|
import { mapMutations, mapState, mapGetters } from 'vuex';
|
|
import { mapMutations, mapState, mapGetters } from 'vuex';
|
|
|
|
+import { Message } from 'element-ui';
|
|
export default {
|
|
export default {
|
|
name: 'amap',
|
|
name: 'amap',
|
|
data() {
|
|
data() {
|
|
@@ -62,7 +63,8 @@ export default {
|
|
cityMarkerArr: [],
|
|
cityMarkerArr: [],
|
|
putPolygonData: [],
|
|
putPolygonData: [],
|
|
townPolygons: [],
|
|
townPolygons: [],
|
|
- treeCompMarkers: []
|
|
|
|
|
|
+ treeCompMarkers: [],
|
|
|
|
+ forestFarmData: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
|
|
@@ -92,6 +94,7 @@ export default {
|
|
handler(val) {
|
|
handler(val) {
|
|
this.leftPage = val;
|
|
this.leftPage = val;
|
|
if (this.parentId) {
|
|
if (this.parentId) {
|
|
|
|
+ // this.getrjx()
|
|
this.switch2AreaNode(
|
|
this.switch2AreaNode(
|
|
this.parentId,
|
|
this.parentId,
|
|
this.$store.state.addr.mapLevel,
|
|
this.$store.state.addr.mapLevel,
|
|
@@ -228,6 +231,7 @@ export default {
|
|
pathArray.push.apply(pathArray, holes);
|
|
pathArray.push.apply(pathArray, holes);
|
|
that.polygon = new AMap.Polygon({
|
|
that.polygon = new AMap.Polygon({
|
|
pathL: pathArray,
|
|
pathL: pathArray,
|
|
|
|
+ map: that.map,
|
|
strokeColor: '#00eeff',
|
|
strokeColor: '#00eeff',
|
|
strokeWeight: 1,
|
|
strokeWeight: 1,
|
|
fillColor: '#0c1b05', // 遮罩背景色
|
|
fillColor: '#0c1b05', // 遮罩背景色
|
|
@@ -235,7 +239,7 @@ export default {
|
|
height: 10000
|
|
height: 10000
|
|
});
|
|
});
|
|
that.polygon.setPath(pathArray);
|
|
that.polygon.setPath(pathArray);
|
|
- that.map.add(that.polygon);
|
|
|
|
|
|
+ // that.map.add(that.polygon);
|
|
var cityArr = result.districtList[0].districtList;
|
|
var cityArr = result.districtList[0].districtList;
|
|
for (let i = 0; i < cityArr.length; i++) {
|
|
for (let i = 0; i < cityArr.length; i++) {
|
|
that.cityMarker = new AMap.Text({
|
|
that.cityMarker = new AMap.Text({
|
|
@@ -299,37 +303,41 @@ export default {
|
|
//feature被点击
|
|
//feature被点击
|
|
this.districtExplorer.on('featureClick', (e, feature) => {
|
|
this.districtExplorer.on('featureClick', (e, feature) => {
|
|
const props = feature.properties;
|
|
const props = feature.properties;
|
|
- mapLevel = props.level;
|
|
|
|
- adName = props.name;
|
|
|
|
- this.$store.dispatch('searchArea', {
|
|
|
|
- parentId: props.adcode,
|
|
|
|
- name: props.name,
|
|
|
|
- mapLevel: props.level
|
|
|
|
- });
|
|
|
|
- let valCode = props.adcode + '000000';
|
|
|
|
- let areaId = '';
|
|
|
|
- this.vuexCityList.forEach((item) => {
|
|
|
|
- if (valCode == item.areaCode) {
|
|
|
|
- areaId = item.areaId;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- this.vuexDistrictList.forEach((item) => {
|
|
|
|
- if (valCode == item.areaCode) {
|
|
|
|
- areaId = item.areaId;
|
|
|
|
|
|
+ for (let item of this.forestFarmData) {
|
|
|
|
+ if (props.name == item.cityName || props.name == item.countyName) {
|
|
|
|
+ mapLevel = props.level;
|
|
|
|
+ adName = props.name;
|
|
|
|
+ this.$store.dispatch('searchArea', {
|
|
|
|
+ parentId: props.adcode,
|
|
|
|
+ name: props.name,
|
|
|
|
+ mapLevel: props.level
|
|
|
|
+ });
|
|
|
|
+ let valCode = props.adcode + '000000';
|
|
|
|
+ let areaId = '';
|
|
|
|
+ this.vuexCityList.forEach((item) => {
|
|
|
|
+ if (valCode == item.areaCode) {
|
|
|
|
+ areaId = item.areaId;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.vuexDistrictList.forEach((item) => {
|
|
|
|
+ if (valCode == item.areaCode) {
|
|
|
|
+ areaId = item.areaId;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (props.level == 'city') {
|
|
|
|
+ this.changeSelectCity({
|
|
|
|
+ value: valCode,
|
|
|
|
+ label: props.name,
|
|
|
|
+ areaId: areaId
|
|
|
|
+ });
|
|
|
|
+ } else if (props.level == 'district') {
|
|
|
|
+ this.changeSelectDistrict({
|
|
|
|
+ value: valCode,
|
|
|
|
+ label: props.name,
|
|
|
|
+ areaId: areaId
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- });
|
|
|
|
- if (props.level == 'city') {
|
|
|
|
- this.changeSelectCity({
|
|
|
|
- value: valCode,
|
|
|
|
- label: props.name,
|
|
|
|
- areaId: areaId
|
|
|
|
- });
|
|
|
|
- } else if (props.level == 'district') {
|
|
|
|
- this.changeSelectDistrict({
|
|
|
|
- value: valCode,
|
|
|
|
- label: props.name,
|
|
|
|
- areaId: areaId
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
that.getDistrict(adName, mapLevel);
|
|
that.getDistrict(adName, mapLevel);
|
|
@@ -418,7 +426,6 @@ export default {
|
|
}
|
|
}
|
|
if (mapLevel === 'district') {
|
|
if (mapLevel === 'district') {
|
|
this.getrjx(adcode);
|
|
this.getrjx(adcode);
|
|
-
|
|
|
|
}
|
|
}
|
|
//设置当前使用的定位用节点
|
|
//设置当前使用的定位用节点
|
|
this.districtExplorer.setAreaNodesForLocating([this.currentAreaNode]);
|
|
this.districtExplorer.setAreaNodesForLocating([this.currentAreaNode]);
|
|
@@ -550,6 +557,7 @@ export default {
|
|
let lngLat = [item.longitude, item.latitude];
|
|
let lngLat = [item.longitude, item.latitude];
|
|
if (item.longitude && item.latitude) {
|
|
if (item.longitude && item.latitude) {
|
|
this.forestMarker = new AMap.Marker({
|
|
this.forestMarker = new AMap.Marker({
|
|
|
|
+ map: _this.map,
|
|
position: lngLat,
|
|
position: lngLat,
|
|
icon: sampleIcon,
|
|
icon: sampleIcon,
|
|
anchor: 'bottom-center',
|
|
anchor: 'bottom-center',
|
|
@@ -608,7 +616,7 @@ export default {
|
|
content: `<div class="label-treecomp">${item.treeComp}<span class="smallH">${item.smallNumber}</span></div>` //设置文本标注内容
|
|
content: `<div class="label-treecomp">${item.treeComp}<span class="smallH">${item.smallNumber}</span></div>` //设置文本标注内容
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- this.map.add(this.forestMarker);
|
|
|
|
|
|
+ // this.map.add(this.forestMarker);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -625,7 +633,7 @@ export default {
|
|
zIndex: 999,
|
|
zIndex: 999,
|
|
cursor: 'pointer'
|
|
cursor: 'pointer'
|
|
});
|
|
});
|
|
- this.map.add(polygon);
|
|
|
|
|
|
+ // this.map.add(polygon);
|
|
var lanLatArr = [];
|
|
var lanLatArr = [];
|
|
polygon.on('mouseover', (e) => {
|
|
polygon.on('mouseover', (e) => {
|
|
polygon.setOptions({
|
|
polygon.setOptions({
|
|
@@ -820,7 +828,7 @@ export default {
|
|
fillColor: '#ccebc5'
|
|
fillColor: '#ccebc5'
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- this.map.add(polygon);
|
|
|
|
|
|
+ // this.map.add(polygon);
|
|
});
|
|
});
|
|
|
|
|
|
financeBasePlant({
|
|
financeBasePlant({
|
|
@@ -870,6 +878,7 @@ export default {
|
|
imageSize: new AMap.Size(iconMeta[0], iconMeta[1]) // 根据所设置的大小拉伸或压缩图片
|
|
imageSize: new AMap.Size(iconMeta[0], iconMeta[1]) // 根据所设置的大小拉伸或压缩图片
|
|
});
|
|
});
|
|
let baseMarker = new AMap.Marker({
|
|
let baseMarker = new AMap.Marker({
|
|
|
|
+ map: this.map,
|
|
position: lanLatArr,
|
|
position: lanLatArr,
|
|
icon: sampleIcon,
|
|
icon: sampleIcon,
|
|
anchor: 'bottom-center',
|
|
anchor: 'bottom-center',
|
|
@@ -926,11 +935,10 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
setMarker() {
|
|
setMarker() {
|
|
- let forestFarm = [];
|
|
|
|
farmInfo().then((res) => {
|
|
farmInfo().then((res) => {
|
|
- forestFarm = res.rows;
|
|
|
|
|
|
+ this.forestFarmData = res.rows;
|
|
let parentMarker = require('@/assets/img/pre-marker.png');
|
|
let parentMarker = require('@/assets/img/pre-marker.png');
|
|
- forestFarm.forEach((item) => {
|
|
|
|
|
|
+ this.forestFarmData.forEach((item) => {
|
|
if (this.$store.state.addr.selectCity.label) {
|
|
if (this.$store.state.addr.selectCity.label) {
|
|
if (this.$store.state.addr.selectCity.label == item.cityName) {
|
|
if (this.$store.state.addr.selectCity.label == item.cityName) {
|
|
let lngLat = [item.longitude, item.latitude];
|
|
let lngLat = [item.longitude, item.latitude];
|
|
@@ -966,14 +974,17 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
getrjx(adcode) {
|
|
getrjx(adcode) {
|
|
- this.putPolygonData = [];
|
|
|
|
if (adcode == '522632') {
|
|
if (adcode == '522632') {
|
|
axios.get('/static/rongjangintown.json').then((res) => {
|
|
axios.get('/static/rongjangintown.json').then((res) => {
|
|
- this.putPolygon(res.data.features);
|
|
|
|
|
|
+ let putPolygonData = [];
|
|
|
|
+ putPolygonData = res.data.features;
|
|
|
|
+ this.putPolygon(putPolygonData);
|
|
});
|
|
});
|
|
} else if (adcode == '520181') {
|
|
} else if (adcode == '520181') {
|
|
axios.get('/static/qingzhenzhen.json').then((res) => {
|
|
axios.get('/static/qingzhenzhen.json').then((res) => {
|
|
- this.putPolygon(res.data.features);
|
|
|
|
|
|
+ let qingzhenputPolygonData = [];
|
|
|
|
+ qingzhenputPolygonData = res.data.features;
|
|
|
|
+ this.putPolygon(qingzhenputPolygonData);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -990,20 +1001,8 @@ export default {
|
|
zIndex: 999,
|
|
zIndex: 999,
|
|
cursor: 'pointer'
|
|
cursor: 'pointer'
|
|
});
|
|
});
|
|
- // polygon.on('mouseover', (e) => {
|
|
|
|
- // polygon.setOptions({
|
|
|
|
- // fillOpacity: 0.7,
|
|
|
|
- // fillColor: '#0dbc79'
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
- // polygon.on('mouseout', (e) => {
|
|
|
|
- // polygon.setOptions({
|
|
|
|
- // fillOpacity: 0,
|
|
|
|
- // fillColor: '#0dbc79'
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
that.townPolygons.push(this.boundaryPolygon);
|
|
that.townPolygons.push(this.boundaryPolygon);
|
|
- that.map.add(that.townPolygons);
|
|
|
|
|
|
+ // that.map.add(that.townPolygons);
|
|
|
|
|
|
this.boundaryPolygon.on('click', (e) => {
|
|
this.boundaryPolygon.on('click', (e) => {
|
|
this.smallClassMapArr = [];
|
|
this.smallClassMapArr = [];
|
|
@@ -1035,6 +1034,7 @@ export default {
|
|
var pathArray = [outer];
|
|
var pathArray = [outer];
|
|
pathArray.push.apply(pathArray, holes);
|
|
pathArray.push.apply(pathArray, holes);
|
|
let townPolygon = new AMap.Polygon({
|
|
let townPolygon = new AMap.Polygon({
|
|
|
|
+ map: that.map,
|
|
pathL: pathArray,
|
|
pathL: pathArray,
|
|
strokeColor: '#00eeff',
|
|
strokeColor: '#00eeff',
|
|
strokeWeight: 1,
|
|
strokeWeight: 1,
|
|
@@ -1042,7 +1042,7 @@ export default {
|
|
fillOpacity: 0.8
|
|
fillOpacity: 0.8
|
|
});
|
|
});
|
|
townPolygon.setPath(pathArray);
|
|
townPolygon.setPath(pathArray);
|
|
- that.map.add(townPolygon);
|
|
|
|
|
|
+ // that.map.add(townPolygon);
|
|
that.map.setZoomAndCenter(13, centerLanLatArr, false, 12);
|
|
that.map.setZoomAndCenter(13, centerLanLatArr, false, 12);
|
|
|
|
|
|
// that.map.setBounds(townPolygon.getBounds(), null, null, true);
|
|
// that.map.setBounds(townPolygon.getBounds(), null, null, true);
|