周分析初始化是加载

main
jn517618 2 years ago
parent 4c92bd22d3
commit 7cf4672e55
  1. 13
      src/views/energySources/component/load.vue
  2. 88
      src/views/energySourcesProvince/component/pathMap.vue
  3. 4
      src/views/energySourcesProvince/index.vue

@ -30,6 +30,8 @@ export default {
return { return {
radio: 0, radio: 0,
selectDate: '', selectDate: '',
xAxisArr: [],
seriesJson: null
}; };
}, },
components: { components: {
@ -37,6 +39,7 @@ export default {
}, },
created() { created() {
this.selectDate = this.$moment().format('YYYY-MM-DD') this.selectDate = this.$moment().format('YYYY-MM-DD')
this.getWeekData('created')
this.$nextTick(() => { this.$nextTick(() => {
if (this.radio) { if (this.radio) {
@ -56,6 +59,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if (v) { if (v) {
this.getWeekData() this.getWeekData()
this.echartsInitWeek(this.xAxisArr, this.seriesJson)
} else { } else {
this.getDayData() this.getDayData()
} }
@ -112,7 +116,7 @@ export default {
}, },
// //
getWeekData() { getWeekData(t) {
getWeekElectricity({ manufacturerBrand: this.userInfo.dept_name, today: this.selectDate }).then(res => { getWeekElectricity({ manufacturerBrand: this.userInfo.dept_name, today: this.selectDate }).then(res => {
console.log('res1 ====>', res) console.log('res1 ====>', res)
@ -131,7 +135,12 @@ export default {
seriesJson.ping.push(data[k].ping) seriesJson.ping.push(data[k].ping)
seriesJson.gu.push(data[k].gu) seriesJson.gu.push(data[k].gu)
} }
this.echartsInitWeek(xAxisArr, seriesJson) if (t) {
this.xAxisArr = xAxisArr
this.seriesJson = seriesJson
} else {
this.echartsInitWeek(xAxisArr, seriesJson)
}
}) })
}, },
echartsInitDay(xAxisArr, seriesJson) { echartsInitDay(xAxisArr, seriesJson) {

@ -83,15 +83,15 @@ export default {
}, },
created() { created() {
this.$nextTick(() => { this.$nextTick(() => {
this.getData() // this.getData()
// setTimeout(() => { setTimeout(() => {
// this.initMap(); this.initMap();
// }, 0); }, 0);
// window.addEventListener('resize', () => { window.addEventListener('resize', () => {
// if (this.baiduMap) { if (this.baiduMap) {
// this.backMap(); this.backMap();
// } }
// }); });
}) })
}, },
mounted() { mounted() {
@ -124,7 +124,7 @@ export default {
}, },
// //
backMap() { backMap() {
var point = new BMapGL.Point(112.37558, 25.59342); var point = new BMapGL.Point(112.415542, 25.582733);
this.infoShow = false; this.infoShow = false;
this.baiduMap.centerAndZoom(point, 12); this.baiduMap.centerAndZoom(point, 12);
if (this.polyline) { if (this.polyline) {
@ -134,26 +134,33 @@ export default {
// this.baiduMap.closeInfoWindow(); // this.baiduMap.closeInfoWindow();
}, },
initMap() { initMap() {
var point = new BMapGL.Point(112.37558, 25.59342); var point = new BMapGL.Point(112.415542, 25.582733);
if (this.baiduMap) { if (this.baiduMap) {
this.baiduMap.centerAndZoom(point, 12); this.baiduMap.centerAndZoom(point, 12);
} }
else { else {
this.baiduMap = new BMapGL.Map('container', {enableMapClick: false}); this.baiduMap = new BMapGL.Map('container', { enableMapClick: false });
this.baiduMap.centerAndZoom(point, 12); this.baiduMap.centerAndZoom(point, 12);
this.baiduMap.enableScrollWheelZoom(true); this.baiduMap.enableScrollWheelZoom(true);
this.baiduMap.setMinZoom(12); this.baiduMap.setMinZoom(12);
// this.baiduMap.setMaxZoom(12) // this.baiduMap.setMaxZoom(12)
// this.baiduMap.disableDragging(); // this.baiduMap.disableDragging();
// this.baiduMap.setCurrentCity('');
// var b = new BMapGL.Bounds(new BMapGL.Point(112.37558, 25.59342), new BMapGL.Point(112.832025, 40.126349)); var bound = new BMapGL.Bounds(new BMapGL.Point(112.415542, 25.582733), new BMapGL.Point(112.415542, 25.582733));
// console.log(b) this.baiduMap.enableScrollWheelZoom();
// try { this.baiduMap.addOverlay(new BMapGL.Polygon([
// BMapLib.AreaRestriction.setBounds(this.baiduMap, b); new BMapGL.Point(bound.sw.lng, bound.sw.lat),
// } catch (e) { new BMapGL.Point(bound.sw.lng, bound.ne.lat),
// alert(e); new BMapGL.Point(bound.ne.lng, bound.ne.lat),
// } new BMapGL.Point(bound.ne.lng, bound.sw.lat)
]))
try {
BMapGLLib.AreaRestriction.setBounds(map, bound);
} catch (e) {
alert(e);
}
// var opts = { type: BMAP_NAVIGATION_CONTROL_SMALL } // var opts = { type: BMAP_NAVIGATION_CONTROL_SMALL }
// this.baiduMap.addControl(new BMapGL.NavigationControl(opts)); // this.baiduMap.addControl(new BMapGL.NavigationControl(opts));
// this.baiduMap.setMapStyleV2({ style: 'midnight' }); // this.baiduMap.setMapStyleV2({ style: 'midnight' });
@ -222,18 +229,41 @@ export default {
}); });
this.baiduMap.addOverlay(prism); this.baiduMap.addOverlay(prism);
// var prism1 = new BMapGL.Prism(path, 1000, {
// topFillColor: '#8dc6ff',
// topFillOpacity: 0.3,
// sideFillColor: '#8dc6ff',
// sideFillOpacity: 0
// });
// this.baiduMap.addOverlay(prism1);
} }
}) })
this.baiduMap.enableScrollWheelZoom();
// bdary.get('', (rs) => {
// //
// for (var i = 0; i < rs.boundaries.length; i++) {
// var path = [];
// var xyArr = rs.boundaries[i].split(';');
// var ptArr = [];
// for (var j = 0; j < xyArr.length; j++) {
// var tmp = xyArr[j].split(',');
// var pt = new BMapGL.Point(tmp[0], tmp[1]);
// ptArr.push(pt);
// }
// var mapmask = new BMapGL.MapMask(ptArr, {
// isBuildingMask: true,
// isPoiMask: true,
// isMapMask: true,
// showRegion: 'inside',
// topFillColor: '#5679ea',
// topFillOpacity: 0.5,
// sideFillColor: '#5679ea',
// sideFillOpacity: 0.9
// });
// this.baiduMap.addOverlay(mapmask);
// var border = new BMapGL.Polyline(ptArr, {
// strokeColor: '#4ca7a2',
// strokeWeight: 3,
// strokeOpacity: 1
// });
// this.baiduMap.addOverlay(border);
// }
// });
this.baiduMap.setMapStyleV2({ styleJson: styleJson }); this.baiduMap.setMapStyleV2({ styleJson: styleJson });

@ -2,7 +2,7 @@
<div style="height: 100%"> <div style="height: 100%">
<div class="modelBox"> <div class="modelBox">
<Header /> <Header />
<emissionAll /> <!-- <emissionAll />
<measure /> <measure />
<statistics /> <statistics />
@ -11,7 +11,7 @@
<electricity /> <electricity />
<ringPercent /> <ringPercent />
<togetherPercent /> <togetherPercent />
<intensity /> <intensity /> -->
<maps /> <maps />
</div> </div>

Loading…
Cancel
Save