Browse Source

实时报警提交

wangkang3 4 years ago
parent
commit
d139f027a1
1 changed files with 73 additions and 5 deletions
  1. 73 5
      ebc-middle-platform/src/modules/call-help/current.vue

+ 73 - 5
ebc-middle-platform/src/modules/call-help/current.vue

@ -101,7 +101,7 @@ export default {
101 101
      })
102 102
      this.load()
103 103
    })
104
    // this.changePoint('1')
104
    console.log(this.getDurationTime('2020-11-21 12:54:55'))
105 105
  },
106 106
  methods: {
107 107
    loadMap() {
@ -160,8 +160,9 @@ export default {
160 160
    changePoint(msg) {
161 161
      var obj = JSON.parse(msg)
162 162
      if (obj.data.currentEntityPosition) {
163
        var targetPoint = null
163 164
        this.personLayer.eachLayer((point) => {
164
          if (point.getAttributes().rescueEntityPosition && point.getAttributes().rescueEntityPosition.entityId == obj.data.currentEntityPosition.entityId) {
165
          if (point.getAttributes().rescueEntityPosition && point.getAttributes().rescueEntityPosition.entityId == obj.data.currentEntityPosition.entityId) { // 救援人
165 166
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
166 167
            point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
167 168
            if (point.getAttributes().lineLayer) {
@ -190,7 +191,7 @@ export default {
190 191
                  '</div></div>'
191 192
              point.getAttributes().popup.setContent(content)
192 193
            }
193
          } else if (point.getAttributes().rescueTargetEntityPosition && point.getAttributes().rescueTargetEntityPosition.entityId == obj.data.currentEntityPosition.entityId) {
194
          } else if (point.getAttributes().rescueTargetEntityPosition && point.getAttributes().rescueTargetEntityPosition.entityId == obj.data.currentEntityPosition.entityId) { // 报警人
194 195
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
195 196
            point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
196 197
            if (point.getAttributes().lineLayer) {
@ -200,10 +201,71 @@ export default {
200 201
            }
201 202
            if (point.getAttributes().popup) {
202 203
              point.getAttributes().popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
203
              // point.getAttributes().popup.setContent(content)
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'
214
              }
215
              tips = '<div class="' + className + '">' + e.businessTypeZH + '</div>'
216
              other = '<div class="row sos">' +
217
                '<div>求救时间</div>' +
218
                '<div>' + e.alarmTime + '</div>' +
219
                '</div>' + '<div class="row sos">' +
220
                '<div>求救时长</div>' +
221
                '<div>' + this.getDurationTime(e.alarmTime) + '</div>' +
222
                '</div>'
223
              if (e.isAssignAlarm == '0') {
224
                callHelp = '<div style="display:flex;">' +
225
                "<button class='point-out' onClick='window.Vue.appoint(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-user-outline'></i>指派</button>" +
226
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
227
                '</div>'
228
              } else {
229
                callHelp = '<div style="display:flex;justify-content: flex-end;">' +
230
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
231
                '</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">' +
234
                  '<div>终端编号</div>' +
235
                  '<div>' + e.terminalId + '</div>' +
236
                  '</div>' +
237
                  '<div class="row">' +
238
                  '<div>经度</div>' +
239
                  '<div>' + e.rescueTargetEntityPosition.longitude + '</div>' +
240
                  '</div>' +
241
                  '<div class="row">' +
242
                  '<div>纬度</div>' +
243
                  '<div>' + e.rescueTargetEntityPosition.latitude + '</div>' +
244
                  '</div>' + other +
245
                  '<div class="row">' +
246
                  '<div>最新定位时间</div>' +
247
                  '<div>' + e.alarmTime + '</div>' +
248
                  '</div></div></div>' + callHelp +
249
                  '</div></div>'
250
              point.getAttributes().popup.setContent(content)
251
            }
252
          }
253
          if (!point.getAttributes().rescueEntityPosition) {
254
            if (point.getAttributes().rescueWorkEmployeeRoleId == obj.data.currentEntityPosition.entityId) {
255
              targetPoint = point
204 256
            }
205 257
          }
206 258
        })
259
        if (targetPoint) {
260
          var rescuerPoint = this.rescuePoint({rescueEntityPosition: obj.data.currentEntityPosition})
261
          var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + targetPoint.getAttributes().rescueTargetEntityPosition.longitude + ' ' + targetPoint.getAttributes().rescueTargetEntityPosition.latitude + ')'
262
          var lineLayer = new Ai.Polyline(lineWktStr, {color: 'red', opacity: 1.0})
263
          targetPoint.getAttributes().lineLayer = lineLayer
264
          rescuerPoint.getAttributes().lineLayer = lineLayer
265
          targetPoint.getAttributes().point = rescuerPoint
266
          rescuerPoint.getAttributes().point = targetPoint
267
          this.map.addLayer(lineLayer)
268
        }
207 269
      }
208 270
    },
209 271
    point(e) {
@ -224,7 +286,7 @@ export default {
224 286
                '<div>' + e.alarmTime + '</div>' +
225 287
                '</div>' + '<div class="row sos">' +
226 288
                '<div>求救时长</div>' +
227
                '<div>' + 1 + 'min</div>' +
289
                '<div>' + e.durationTime + '</div>' +
228 290
                '</div>'
229 291
      if (e.isAssignAlarm == '0') {
230 292
        callHelp = '<div style="display:flex;">' +
@ -236,6 +298,7 @@ export default {
236 298
                "<button class='close-confirm' onClick='window.Vue.close(" + JSON.stringify(e) + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
237 299
                '</div>'
238 300
      }
301
239 302
      var point = Ai.Point([e.rescueTargetEntityPosition.latitude, e.rescueTargetEntityPosition.longitude], {
240 303
        icon: Ai.DivIcon({
241 304
          html: '<img src="' + icon + '"/>',
@ -331,6 +394,11 @@ export default {
331 394
      this.personLayer.addLayer(point)
332 395
      return point
333 396
    },
397
    getDurationTime(time) {
398
      let date = new Date(time)
399
      let diff = (new Date().getTime() - date.getTime()) / 1000
400
      return Math.floor(diff / 3600) + '小时' + Math.floor((diff - Math.floor(diff / 3600) * 3600) / 60) + '分钟'
401
    },
334 402
    showModal(item) {
335 403
      this.modal = true
336 404
    },