Parcourir la Source

Merge branch 'master' of http://10.1.235.20:3000/asiainfo/ebc.git

konghl 4 ans auparavant
Parent
commit
db678770b9
1 fichiers modifiés avec 73 ajouts et 5 suppressions
  1. 73 5
      ebc-middle-platform/src/modules/call-help/current.vue

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

101
      })
101
      })
102
      this.load()
102
      this.load()
103
    })
103
    })
104
    // this.changePoint('1')
104
    console.log(this.getDurationTime('2020-11-21 12:54:55'))
105
  },
105
  },
106
  methods: {
106
  methods: {
107
    loadMap() {
107
    loadMap() {
160
    changePoint(msg) {
160
    changePoint(msg) {
161
      var obj = JSON.parse(msg)
161
      var obj = JSON.parse(msg)
162
      if (obj.data.currentEntityPosition) {
162
      if (obj.data.currentEntityPosition) {
163
        var targetPoint = null
163
        this.personLayer.eachLayer((point) => {
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
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
166
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
166
            point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
167
            point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
167
            if (point.getAttributes().lineLayer) {
168
            if (point.getAttributes().lineLayer) {
190
                  '</div></div>'
191
                  '</div></div>'
191
              point.getAttributes().popup.setContent(content)
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
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
195
            point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
195
            point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
196
            point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
196
            if (point.getAttributes().lineLayer) {
197
            if (point.getAttributes().lineLayer) {
200
            }
201
            }
201
            if (point.getAttributes().popup) {
202
            if (point.getAttributes().popup) {
202
              point.getAttributes().popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
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
    point(e) {
271
    point(e) {
224
                '<div>' + e.alarmTime + '</div>' +
286
                '<div>' + e.alarmTime + '</div>' +
225
                '</div>' + '<div class="row sos">' +
287
                '</div>' + '<div class="row sos">' +
226
                '<div>求救时长</div>' +
288
                '<div>求救时长</div>' +
227
                '<div>' + 1 + 'min</div>' +
289
                '<div>' + e.durationTime + '</div>' +
228
                '</div>'
290
                '</div>'
229
      if (e.isAssignAlarm == '0') {
291
      if (e.isAssignAlarm == '0') {
230
        callHelp = '<div style="display:flex;">' +
292
        callHelp = '<div style="display:flex;">' +
236
                "<button class='close-confirm' onClick='window.Vue.close(" + JSON.stringify(e) + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
298
                "<button class='close-confirm' onClick='window.Vue.close(" + JSON.stringify(e) + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
237
                '</div>'
299
                '</div>'
238
      }
300
      }
301
239
      var point = Ai.Point([e.rescueTargetEntityPosition.latitude, e.rescueTargetEntityPosition.longitude], {
302
      var point = Ai.Point([e.rescueTargetEntityPosition.latitude, e.rescueTargetEntityPosition.longitude], {
240
        icon: Ai.DivIcon({
303
        icon: Ai.DivIcon({
241
          html: '<img src="' + icon + '"/>',
304
          html: '<img src="' + icon + '"/>',
331
      this.personLayer.addLayer(point)
394
      this.personLayer.addLayer(point)
332
      return point
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
    showModal(item) {
402
    showModal(item) {
335
      this.modal = true
403
      this.modal = true
336
    },
404
    },