22fb20b3
songchongxian
城市停车运营监控
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<template>
<div class="app-chinaMapBox theme-map">
<div class="mapTitle eleVerHorCenter-flex">
<div class="cellBox">
<table class="parkTotalTb">
<tr>
<td><div class="parkTotalImg"></div></td>
<td><div class="infoBox"><div><countTo :startVal='parkParams.startVal' :endVal='parkParams.endVal' :duration='animationTime'></countTo></div><div>停车场总数</div></div> </td>
</tr>
</table>
</div>
<div class="cellBox">
<table class="parkTotalTb">
<tr>
<td><div class="memberTotalImg"></div></td>
|
41f3747f
liuqimichale
金额 分处理成元
|
16
|
<td><div class="infoBox"><div><countTo :startVal='memberParams.startVal' :endVal='getParkingTotal' :duration='animationTime'></countTo></div><div>用户总数</div></div> </td>
|
22fb20b3
songchongxian
城市停车运营监控
|
17
18
19
20
21
22
23
|
</tr>
</table>
</div>
<div class="cellBox">
<table class="parkTotalTb">
<tr>
<td><div class="dayTotalImg"></div></td>
|
3b7be3b2
liuqimichale
今日订单数
|
24
|
<td><div class="infoBox"><div><countTo :startVal='dayParams.startVal' :endVal='getOrderTotal' :duration='animationTime'></countTo></div><div>今日订单数</div></div> </td>
|
22fb20b3
songchongxian
城市停车运营监控
|
25
26
27
28
29
30
31
32
33
34
|
</tr>
</table>
</div>
</div>
<div class="mapChart"> </div>
</div>
</template>
<script>
import echarts from 'echarts'
import countTo from 'vue-count-to';//通过设置:endVall 和 :startVall 会自动判断计数和倒数,:duration='3000'是指完成动画的时间。
|
a1bafdec
liuqimichale
vuex
|
35
|
import {mapGetters} from 'vuex' //use commit
|
e52cf1d6
liuqimichale
添加丹阳
|
36
|
import { parkAddress, baiduMapAddress, baiduMapAddressDY, parkAddressDY } from '../../api/api'
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
37
|
|
22fb20b3
songchongxian
城市停车运营监控
|
38
39
40
41
42
43
44
45
|
export default {
name: "chinaMap",
components: { countTo },
data() {
return {
animationTime:5000,//动画时间
parkParams:{//parkTotal:738,//停车场总数
startVal:0,
|
8b9d912e
liuqimichale
停车场总数
|
46
|
endVal: 0
|
22fb20b3
songchongxian
城市停车运营监控
|
47
48
49
|
},
memberParams:{//memberTotal:738,//会员总数
startVal:0,
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
50
|
endVal: 0
|
22fb20b3
songchongxian
城市停车运营监控
|
51
52
53
|
},
dayParams:{//dayTotal:10000,//今日订单数
startVal:0,
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
54
|
endVal: 0
|
22fb20b3
songchongxian
城市停车运营监控
|
55
56
|
},
mapChart: {},
|
346baf26
liuqimichale
map 地图
|
57
|
mapData:[],
|
026e10da
liuqimichale
map 地图
|
58
|
coordinateData:{}
|
22fb20b3
songchongxian
城市停车运营监控
|
59
60
|
}
},
|
a1bafdec
liuqimichale
vuex
|
61
|
computed: {
|
3b7be3b2
liuqimichale
今日订单数
|
62
|
...mapGetters(['getParkingTotal','getOrderTotal'])
|
a1bafdec
liuqimichale
vuex
|
63
|
},
|
22fb20b3
songchongxian
城市停车运营监控
|
64
|
mounted() {
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
65
66
|
this.parkInit()
this.baiduMapInit()
|
22fb20b3
songchongxian
城市停车运营监控
|
67
68
|
},
methods: {
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
69
|
parkInit() {
|
e52cf1d6
liuqimichale
添加丹阳
|
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// parkAddress({
// orgIds: this.GLOBAL.paramsvariables
// }).then((response)=>{
// let data = response.data.data
// console.log(response)
// this.parkParams.endVal=data
// }).catch((response)=>{
// console.log(response);
// })
this.$axios.all(
[
parkAddress({ orgIds: this.GLOBAL.paramsvariables}),
|
1bc516df
liuqimichale
地图点击事件
|
83
|
parkAddressDY({ orgIds: this.GLOBAL.variables})
|
e52cf1d6
liuqimichale
添加丹阳
|
84
85
86
87
88
|
]
)
.then(this.$axios.spread((acctWX, acctDY) => {
let WXdata = acctWX.data.data
let DYdata = acctDY.data.data
|
a6301da7
liuqimichale
去掉丹阳
|
89
90
91
92
|
// this.parkParams.endVal=WXdata.allNum+DYdata.allNum
this.parkParams.endVal=WXdata.allNum
|
e52cf1d6
liuqimichale
添加丹阳
|
93
94
|
}))
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
95
96
|
},
baiduMapInit() {
|
e52cf1d6
liuqimichale
添加丹阳
|
97
98
99
100
101
|
this.$axios.all(
[
baiduMapAddress({ orgIds: this.GLOBAL.paramsvariables}),
|
1bc516df
liuqimichale
地图点击事件
|
102
|
baiduMapAddressDY({ orgIds: this.GLOBAL.variables})
|
e52cf1d6
liuqimichale
添加丹阳
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
]
)
.then(this.$axios.spread((acctWX, acctDY) => {
let WXdata = acctWX.data.data
let DYdata = acctDY.data.data
console.log(WXdata)
console.log(DYdata)
//let mapData = [];
for (let i=0;i<WXdata.length;i++){
this.mapData.push({
name:WXdata[i].orgName,
value:WXdata[i].allBerthNum
})
this.coordinateData[WXdata[i].orgName] = [WXdata[i].lonId,WXdata[i].latId]
}
|
a6301da7
liuqimichale
去掉丹阳
|
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
// for (let i=0;i<DYdata.length;i++){
// this.mapData.push({
// name:DYdata[i].orgName,
// value:DYdata[i].allBerthNum
// })
// this.coordinateData[DYdata[i].orgName] = [DYdata[i].lonId,DYdata[i].latId]
// }
this.mapData.push({
name:'丹阳',
value:12312
})
this.coordinateData['丹阳'] = [119.677183,32.022778]
this.mapData.push({
name:'北京',
value:1234
})
this.coordinateData['北京'] = [116.298116,39.91845]
this.mapData.push({
name:'黄石',
value:1234
})
this.coordinateData['黄石'] = [115.214842,30.32798]
this.mapData.push({
name:'兰州',
value:1234
})
this.coordinateData['兰州'] = [103.671786,36.153543]
|
e52cf1d6
liuqimichale
添加丹阳
|
157
158
159
160
161
162
163
164
|
//'双流': [103.912493, 30.586969]
this.mapChart= this.createPie();
window.addEventListener('resize', function() {
this.mapChart.resize()
}.bind(this));
}))
|
3bafd7ad
liuqimichale
地图点击事件
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
//
// baiduMapAddress({
// orgIds: this.GLOBAL.paramsvariables
// }).then((response)=>{
// let data = response.data.data
// console.log(data)
// //let mapData = [];
// for (let i=0;i<data.length;i++){
// this.mapData.push({
// name:data[i].orgName,
// value:data[i].allBerthNum
// })
// this.coordinateData[data[i].orgName] = [data[i].lonId,data[i].latId]
// }
// //'双流': [103.912493, 30.586969]
// this.mapChart= this.createPie();
// window.addEventListener('resize', function() {
// this.mapChart.resize()
// }.bind(this));
// }).catch((response)=>{
// console.log(response);
// })
|
e52cf1d6
liuqimichale
添加丹阳
|
187
188
|
|
1eee9ca9
liuqimichale
api 接口封装 地图
|
189
|
},
|
22fb20b3
songchongxian
城市停车运营监控
|
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
/*
* china地图
* */
createPie(){
let mapChart = echarts.init(document.querySelector('.app-chinaMapBox .mapChart'));
const series=this._getSeries();
const option= {
grid: {
top: '0%',left: '0%',
right: '0%',bottom: '3%'
},
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(6, 75, 140, 0)',
borderColor: '#FFFFCC',
showDelay: 0,
hideDelay: 0,
enterable: true,
transitionDuration: 0,
//extraCssText: 'z-index:100',
formatter: function(params, ticket, callback) {
if (params.seriesType != "lines") {
//console.log(params)
//根据业务自己拓展要显示的内容
var res = "";
var name = params.name;
var value = params.value;
var numStyle='color:#02C202; font-size: 16px; font-family: display-free;line-height:25px;font-weight:bold;';
res = "<div style='padding:5px;height:16px;line-height:16px;background:rgba(43, 140, 209, 0.96)'>" + name + "</div>" ;
res +="<div style='padding:5px;height:25px;background:rgba(6, 75, 140, 0.9);'>"+"泊位总数:"+"<span style='"+numStyle+"'>"+ value[2] +"</span></div>";
return res;
}
}
},
dataRange: {
calculable: false,
color: ['#FFAB00'],
textStyle: {color: '#fff' },
show: false,
},
geo: {
map: 'china',
label: {
normal: {show: false },
emphasis: {show: false}
},
center: [104.94296,37.433088],
roam: true,zoom:1.3,
scaleLimit:{ min:1.1,max:5 },
itemStyle: {
normal: {
areaColor: '#020e33',borderColor: '#404a59'
},
emphasis: { areaColor: '#04294A'}
},
},
series: series
}
mapChart.setOption(option);
|
3bafd7ad
liuqimichale
地图点击事件
|
250
251
|
mapChart.on('click',function (params) {
console.log(params.name)
|
1bc516df
liuqimichale
地图点击事件
|
252
253
254
255
|
let name = params.name
switch (name) {
case '赤峰': window.open('http://www.renniting.cn/cfmonitor/index.html')
break;
|
a6301da7
liuqimichale
去掉丹阳
|
256
|
case '黄石': window.open('http://www.renniting.cn/dymonitor/index.html')
|
1bc516df
liuqimichale
地图点击事件
|
257
258
259
|
break;
}
|
3bafd7ad
liuqimichale
地图点击事件
|
260
|
})
|
22fb20b3
songchongxian
城市停车运营监控
|
261
262
263
264
|
return mapChart;
},
//设置 series
_getSeries(){
|
8b091594
liuqimichale
map 地图
|
265
266
|
//this.coordinateData;
const geoCoordMap = this.coordinateData;
|
22fb20b3
songchongxian
城市停车运营监控
|
267
|
const dataFrom = '无锡';
|
a6301da7
liuqimichale
去掉丹阳
|
268
269
270
271
272
273
274
275
276
|
this.mapData = [
{name: '赤峰',value: 95},
{name: '兰州',value: 70},
// {name: '丹阳',value: 90},
{name: '北京',value: 190},
{name: '黄石',value: 290},
]
const data = this.mapData;
// console.log(data1)
|
346baf26
liuqimichale
map 地图
|
277
278
|
// const data = [
// {name: '赤峰',value: 95},
|
a6301da7
liuqimichale
去掉丹阳
|
279
280
281
|
// {name: '无锡',value: 70},
// {name: '丹阳',value: 70},
// // {name: '丹阳', value: 30}
|
346baf26
liuqimichale
map 地图
|
282
|
// ];
|
a6301da7
liuqimichale
去掉丹阳
|
283
|
|
346baf26
liuqimichale
map 地图
|
284
|
console.log(data)
|
a6301da7
liuqimichale
去掉丹阳
|
285
286
|
let tmpSeries=[
{
|
22fb20b3
songchongxian
城市停车运营监控
|
287
288
289
290
291
292
293
294
295
|
//name: '无锡',
type: 'lines',
zlevel: 1,
effect: {
show: true,
period: 6,
trailLength: 0.2, //0-1
color: '#fff',
//shadowBlur: 3,
|
a6301da7
liuqimichale
去掉丹阳
|
296
|
symbolSize: 6
|
22fb20b3
songchongxian
城市停车运营监控
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
},
lineStyle: {
normal: {
color: '#a6c84c',
width: 0,
curveness: 0.2
}
},
data: data.map(function(dataItem) {
return {
fromName: dataFrom,
toName: dataItem.name,
coords: [
geoCoordMap[dataFrom],
geoCoordMap[dataItem.name]
]
}
})
},
{
//name: '无锡',
type: 'lines',
//zlevel: 2,
symbol: 'none',//['none', 'pin'],
symbolSize: 8,
effect: {
show: true,
period: 6,
trailLength: 0,
color: '#fff',
},
lineStyle: {
normal: {
color: '#FFAB00', //线颜色
width: 1,
opacity: 0.6,
curveness: 0.2
}
},
data: data.map(function(dataItem) {
return {
fromName: dataFrom,
toName: dataItem.name,
coords: [
geoCoordMap[dataFrom],
geoCoordMap[dataItem.name]
]
}
})
},
{
|
a6301da7
liuqimichale
去掉丹阳
|
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
//name: '无锡',
type: 'lines',
//zlevel: 2,
symbol: 'none',//['none', 'pin'],
symbolSize: 8,
effect: {
show: true,
period: 6,
trailLength: 0,
color: '#fff',
},
lineStyle: {
normal: {
color: '#FFAB00', //线颜色
width: 1,
opacity: 0.6,
curveness: 0.2
}
},
data: data.map(function(dataItem) {
return {
fromName: dataFrom,
toName: dataItem.name,
coords: [
geoCoordMap[dataFrom],
geoCoordMap[dataItem.name]
]
}
})
},
{
|
22fb20b3
songchongxian
城市停车运营监控
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
|
name: '城市',
type: 'effectScatter',
coordinateSystem: 'geo',
//zlevel: 2,
rippleEffect: {
scale: 5,
brushType: 'stroke'
},
label: {
normal: {
show: true,
position: 'right',
color: '#FFFFFF',
formatter: '{b}'
}
},
//光圈大小
symbolSize: function(val) {
return 10;
},
itemStyle: {
normal: {
color: '#a6c84c'
}
},
data: data.map(function(dataItem) {
return {
name: dataItem.name,
value: geoCoordMap[dataItem.name].concat([dataItem.value])
};
})
},
{
|
a6301da7
liuqimichale
去掉丹阳
|
412
|
name: '丹阳',
|
22fb20b3
songchongxian
城市停车运营监控
|
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
type: 'scatter',
coordinateSystem: 'geo',
label: {
normal: {
show: true,
position: 'bottom',
formatter: '{b}',
textStyle: {
color: "#ED3D06"
}
},
emphasis: {
show: true
}
},
symbol: 'circle',
symbolSize: 5,
data: [{
name: dataFrom,
value: geoCoordMap[dataFrom].concat([100]),
}],
}
];
return tmpSeries;
},
//测试被父组件调用
setParkTotal(){
this.parkParams.startVal=this.parkParams.endVal;
this.parkParams.endVal=105;
console.log("停车场总数:root");
}
}
}
</script>
<style scoped lang="scss">
.app-chinaMapBox{
position: relative;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
.mapChart{
position: relative;
width: 100%;
height: 100%;
/*margin-top: 5%;*/
/*margin-bottom: 5px;*/
/*height: -webkit-calc(100% - (5% + 5px));*/
/*height: -moz-calc(100% - (5% + 5px));*/
/*height: calc(100% - (5% + 5px));*/
/*top:0;left: 0;*/
/*bottom: 0;*/
/*right:0;*/
/*z-index: -1;*/
}
.cellBox{
width: 33.333%;text-align: center;
}
.mapTitle{
position: absolute;
top: 0;
width: 100%;
height: 70px;
background-color:RGBA(0, 45, 140, .7);
z-index: 5;
}
.parkTotalImg{
background: url(../../images/map/parkTotal.svg) no-repeat;
background-size: 100% 100%;
width: 45px;height: 45px;
}
.memberTotalImg{
background: url(../../images/map/memberTotal.svg) no-repeat;
background-size: 100% 100%;
width: 45px;height: 45px;
}
.dayTotalImg{
background: url(../../images/map/dayTotal.svg) no-repeat;
background-size: 100% 100%;
width: 45px;height: 45px;
}
.parkTotalTb{
display: inline-block;
margin-top:2px;
}
.infoBox{
margin-left: 5px;
text-align: left;
}
/*数字:738*/
.infoBox>div:first-child{
font-size: 24px;
}
/*文字:会员总数*/
.infoBox>div:last-child{
color: #00CFFE;font-size: 14px;
}
}
</style>
|