|
@@ -62,12 +62,20 @@ export default {
|
|
|
let _self = this
|
|
|
bigemap.then(() => {
|
|
|
// window.BM.Config.HTTP_URL = 'http://www.bigemap.com:9000';
|
|
|
- window.BM.Config.HTTP_URL = 'http://49.4.78.194:17143';
|
|
|
+
|
|
|
+ window.BM.Config.HTTP_URL = process.env.VUE_APP_GIS_API;
|
|
|
+ let ip1 = process.env.VUE_APP_GIS_API;
|
|
|
+ let ip2 = 'http://49.4.78.194:17143';
|
|
|
+
|
|
|
+ // window.BM.Config.HTTP_URL = 'http://49.4.78.194:17143';
|
|
|
+ // let ip1 = 'http://49.4.78.194:17143';
|
|
|
+ // let ip2 = 'http://49.4.78.194:17143';
|
|
|
+ let mapid = 'bigemap.zaixiantianditu'
|
|
|
// window.BM.Config.HTTP_URL = 'http://192.168.1.181:9000';
|
|
|
// arcgis-satellite
|
|
|
// amap-satellite
|
|
|
// zhongkexingtu
|
|
|
- let map = window.BM.map('map', 'bigemap.zaixiantianditu', {
|
|
|
+ let map = window.BM.map('map', null, {
|
|
|
// let map = window.BM.map('map', 'bigemap.6914xxtx', {
|
|
|
center: [30, 104],
|
|
|
minZoom: 6,
|
|
@@ -76,6 +84,33 @@ export default {
|
|
|
attributionControl: false,
|
|
|
preferCanvas: true, //适用于数据量大时 地图反应速度加快
|
|
|
});
|
|
|
+ var promise = fetch(`${ip1}/tokens/v1?access_token=none`).then(function (response) {
|
|
|
+ return response.json();
|
|
|
+ }).then(function (body) {
|
|
|
+ return body.token
|
|
|
+ }).then(
|
|
|
+ (token) => {
|
|
|
+ var CanvasLayer = BM.GridLayer.extend({
|
|
|
+ createTile: function (coords, done) {
|
|
|
+ let error;
|
|
|
+ let {
|
|
|
+ x,
|
|
|
+ y,
|
|
|
+ z
|
|
|
+ } = coords;
|
|
|
+ let tile = new Image;
|
|
|
+ tile.style.backgroundColor = 'inherit';
|
|
|
+ tile.src = `${ip2}/${mapid}/tiles/${z}/${x}/${y}.png?access_token=${token}`
|
|
|
+ setTimeout(function () {
|
|
|
+ done(error, tile);
|
|
|
+ return null
|
|
|
+ }, 1000);
|
|
|
+ return tile;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ new CanvasLayer().addTo(map);
|
|
|
+ }
|
|
|
+ )
|
|
|
window.Bmap=map;
|
|
|
this.bMap=map;
|
|
|
//首尾需要一致
|
|
@@ -116,8 +151,8 @@ export default {
|
|
|
}).addTo(this.bMap);
|
|
|
window.geo2=geo2;
|
|
|
//限制拖动
|
|
|
- this.bMap.setMaxBounds(geo2.getBounds());
|
|
|
- this.bMap.fitBounds(geo2.getBounds());
|
|
|
+ this.bMap.setMaxBounds([[43.42301,124.174976],[53.561657,135.086264]]);
|
|
|
+ this.bMap.fitBounds([[43.42301,124.174976],[53.561657,135.086264]]);
|
|
|
|
|
|
const layers = geo2.getLayers();
|
|
|
for (const item of layers) {
|
|
@@ -151,6 +186,9 @@ export default {
|
|
|
let gfbconurl = 'http://' + _self.href.split("//")[1].split("/")[0] + '/largeScreenImg/guangfuban.png'
|
|
|
let gfsconurl = 'http://' + _self.href.split("//")[1].split("/")[0] + '/largeScreenImg/guang.png'
|
|
|
let gfhfconurl = 'http://' + _self.href.split("//")[1].split("/")[0] + '/largeScreenImg/huafuguangfu.png'
|
|
|
+ let fengjiblue = 'http://' + _self.href.split("//")[1].split("/")[0] + '/img/fengji/fengjiblue.png'
|
|
|
+ let fengjigreen = 'http://' + _self.href.split("//")[1].split("/")[0] + '/img/fengji/fengjigreen.png'
|
|
|
+ let fengjiyellow = 'http://' + _self.href.split("//")[1].split("/")[0] + '/img/fengji/fengjiyellow.png'
|
|
|
// 所有场站标记点位
|
|
|
if (this.mapData.allStationInfo !== null && this.mapData.allStationInfo !== undefined) {
|
|
|
let data = this.mapData.allStationInfo
|
|
@@ -263,12 +301,26 @@ export default {
|
|
|
iconAnchor: [30, 50],
|
|
|
className: 'stationIcon',
|
|
|
})
|
|
|
+ let hf_gfstation_icon = window.BM.icon({
|
|
|
+ iconUrl: gfhfconurl,
|
|
|
+ iconSize: [30, 50],
|
|
|
+ iconAnchor: [30, 50],
|
|
|
+ })
|
|
|
for (let item of data) {
|
|
|
let coordinate = [Number(item.latitude), Number(item.longitude)]
|
|
|
- let marker = window.BM.marker(coordinate, {
|
|
|
- icon: station_icon,
|
|
|
- riseOnHover: true
|
|
|
- }).addTo(this.bMap);
|
|
|
+ let marker = ''
|
|
|
+ if (item.type === '风') {
|
|
|
+ marker = window.BM.marker(coordinate, {
|
|
|
+ icon: station_icon,
|
|
|
+ riseOnHover: true
|
|
|
+ }).addTo(this.bMap);
|
|
|
+ } else {
|
|
|
+ marker = window.BM.marker(coordinate, {
|
|
|
+ icon: hf_gfstation_icon,
|
|
|
+ riseOnHover: true
|
|
|
+ }).addTo(this.bMap);
|
|
|
+ }
|
|
|
+
|
|
|
// 悬浮动作
|
|
|
marker.on('mouseover', function (e) {
|
|
|
marker.bindTooltip('<div>场站名称:' + item.stationName + '</div>' + '<div>经度:' + item.longitude + '</div>' + '<div>纬度:' + item.latitude + '</div>',
|
|
@@ -287,6 +339,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// 所有风机、塔、拐点标记点位
|
|
|
+ // console.log(this.mapData.allPointInfo)
|
|
|
if (this.mapData.allPointInfo !== null && this.mapData.allPointInfo !== undefined) {
|
|
|
let data = this.mapData.allPointInfo
|
|
|
let station_icon = window.BM.icon({
|
|
@@ -295,35 +348,78 @@ export default {
|
|
|
iconAnchor: [35, 55],
|
|
|
className: 'stationIcon',
|
|
|
})
|
|
|
- let fj_icon = window.BM.icon({
|
|
|
- iconUrl: fjIconurl,
|
|
|
- iconSize: [30, 30],
|
|
|
- iconAnchor: [30, 30],
|
|
|
- className: 'stationIcon',
|
|
|
- })
|
|
|
- for (let item of data.fan) {
|
|
|
- let coordinate = [Number(item.latitudeFan), Number(item.longitudeFan)]
|
|
|
- let marker = window.BM.marker(coordinate, {
|
|
|
- icon: fj_icon,
|
|
|
- riseOnHover: true
|
|
|
- }).addTo(this.bMap);
|
|
|
+ let fj_icon = [{
|
|
|
+ icon: window.BM.icon({
|
|
|
+ iconUrl: fjIconurl,
|
|
|
+ iconSize: [30, 30],
|
|
|
+ iconAnchor: [30, 30],
|
|
|
+ className: 'stationIcon',
|
|
|
+ })
|
|
|
+ },{
|
|
|
+ icon: window.BM.icon({
|
|
|
+ iconUrl: fengjiblue,
|
|
|
+ iconSize: [30, 30],
|
|
|
+ iconAnchor: [30, 30],
|
|
|
+ className: 'stationIcon',
|
|
|
+ })
|
|
|
+ },{
|
|
|
+ icon: window.BM.icon({
|
|
|
+ iconUrl: fengjigreen,
|
|
|
+ iconSize: [30, 30],
|
|
|
+ iconAnchor: [30, 30],
|
|
|
+ className: 'stationIcon',
|
|
|
+ })
|
|
|
+ },{
|
|
|
+ icon: window.BM.icon({
|
|
|
+ iconUrl: fengjiyellow,
|
|
|
+ iconSize: [30, 30],
|
|
|
+ iconAnchor: [30, 30],
|
|
|
+ className: 'stationIcon',
|
|
|
+ })
|
|
|
+ }]
|
|
|
+ let i = 0
|
|
|
+ for (let fan of data.fan) {
|
|
|
+ if(i>3) i = 0
|
|
|
+ for (let item of fan.data) {
|
|
|
+ let coordinate = [Number(item.latitudeFan), Number(item.longitudeFan)]
|
|
|
+ let marker = window.BM.marker(coordinate, {
|
|
|
+ icon: fj_icon[i].icon,
|
|
|
+ riseOnHover: true
|
|
|
+ }).addTo(this.bMap);
|
|
|
+ marker.on('mouseover', function (e) {
|
|
|
+ // console.log(item)
|
|
|
+ if (fan.type === 'project') {
|
|
|
+ marker.bindTooltip('<div>所属场站名称:' + fan.name + '</div>' + '<div>经度:' + item.longitudeFan + '</div>' + '<div>纬度:' + item.latitudeFan + '</div>',
|
|
|
+ {permanent: true, className: 'infoToolTip', offset: [0, -30]}).openTooltip();
|
|
|
+ } else {
|
|
|
+ marker.bindTooltip('<div>所属场站名称:' + fan.name + '</div>' + '<div>经度:' + item.longitudeFan + '</div>' + '<div>纬度:' + item.latitudeFan + '</div>',
|
|
|
+ {permanent: true, className: 'infoToolTip', offset: [0, -30]}).openTooltip();
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ marker.on('mouseout', function () {
|
|
|
+ marker.bindTooltip().closeTooltip();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ i++
|
|
|
}
|
|
|
- for(let coordinatesList of data.coordinatesList){
|
|
|
- for(let item of coordinatesList){
|
|
|
- if(item.length>0){
|
|
|
- let latlngs = []
|
|
|
- for (let coor of item){
|
|
|
- latlngs.push([Number(coor.latitude),Number(coor.longitude)])
|
|
|
- window.BM.marker([Number(coor.latitude),Number(coor.longitude)]).addTo(this.bMap);
|
|
|
+ for (let coordinatesList of data.coordinatesList) {
|
|
|
+ for (let key in coordinatesList) {
|
|
|
+ let coordinates = coordinatesList[key]
|
|
|
+ for (let item of coordinates) {
|
|
|
+ if (item.length > 0) {
|
|
|
+ let latlngs = []
|
|
|
+ for (let coor of item) {
|
|
|
+ latlngs.push([Number(coor.latitude), Number(coor.longitude)])
|
|
|
+ window.BM.marker([Number(coor.latitude), Number(coor.longitude)]).addTo(this.bMap);
|
|
|
+ }
|
|
|
+ var polygon = BM.polygon(latlngs).addTo(this.bMap);
|
|
|
+ polygon.bindTooltip(key, {permanent: true, className: 'infoToolTip', offset: [0, 0]}).openTooltip();
|
|
|
+ // 让地图适配当前的线段
|
|
|
+ this.bMap.fitBounds(polygon.getBounds());
|
|
|
}
|
|
|
- // 拐点可以增加弹窗吗?
|
|
|
- var polygon = BM.polygon(latlngs).addTo(this.bMap);
|
|
|
- // polygon.on('mouseover',function (e){
|
|
|
- // polygon.bindTooltip('拐点坐标',{permanent:true});
|
|
|
- // })
|
|
|
- // 让地图适配当前的线段
|
|
|
- this.bMap.fitBounds(polygon.getBounds());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
// 项目或者场站id
|
|
@@ -349,11 +445,11 @@ export default {
|
|
|
marker.on('mouseout', function () {
|
|
|
marker.bindTooltip().closeTooltip();
|
|
|
})
|
|
|
- console.log(item.projectId)
|
|
|
- let projectId = item.projectId.find(w=>w.id===id)
|
|
|
+ // console.log(item.projectId)
|
|
|
+ let projectId = item.projectId.find(w => w.id === id)
|
|
|
// 点击动作
|
|
|
marker.on('click', function (e) {
|
|
|
- if(projectId !== undefined && projectId !== null){
|
|
|
+ if (projectId !== undefined && projectId !== null) {
|
|
|
if (projectId.type === 'project') {
|
|
|
let project = {projectId: id, equipmentNo: item.towerNo}
|
|
|
sessionStorage.setItem("emailWindTowerInfo", JSON.stringify(project))
|
|
@@ -365,7 +461,7 @@ export default {
|
|
|
_self.$store.dispatch('equipmentInfo/realWindTowerInfo', JSON.stringify(station))
|
|
|
_self.$router.push({path: "/homepage/realResourcesInfo"})
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (item.projectId[0].type === 'project') {
|
|
|
let project = {projectId: item.projectId[0].id, equipmentNo: item.towerNo}
|
|
|
sessionStorage.setItem("emailWindTowerInfo", JSON.stringify(project))
|