|
@ -193,11 +193,11 @@ export default {
|
193
|
193
|
data() {
|
194
|
194
|
return {
|
195
|
195
|
map: null,
|
|
196
|
tal: 32.465444444444444,
|
196
|
197
|
switch1: true,
|
197
|
198
|
pointsarr: null,
|
198
|
199
|
markTypes: [],
|
199
|
200
|
toolTypes: [],
|
200
|
|
popups: [],
|
201
|
201
|
aggregatedMapAreaList: {
|
202
|
202
|
mapAreas: [], // 围栏集合
|
203
|
203
|
coreEntitys: [] // 聚合设备集合
|
|
@ -214,66 +214,6 @@ export default {
|
214
|
214
|
popup: null,
|
215
|
215
|
shadow: false,
|
216
|
216
|
dataList: [
|
217
|
|
{
|
218
|
|
name: '王小明',
|
219
|
|
number: 'ZDBH0001',
|
220
|
|
type: '落水告警',
|
221
|
|
Longitude: '32.4233',
|
222
|
|
latitude: '122.2922',
|
223
|
|
alarmTime: '2020.7.10 08:21:43',
|
224
|
|
newMarkerTime: '2020.7.10 08:21:43',
|
225
|
|
rescuePerson: '海事局A',
|
226
|
|
rescueTime: '2020.7.3 11:22:16',
|
227
|
|
rescueDuration: '10小时39分钟'
|
228
|
|
},
|
229
|
|
{
|
230
|
|
name: '王小明1',
|
231
|
|
number: 'ZDBH0002',
|
232
|
|
type: '正常',
|
233
|
|
Longitude: '32.333',
|
234
|
|
latitude: '122.0822',
|
235
|
|
alarmTime: '2020.7.10 08:21:43',
|
236
|
|
newMarkerTime: '2020.7.10 08:21:43',
|
237
|
|
rescuePerson: '海事局A',
|
238
|
|
rescueTime: '2020.7.3 11:22:16',
|
239
|
|
rescueDuration: '10小时39分钟'
|
240
|
|
},
|
241
|
|
{
|
242
|
|
name: '王小明2',
|
243
|
|
number: 'ZDBH0003',
|
244
|
|
type: '正常',
|
245
|
|
Longitude: '32.4444',
|
246
|
|
latitude: '122.0352',
|
247
|
|
alarmTime: '2020.7.10 08:21:43',
|
248
|
|
newMarkerTime: '2020.7.10 08:21:43',
|
249
|
|
rescuePerson: '海事局A',
|
250
|
|
rescueTime: '2020.7.3 11:22:16',
|
251
|
|
rescueDuration: '10小时39分钟'
|
252
|
|
},
|
253
|
|
{
|
254
|
|
name: '王小明3',
|
255
|
|
number: 'ZDBH0004',
|
256
|
|
type: '离线',
|
257
|
|
Longitude: '32.555',
|
258
|
|
latitude: '121.0752',
|
259
|
|
alarmTime: '2020.7.10 08:21:43',
|
260
|
|
newMarkerTime: '2020.7.10 08:21:43',
|
261
|
|
rescuePerson: '海事局A',
|
262
|
|
rescueTime: '2020.7.3 11:22:16',
|
263
|
|
rescueDuration: '10小时39分钟'
|
264
|
|
},
|
265
|
|
{
|
266
|
|
name: '王小明4',
|
267
|
|
number: 'ZDBH0005',
|
268
|
|
type: '落水告警',
|
269
|
|
Longitude: '32.466',
|
270
|
|
latitude: '122.04322',
|
271
|
|
alarmTime: '2020.7.10 08:21:43',
|
272
|
|
newMarkerTime: '2020.7.10 08:21:43',
|
273
|
|
rescuePerson: '海事局A',
|
274
|
|
rescueTime: '2020.7.3 11:22:16',
|
275
|
|
rescueDuration: '10小时39分钟'
|
276
|
|
}
|
277
|
217
|
],
|
278
|
218
|
nowDate: new Date(),
|
279
|
219
|
modal: false,
|
|
@ -341,8 +281,15 @@ export default {
|
341
|
281
|
this.nowDate = new Date()
|
342
|
282
|
}, 1000)
|
343
|
283
|
EventBus.$on('person', (msg) => { // 获取镜屏推送消息
|
344
|
|
console.log(msg)
|
345
|
|
this.changeLocation(msg)
|
|
284
|
msg = JSON.parse(msg)
|
|
285
|
// console.log(msg)
|
|
286
|
this.personStatistics = msg.data.countMap
|
|
287
|
if (msg.data.aggregatedMapAreaList) {
|
|
288
|
this.changeLocation(msg.data.aggregatedMapAreaList)
|
|
289
|
}
|
|
290
|
if (msg.data.unaggregatedEntityPositionList) {
|
|
291
|
this.changeUnaggregated(msg.data.unaggregatedEntityPositionList)
|
|
292
|
}
|
346
|
293
|
})
|
347
|
294
|
EventBus.$on('ship', (msg) => { // 获取镜屏推送消息
|
348
|
295
|
console.log(msg)
|
|
@ -420,7 +367,6 @@ export default {
|
420
|
367
|
this.map.on('popupopen', this.popOpen)
|
421
|
368
|
this.loadMapArea()
|
422
|
369
|
this.loadCoreEntity()
|
423
|
|
// this.loadMapView()
|
424
|
370
|
}).catch(res => {
|
425
|
371
|
// 请求失败处理...
|
426
|
372
|
})
|
|
@ -437,6 +383,18 @@ export default {
|
437
|
383
|
businessTypeName = t.name
|
438
|
384
|
}
|
439
|
385
|
})
|
|
386
|
var coreEntity = Ai.Point([e.latitude, e.longitude], {
|
|
387
|
icon: Ai.Icon({
|
|
388
|
// 设置图标URL路径
|
|
389
|
iconUrl: url,
|
|
390
|
// 设置图标大小
|
|
391
|
iconSize: [20, 20],
|
|
392
|
// 设置点对象和图标的相对偏移量
|
|
393
|
iconAnchor: [100, 100]
|
|
394
|
})
|
|
395
|
})
|
|
396
|
coreEntity.setAttributes({'elementId': e.coreEntityId, 'resourceToolType': e.coreEntityType})
|
|
397
|
this.layer.equipmentLayer.addLayer(coreEntity)
|
440
|
398
|
if (e.employeeCount > 0) {
|
441
|
399
|
var classStr = this.getClassByStatus(e.locationStatus)
|
442
|
400
|
var point = Ai.Point([e.latitude, e.longitude], {
|
|
@ -449,22 +407,10 @@ export default {
|
449
|
407
|
iconAnchor: [15, 50]
|
450
|
408
|
})
|
451
|
409
|
})
|
452
|
|
point.setAttributes({'resourceToolType': ''})
|
453
|
|
this.layer.equipmentLayer.addLayer(point)
|
|
410
|
this.map.addLayer(point)
|
454
|
411
|
this.getPopup(point, e.ebcEntityPositionList, businessTypeName, e.mapAreaName, [0, -40])
|
|
412
|
coreEntity.point = point
|
455
|
413
|
}
|
456
|
|
var coreEntity = Ai.Point([e.latitude, e.longitude], {
|
457
|
|
icon: Ai.Icon({
|
458
|
|
// 设置图标URL路径
|
459
|
|
iconUrl: url,
|
460
|
|
// 设置图标大小
|
461
|
|
iconSize: [20, 20],
|
462
|
|
// 设置点对象和图标的相对偏移量
|
463
|
|
iconAnchor: [100, 100]
|
464
|
|
})
|
465
|
|
})
|
466
|
|
coreEntity.setAttributes({'resourceToolType': '002'})
|
467
|
|
this.layer.equipmentLayer.addLayer(coreEntity)
|
468
|
414
|
}
|
469
|
415
|
})
|
470
|
416
|
},
|
|
@ -473,7 +419,7 @@ export default {
|
473
|
419
|
this.aggregatedMapAreaList.mapAreas.forEach(e => {
|
474
|
420
|
var coverWktStr = e.mapAreaContent
|
475
|
421
|
var coverLayer = Ai.Polygon(coverWktStr, {color: e.areaColor, opacity: 1.0})
|
476
|
|
coverLayer.setAttributes({'mapAreaBusinessType': e.businessType})
|
|
422
|
coverLayer.setAttributes({'elementId': e.mapAreaId, 'mapAreaBusinessType': e.businessType})
|
477
|
423
|
this.layer.areaLayer.addLayer(coverLayer)
|
478
|
424
|
if (e.ebcEntityPositionList.length > 0) {
|
479
|
425
|
var la = coverLayer.getCenter()
|
|
@ -488,7 +434,8 @@ export default {
|
488
|
434
|
iconAnchor: [15, 15]
|
489
|
435
|
})
|
490
|
436
|
})
|
491
|
|
this.layer.areaLayer.addLayer(point)
|
|
437
|
this.map.addLayer(point)
|
|
438
|
coverLayer.point = point
|
492
|
439
|
var businessTypeName
|
493
|
440
|
this.markTypes.forEach(m => {
|
494
|
441
|
if (m.mapAreaBusinessType == e.businessType) {
|
|
@ -496,62 +443,127 @@ export default {
|
496
|
443
|
}
|
497
|
444
|
})
|
498
|
445
|
this.getPopup(point, e.ebcEntityPositionList, businessTypeName, e.mapAreaName, [0, -10])
|
499
|
|
point.setAttributes({'mapAreaBusinessType': ''})
|
500
|
446
|
}
|
501
|
447
|
})
|
502
|
448
|
},
|
503
|
|
getClassByStatus(status) {
|
504
|
|
// "060"; // 救援人员 ------ 黄色
|
505
|
|
// "050"; // 自动告警 ------ 红色
|
506
|
|
// "040"; // 手动告警 ------ 红色
|
507
|
|
// "030"; // 离线 ------ 灰色
|
508
|
|
// "020"; // 进入了禁入区域 ------ 黄色
|
509
|
|
// "010"; // 在限制区域超时 ------ 黄色
|
510
|
|
// "015"; // 进入限制区域(尚未超时) ------ 绿色
|
511
|
|
// "000"; // 正常 ------ 绿色
|
512
|
|
switch (status) {
|
513
|
|
case '060':
|
514
|
|
return 'outline'
|
515
|
|
break
|
516
|
|
case '050':
|
517
|
|
return 'sso'
|
518
|
|
break
|
519
|
|
case '040':
|
520
|
|
return 'sso'
|
521
|
|
break
|
522
|
|
case '030':
|
523
|
|
return 'offline'
|
524
|
|
break
|
525
|
|
case '020':
|
526
|
|
return 'outline'
|
527
|
|
break
|
528
|
|
case '010':
|
529
|
|
return 'outline'
|
530
|
|
break
|
531
|
|
case '000':
|
532
|
|
return 'normal'
|
533
|
|
break
|
534
|
|
case '015':
|
535
|
|
return 'normal'
|
536
|
|
break
|
537
|
|
default:
|
538
|
|
return 'normal'
|
539
|
|
}
|
540
|
|
},
|
541
|
449
|
switchChange(status) {
|
542
|
|
console.log(status)
|
543
|
450
|
if (status) {
|
544
|
|
this.popups.forEach(e => {
|
545
|
|
e.openOn(this.map)
|
|
451
|
this.layer.areaLayer.eachLayer((la) => {
|
|
452
|
if (la.point) {
|
|
453
|
la.point.popup.openOn(this.map)
|
|
454
|
}
|
|
455
|
})
|
|
456
|
this.layer.equipmentLayer.eachLayer((la) => {
|
|
457
|
if (la.point) {
|
|
458
|
la.point.popup.openOn(this.map)
|
|
459
|
}
|
|
460
|
})
|
|
461
|
this.layer.personLayer.eachLayer((la) => {
|
|
462
|
if (la.popup) {
|
|
463
|
la.popup.openOn(this.map)
|
|
464
|
}
|
546
|
465
|
})
|
547
|
466
|
} else {
|
548
|
|
this.popups.forEach(e => {
|
549
|
|
this.map.closePopup(e)
|
|
467
|
this.layer.areaLayer.eachLayer((la) => {
|
|
468
|
if (la.point) {
|
|
469
|
this.map.closePopup(la.point.popup)
|
|
470
|
}
|
|
471
|
})
|
|
472
|
this.layer.equipmentLayer.eachLayer((la) => {
|
|
473
|
if (la.point) {
|
|
474
|
this.map.closePopup(la.point.popup)
|
|
475
|
}
|
|
476
|
})
|
|
477
|
this.layer.personLayer.eachLayer((la) => {
|
|
478
|
if (la.popup) {
|
|
479
|
this.map.closePopup(la.popup)
|
|
480
|
}
|
550
|
481
|
})
|
551
|
482
|
}
|
552
|
483
|
},
|
|
484
|
changeLocation(msg) {
|
|
485
|
msg.forEach(e => {
|
|
486
|
if (e.mapAreaContent) {
|
|
487
|
this.layer.areaLayer.eachLayer((la) => {
|
|
488
|
if (e.mapAreaId == la.getAttributes().elementId) {
|
|
489
|
if (la.point) {
|
|
490
|
this.map.closePopup(la.point.popup)
|
|
491
|
this.map.removeLayer(la.point)
|
|
492
|
}
|
|
493
|
if (e.ebcEntityPositionList.length > 0) {
|
|
494
|
var classStr = this.getClassByStatus(e.locationStatus)
|
|
495
|
var point = Ai.Point(la.getCenter(), {
|
|
496
|
icon: Ai.DivIcon({
|
|
497
|
html: '<div class="' + classStr + '">' + e.ebcEntityPositionList.length + '人</div>',
|
|
498
|
className: 'person-count',
|
|
499
|
// 设置图标大小
|
|
500
|
// iconSize: [20, 20],
|
|
501
|
// 设置点对象和图标的相对偏移量
|
|
502
|
iconAnchor: [15, 15]
|
|
503
|
})
|
|
504
|
})
|
|
505
|
this.map.addLayer(point)
|
|
506
|
la.point = point
|
|
507
|
var businessTypeName
|
|
508
|
this.markTypes.forEach(m => {
|
|
509
|
if (m.mapAreaBusinessType == e.businessType) {
|
|
510
|
businessTypeName = m.name
|
|
511
|
}
|
|
512
|
})
|
|
513
|
this.getPopup(point, e.ebcEntityPositionList, businessTypeName, e.mapAreaName, [0, -10])
|
|
514
|
}
|
|
515
|
}
|
|
516
|
})
|
|
517
|
} else {
|
|
518
|
this.layer.equipmentLayer.eachLayer((la) => {
|
|
519
|
if (e.coreEntityId == la.getAttributes().elementId) {
|
|
520
|
if (la.point) {
|
|
521
|
this.map.closePopup(la.point.popup)
|
|
522
|
this.map.removeLayer(la.point)
|
|
523
|
}
|
|
524
|
console.log(la.getAttributes().elementId)
|
|
525
|
la.setLatLng([e.latitude, e.longitude])
|
|
526
|
if (e.ebcEntityPositionList.length > 0) {
|
|
527
|
var classStr = this.getClassByStatus(e.locationStatus)
|
|
528
|
var point = Ai.Point([e.latitude, e.longitude], {
|
|
529
|
icon: Ai.DivIcon({
|
|
530
|
html: '<div class="' + classStr + '">' + e.employeeCount + '人</div>',
|
|
531
|
className: 'person-count',
|
|
532
|
// 设置图标大小
|
|
533
|
// iconSize: [20, 20],
|
|
534
|
// 设置点对象和图标的相对偏移量
|
|
535
|
iconAnchor: [15, 50]
|
|
536
|
})
|
|
537
|
})
|
|
538
|
this.map.addLayer(point)
|
|
539
|
var businessTypeName = '设备'
|
|
540
|
this.toolTypes.forEach(t => {
|
|
541
|
if (e.coreEntityType == t.resourceToolType) {
|
|
542
|
businessTypeName = t.name
|
|
543
|
}
|
|
544
|
})
|
|
545
|
this.getPopup(point, e.ebcEntityPositionList, businessTypeName, e.mapAreaName, [0, -40])
|
|
546
|
la.point = point
|
|
547
|
}
|
|
548
|
}
|
|
549
|
console.log('..............')
|
|
550
|
})
|
|
551
|
}
|
|
552
|
})
|
|
553
|
// this.loadMapArea()
|
|
554
|
// this.loadCoreEntity()
|
|
555
|
},
|
553
|
556
|
getPopup(point, positionList, type, name, offset) {
|
554
|
|
var popup = Ai.Popup({
|
|
557
|
// if (point.popup) {
|
|
558
|
// point.popup.remove()
|
|
559
|
// point.popup = null
|
|
560
|
// }
|
|
561
|
var maxWidth = 100
|
|
562
|
if (type) {
|
|
563
|
maxWidth = 300
|
|
564
|
}
|
|
565
|
point.popup = Ai.Popup({
|
|
566
|
maxWidth: maxWidth,
|
555
|
567
|
offset: offset,
|
556
|
568
|
autoClose: false,
|
557
|
569
|
autoPan: false,
|
|
@ -568,11 +580,13 @@ export default {
|
568
|
580
|
})
|
569
|
581
|
content += '</div></div>'
|
570
|
582
|
// 设置弹出框弹出位置
|
571
|
|
popup.setLatLng(point.getLatLng())
|
|
583
|
point.popup.setLatLng(point.getLatLng())
|
572
|
584
|
// 设置弹出框弹出内容
|
573
|
|
popup.setContent(content)
|
574
|
|
popup.openOn(this.map)
|
575
|
|
point.popup = popup
|
|
585
|
point.popup.setContent(content)
|
|
586
|
if (this.switch1) {
|
|
587
|
point.popup.openOn(this.map)
|
|
588
|
}
|
|
589
|
// point.popup = popup
|
576
|
590
|
point.on('click', (e) => {
|
577
|
591
|
if (point.popup.openo) {
|
578
|
592
|
this.map.closePopup(point.popup)
|
|
@ -580,9 +594,8 @@ export default {
|
580
|
594
|
point.popup.openOn(this.map)
|
581
|
595
|
}
|
582
|
596
|
})
|
583
|
|
this.popups.push(popup)
|
584
|
|
popup.openo = true
|
585
|
|
return popup
|
|
597
|
point.popup.openo = true
|
|
598
|
// return point.popup
|
586
|
599
|
},
|
587
|
600
|
popClose(e) {
|
588
|
601
|
e.popup.openo = false
|
|
@ -591,6 +604,7 @@ export default {
|
591
|
604
|
e.popup.openo = true
|
592
|
605
|
},
|
593
|
606
|
loadUnaggregated(dataList) { // 加载不聚合的人
|
|
607
|
this.map.addLayer(this.layer.personLayer)
|
594
|
608
|
dataList.forEach(element => {
|
595
|
609
|
var classStr = this.getClassByStatus(element.locationStatus)
|
596
|
610
|
var point = Ai.Point([element.latitude, element.longitude], {
|
|
@ -603,11 +617,91 @@ export default {
|
603
|
617
|
iconAnchor: [15, 15]
|
604
|
618
|
})
|
605
|
619
|
})
|
606
|
|
this.map.addLayer(point)
|
|
620
|
point.setAttributes({'elementId': element.entityId})
|
|
621
|
this.layer.personLayer.addLayer(point)
|
|
622
|
// this.map.addLayer(point)
|
607
|
623
|
this.getPopup(point, [element], '', '', [0, -10])
|
608
|
624
|
})
|
609
|
625
|
// this.map.setViewPort([points])
|
610
|
626
|
},
|
|
627
|
changeUnaggregated(dataList) { // 修改不聚合的人
|
|
628
|
dataList.forEach(element => {
|
|
629
|
var is = true
|
|
630
|
this.layer.personLayer.eachLayer((la) => {
|
|
631
|
if (element.entityId == la.getAttributes().elementId) {
|
|
632
|
debugger
|
|
633
|
is = false
|
|
634
|
this.map.closePopup(la.popup)
|
|
635
|
la.popup.remove()
|
|
636
|
console.log('修改' + element.name)
|
|
637
|
la.setLatLng([element.latitude, element.longitude])
|
|
638
|
var classStr = this.getClassByStatus(element.locationStatus)
|
|
639
|
var icon = Ai.DivIcon({
|
|
640
|
html: '<div class="' + classStr + '">1人</div>',
|
|
641
|
className: 'person-count',
|
|
642
|
// 设置图标大小
|
|
643
|
// iconSize: [20, 20],
|
|
644
|
// 设置点对象和图标的相对偏移量
|
|
645
|
iconAnchor: [15, 15]
|
|
646
|
})
|
|
647
|
la.setIcon(icon)
|
|
648
|
// point.setAttributes({'elementId': element.entityId})
|
|
649
|
// this.layer.personLayer.addLayer(point)
|
|
650
|
// this.map.addLayer(point)
|
|
651
|
this.getPopup(la, [element], '', '', [0, -10])
|
|
652
|
}
|
|
653
|
})
|
|
654
|
if (is) {
|
|
655
|
console.log('新增' + element.name)
|
|
656
|
var classStr = this.getClassByStatus(element.locationStatus)
|
|
657
|
var point = Ai.Point([element.latitude, element.longitude], {
|
|
658
|
icon: Ai.DivIcon({
|
|
659
|
html: '<div class="' + classStr + '">1人</div>',
|
|
660
|
className: 'person-count',
|
|
661
|
// 设置图标大小
|
|
662
|
// iconSize: [20, 20],
|
|
663
|
// 设置点对象和图标的相对偏移量
|
|
664
|
iconAnchor: [15, 15]
|
|
665
|
})
|
|
666
|
})
|
|
667
|
point.setAttributes({'elementId': element.entityId})
|
|
668
|
this.layer.personLayer.addLayer(point)
|
|
669
|
// this.map.addLayer(point)
|
|
670
|
this.getPopup(point, [element], '', '', [0, -10])
|
|
671
|
}
|
|
672
|
})
|
|
673
|
// this.map.setViewPort([points])
|
|
674
|
},
|
|
675
|
getClassByStatus(status) {
|
|
676
|
switch (status) {
|
|
677
|
case '060': // 救援人员 ------ 黄色
|
|
678
|
return 'outline'
|
|
679
|
break
|
|
680
|
case '050': // 自动告警 ------ 红色
|
|
681
|
return 'sso'
|
|
682
|
break
|
|
683
|
case '040': // 手动告警 ------ 红色
|
|
684
|
return 'sso'
|
|
685
|
break
|
|
686
|
case '030': // 离线 ------ 灰色
|
|
687
|
return 'offline'
|
|
688
|
break
|
|
689
|
case '020': // 进入了禁入区域 ------ 黄色
|
|
690
|
return 'outline'
|
|
691
|
break
|
|
692
|
case '010': // 在限制区域超时 ------ 黄色
|
|
693
|
return 'outline'
|
|
694
|
break
|
|
695
|
case '000': // 正常 ------ 绿色
|
|
696
|
return 'normal'
|
|
697
|
break
|
|
698
|
case '015': // 进入限制区域(尚未超时) ------ 绿色
|
|
699
|
return 'normal'
|
|
700
|
break
|
|
701
|
default:
|
|
702
|
return 'normal'
|
|
703
|
}
|
|
704
|
},
|
611
|
705
|
loadAggregated(dataList) {
|
612
|
706
|
},
|
613
|
707
|
showOrHide(layer, item) { // 地图设备人员围栏显示和隐藏
|
|
@ -616,13 +710,19 @@ export default {
|
616
|
710
|
if ((e.getAttributes().resourceToolType == item.resourceToolType && item.resourceToolType != undefined) || (e.getAttributes().mapAreaBusinessType == item.mapAreaBusinessType && item.mapAreaBusinessType != undefined)) {
|
617
|
711
|
if (this.map.hasLayer(e)) {
|
618
|
712
|
this.map.removeLayer(e)
|
619
|
|
if (e.popup) {
|
620
|
|
this.map.closePopup(e.popup)
|
|
713
|
if (e.point) {
|
|
714
|
this.map.removeLayer(e.point)
|
|
715
|
if (e.point.popup) {
|
|
716
|
this.map.closePopup(e.point.popup)
|
|
717
|
}
|
621
|
718
|
}
|
622
|
719
|
} else {
|
623
|
720
|
this.map.addLayer(e)
|
624
|
|
if (e.popup) {
|
625
|
|
e.popup.openOn(this.map)
|
|
721
|
if (e.point) {
|
|
722
|
this.map.addLayer(e.point)
|
|
723
|
if (e.point.popup) {
|
|
724
|
e.point.popup.openOn(this.map)
|
|
725
|
}
|
626
|
726
|
}
|
627
|
727
|
}
|
628
|
728
|
}
|