|
@ -161,20 +161,23 @@ export default {
|
161
|
161
|
var obj = JSON.parse(msg)
|
162
|
162
|
if (obj.data.currentEntityPosition) {
|
163
|
163
|
var targetPoint = null
|
|
164
|
var flag = true
|
164
|
165
|
this.personLayer.eachLayer((point) => {
|
165
|
|
if (point.getAttributes().rescueEntityPosition && point.getAttributes().rescueEntityPosition.entityId == obj.data.currentEntityPosition.entityId) { // 救援人
|
166
|
|
point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
167
|
|
point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
|
168
|
|
if (point.getAttributes().lineLayer) {
|
169
|
|
var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueTargetEntityPosition.longitude + ' ' + point.getAttributes().rescueTargetEntityPosition.latitude + ')'
|
170
|
|
console.log(lineWktStr)
|
171
|
|
point.getAttributes().lineLayer.setPoints(lineWktStr)
|
172
|
|
}
|
173
|
|
if (point.getAttributes().popup) {
|
174
|
|
point.getAttributes().popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
175
|
|
var tips
|
176
|
|
tips = '<div class="hand-alarm">救援人员</div>'
|
177
|
|
var content =
|
|
166
|
if (flag) {
|
|
167
|
if (point.getAttributes().rescueEntityPosition && (point.getAttributes().rescueEntityPosition.entityId == obj.data.currentEntityPosition.entityId) && !point.target) { // 救援人
|
|
168
|
flag = false
|
|
169
|
point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
|
170
|
point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
|
|
171
|
if (point.getAttributes().lineLayer) {
|
|
172
|
var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueTargetEntityPosition.longitude + ' ' + point.getAttributes().rescueTargetEntityPosition.latitude + ')'
|
|
173
|
console.log(lineWktStr)
|
|
174
|
point.getAttributes().lineLayer.setPoints(lineWktStr)
|
|
175
|
}
|
|
176
|
if (point.popup) {
|
|
177
|
point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
|
178
|
var tips
|
|
179
|
tips = '<div class="hand-alarm">救援人员</div>'
|
|
180
|
var content =
|
178
|
181
|
'<div class="tips-item"><div class="top"><div class="user-pic"><t-icon icon="user-outline"></t-icon></div><div>' + obj.data.currentEntityPosition.name + '</div>' + tips + '</div><div class="middle">' +
|
179
|
182
|
'<div class="row">' +
|
180
|
183
|
'<div>经度</div>' +
|
|
@ -186,51 +189,52 @@ export default {
|
186
|
189
|
'</div>' +
|
187
|
190
|
'<div class="row">' +
|
188
|
191
|
'<div>最新定位时间</div>' +
|
189
|
|
'<div>' + new Date(obj.data.currentEntityPosition.createDate) + '</div>' +
|
|
192
|
'<div>' + this.formatDate(new Date(obj.data.currentEntityPosition.createDate)) + '</div>' +
|
190
|
193
|
'</div></div></div>' +
|
191
|
194
|
'</div></div>'
|
192
|
|
point.getAttributes().popup.setContent(content)
|
193
|
|
}
|
194
|
|
} else if (point.getAttributes().rescueTargetEntityPosition && point.getAttributes().rescueTargetEntityPosition.entityId == obj.data.currentEntityPosition.entityId) { // 报警人
|
195
|
|
point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
196
|
|
point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
|
197
|
|
if (point.getAttributes().lineLayer) {
|
198
|
|
var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueEntityPosition.longitude + ' ' + point.getAttributes().rescueEntityPosition.latitude + ')'
|
199
|
|
console.log(lineWktStr)
|
200
|
|
point.getAttributes().lineLayer.setPoints(lineWktStr)
|
201
|
|
}
|
202
|
|
if (point.getAttributes().popup) {
|
203
|
|
point.getAttributes().popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
204
|
|
var e = point.getAttributes()
|
205
|
|
console.log(e.terminalId)
|
206
|
|
var tips
|
207
|
|
var callHelp = ''
|
208
|
|
var other = ''
|
209
|
|
var className = 'alarm'
|
210
|
|
if (e.businessType == '2') {
|
211
|
|
className = 'hand-alarm'
|
212
|
|
} else if (e.businessType == '4') {
|
213
|
|
className = 'offline'
|
|
195
|
point.popup.setContent(content).openOn(this.map)
|
|
196
|
}
|
|
197
|
} else if (point.getAttributes().rescueTargetEntityPosition && (point.getAttributes().rescueTargetEntityPosition.entityId == obj.data.currentEntityPosition.entityId) && point.target) { // 报警人
|
|
198
|
flag = false
|
|
199
|
point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
|
200
|
point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
|
|
201
|
if (point.getAttributes().lineLayer) {
|
|
202
|
var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueEntityPosition.longitude + ' ' + point.getAttributes().rescueEntityPosition.latitude + ')'
|
|
203
|
console.log(lineWktStr)
|
|
204
|
point.getAttributes().lineLayer.setPoints(lineWktStr)
|
214
|
205
|
}
|
215
|
|
tips = '<div class="' + className + '">' + e.businessTypeZH + '</div>'
|
216
|
|
other = '<div class="row sos">' +
|
|
206
|
if (point.popup) {
|
|
207
|
point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
|
|
208
|
var e = point.getAttributes()
|
|
209
|
console.log(e.terminalId)
|
|
210
|
var tips
|
|
211
|
var callHelp = ''
|
|
212
|
var other = ''
|
|
213
|
var className = 'alarm'
|
|
214
|
if (e.businessType == '2') {
|
|
215
|
className = 'hand-alarm'
|
|
216
|
} else if (e.businessType == '4') {
|
|
217
|
className = 'offline'
|
|
218
|
}
|
|
219
|
tips = '<div class="' + className + '">' + e.businessTypeZH + '</div>'
|
|
220
|
other = '<div class="row sos">' +
|
217
|
221
|
'<div>求救时间</div>' +
|
218
|
222
|
'<div>' + e.alarmTime + '</div>' +
|
219
|
223
|
'</div>' + '<div class="row sos">' +
|
220
|
224
|
'<div>求救时长</div>' +
|
221
|
225
|
'<div>' + this.getDurationTime(e.alarmTime) + '</div>' +
|
222
|
226
|
'</div>'
|
223
|
|
if (e.isAssignAlarm == '0') {
|
224
|
|
callHelp = '<div style="display:flex;">' +
|
|
227
|
if (e.isAssignAlarm == '0') {
|
|
228
|
callHelp = '<div style="display:flex;">' +
|
225
|
229
|
"<button class='point-out' onClick='window.Vue.appoint(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-user-outline'></i>指派</button>" +
|
226
|
230
|
"<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
|
227
|
231
|
'</div>'
|
228
|
|
} else {
|
229
|
|
callHelp = '<div style="display:flex;justify-content: flex-end;">' +
|
|
232
|
} else {
|
|
233
|
callHelp = '<div style="display:flex;justify-content: flex-end;">' +
|
230
|
234
|
"<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
|
231
|
235
|
'</div>'
|
232
|
|
}
|
233
|
|
var content = '<div class="tips-item"><div class="top"><div class="user-pic"><t-icon icon="user-outline"></t-icon></div><div>' + e.rescueTargetEntityPosition.name + '</div>' + tips + '</div><div class="middle"><div class="row">' +
|
|
236
|
}
|
|
237
|
var content = '<div class="tips-item"><div class="top"><div class="user-pic"><t-icon icon="user-outline"></t-icon></div><div>' + e.rescueTargetEntityPosition.name + '</div>' + tips + '</div><div class="middle"><div class="row">' +
|
234
|
238
|
'<div>终端编号</div>' +
|
235
|
239
|
'<div>' + e.terminalId + '</div>' +
|
236
|
240
|
'</div>' +
|
|
@ -247,12 +251,14 @@ export default {
|
247
|
251
|
'<div>' + e.alarmTime + '</div>' +
|
248
|
252
|
'</div></div></div>' + callHelp +
|
249
|
253
|
'</div></div>'
|
250
|
|
point.getAttributes().popup.setContent(content)
|
|
254
|
point.popup.setContent(content).openOn(this.map)
|
|
255
|
}
|
251
|
256
|
}
|
252
|
|
}
|
253
|
|
if (!point.getAttributes().rescueEntityPosition) {
|
254
|
|
if (point.getAttributes().rescueWorkEmployeeRoleId == obj.data.currentEntityPosition.entityId) {
|
255
|
|
targetPoint = point
|
|
257
|
if (!point.getAttributes().rescueEntityPosition) {
|
|
258
|
if (point.getAttributes().rescueWorkEmployeeRoleId == obj.data.currentEntityPosition.entityId) {
|
|
259
|
flag = false
|
|
260
|
targetPoint = point
|
|
261
|
}
|
256
|
262
|
}
|
257
|
263
|
}
|
258
|
264
|
})
|
|
@ -342,7 +348,8 @@ export default {
|
342
|
348
|
point.on('click', (pointE) => {
|
343
|
349
|
popup.openOn(this.map)
|
344
|
350
|
})
|
345
|
|
point.getAttributes().popup = popup
|
|
351
|
point.target = true
|
|
352
|
point.popup = popup
|
346
|
353
|
this.personLayer.addLayer(point)
|
347
|
354
|
return point
|
348
|
355
|
},
|
|
@ -387,13 +394,22 @@ export default {
|
387
|
394
|
// 设置弹出框弹出内容
|
388
|
395
|
popup.setContent(content)
|
389
|
396
|
popup.openOn(this.map)
|
390
|
|
point.getAttributes().popup = popup
|
|
397
|
point.target = false
|
|
398
|
point.popup = popup
|
391
|
399
|
point.on('click', (pointE) => {
|
392
|
400
|
popup.openOn(this.map)
|
393
|
401
|
})
|
394
|
402
|
this.personLayer.addLayer(point)
|
395
|
403
|
return point
|
396
|
404
|
},
|
|
405
|
formatDate(date) {
|
|
406
|
var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)
|
|
407
|
var day = (date.getDate()) < 10 ? '0' + (date.getDate()) : (date.getDate())
|
|
408
|
var hour = (date.getHours()) < 10 ? '0' + (date.getHours()) : (date.getHours())
|
|
409
|
var minutes = (date.getMinutes()) < 10 ? '0' + (date.getMinutes()) : (date.getMinutes() + 1)
|
|
410
|
var seconds = (date.getSeconds()) < 10 ? '0' + (date.getSeconds()) : (date.getSeconds())
|
|
411
|
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
|
|
412
|
},
|
397
|
413
|
getDurationTime(time) {
|
398
|
414
|
let date = new Date(time)
|
399
|
415
|
let diff = (new Date().getTime() - date.getTime()) / 1000
|