ソースを参照

报警救援问题修复

wangkang3 4 年 前
コミット
99b1692ca1
共有1 個のファイルを変更した47 個の追加104 個の削除を含む
  1. 47 104
      ebc-middle-platform/src/modules/call-help/current.vue

+ 47 - 104
ebc-middle-platform/src/modules/call-help/current.vue

@ -117,35 +117,6 @@ export default {
117 117
      var la = Ai.WMTSLayer(GIS_SEA_URL)
118 118
      this.map.addLayer(la)
119 119
      this.load()
120
    },
121
    load() {
122
      this.personLayer = new Ai.FeatureGroup()
123
      this.$test
124
        .post(services.alarm.LOAD_ALARM_DETAILS, '')
125
        .then((res) => {
126
          console.log(res)
127
          this.map.addLayer(this.personLayer)
128
          res.data.forEach(element => {
129
            var alarmPoint = null
130
            if (element.rescueTargetEntityPosition) {
131
              alarmPoint = this.point(element)
132
            }
133
            if (element.rescueEntityPosition) {
134
              var rescuerPoint = this.rescuerPoint(element)
135
              var lineWktStr = 'LINESTRING ( ' + element.rescueTargetEntityPosition.longitude + ' ' + element.rescueTargetEntityPosition.latitude + ',' + element.rescueEntityPosition.longitude + ' ' + element.rescueEntityPosition.latitude + ')'
136
              var lineLayer = new Ai.Polyline(lineWktStr, {color: 'red', opacity: 1.0})
137
              alarmPoint.getAttributes().lineLayer = lineLayer
138
              rescuerPoint.getAttributes().lineLayer = lineLayer
139
              alarmPoint.getAttributes().point = rescuerPoint
140
              rescuerPoint.getAttributes().point = alarmPoint
141
              this.map.addLayer(lineLayer)
142
            }
143
          })
144
          // this.map.setViewPort([this.personLayer])
145
        })
146
        .catch((res) => {
147
          // 请求失败处理...
148
        })
149 120
      this.$test
150 121
        .post(services.alarm.LOAD_MAP_AREA_TOOL, {})
151 122
        .then((res) => {
@ -178,6 +149,35 @@ export default {
178 149
        // 请求失败处理...
179 150
        })
180 151
    },
152
    load() {
153
      this.personLayer = new Ai.FeatureGroup()
154
      this.$test
155
        .post(services.alarm.LOAD_ALARM_DETAILS, '')
156
        .then((res) => {
157
          console.log(res)
158
          this.map.addLayer(this.personLayer)
159
          res.data.forEach(element => {
160
            var alarmPoint = null
161
            if (element.rescueTargetEntityPosition) {
162
              alarmPoint = this.point(element)
163
            }
164
            if (element.rescueEntityPosition) {
165
              var rescuerPoint = this.rescuerPoint(element)
166
              var lineWktStr = 'LINESTRING ( ' + element.rescueTargetEntityPosition.longitude + ' ' + element.rescueTargetEntityPosition.latitude + ',' + element.rescueEntityPosition.longitude + ' ' + element.rescueEntityPosition.latitude + ')'
167
              var lineLayer = new Ai.Polyline(lineWktStr, {color: 'red', opacity: 1.0})
168
              alarmPoint.lineLayer = lineLayer
169
              rescuerPoint.lineLayer = lineLayer
170
              alarmPoint.point = rescuerPoint
171
              rescuerPoint.point = alarmPoint
172
              this.map.addLayer(lineLayer)
173
            }
174
          })
175
          // this.map.setViewPort([this.personLayer])
176
        })
177
        .catch((res) => {
178
          // 请求失败处理...
179
        })
180
    },
181 181
    changePoint(msg) {
182 182
      var obj = JSON.parse(msg)
183 183
      if (obj.data.currentEntityPosition) {
@ -189,10 +189,10 @@ export default {
189 189
              flag = false
190 190
              point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
191 191
              point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
192
              if (point.getAttributes().lineLayer) {
192
              if (point.lineLayer) {
193 193
                var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueTargetEntityPosition.longitude + ' ' + point.getAttributes().rescueTargetEntityPosition.latitude + ')'
194 194
                console.log(lineWktStr)
195
                point.getAttributes().lineLayer.setPoints(lineWktStr)
195
                point.lineLayer.setPoints(lineWktStr)
196 196
              }
197 197
              if (point.popup) {
198 198
                point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
@ -219,10 +219,10 @@ export default {
219 219
              flag = false
220 220
              point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
221 221
              point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
222
              if (point.getAttributes().lineLayer) {
222
              if (point.lineLayer) {
223 223
                var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueEntityPosition.longitude + ' ' + point.getAttributes().rescueEntityPosition.latitude + ')'
224 224
                console.log(lineWktStr)
225
                point.getAttributes().lineLayer.setPoints(lineWktStr)
225
                point.lineLayer.setPoints(lineWktStr)
226 226
              }
227 227
              if (point.popup) {
228 228
                point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
@ -245,14 +245,15 @@ export default {
245 245
                '<div>求救时长</div>' +
246 246
                '<div>' + this.getDurationTime(e.alarmTime) + '</div>' +
247 247
                '</div>'
248
                var param = JSON.stringify(e)
248 249
                if (e.isAssignAlarm == '0') {
249 250
                  callHelp = '<div style="display:flex;">' +
250
                "<button class='point-out' onClick='window.Vue.appoint(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-user-outline'></i>指派</button>" +
251
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
251
                "<button class='point-out' onClick='window.Vue.appoint(" + param + ")'><i style='font-size: 20px;' class='aidicon aidicon-user-outline'></i>指派</button>" +
252
                "<button class='close-confirm' onClick='window.Vue.close(" + param + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
252 253
                '</div>'
253 254
                } else {
254 255
                  callHelp = '<div style="display:flex;justify-content: flex-end;">' +
255
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
256
                "<button class='close-confirm' onClick='window.Vue.close(" + param + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
256 257
                '</div>'
257 258
                }
258 259
                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">' +
@ -287,10 +288,10 @@ export default {
287 288
          var rescuerPoint = this.rescuePoint({rescueEntityPosition: obj.data.currentEntityPosition})
288 289
          var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + targetPoint.getAttributes().rescueTargetEntityPosition.longitude + ' ' + targetPoint.getAttributes().rescueTargetEntityPosition.latitude + ')'
289 290
          var lineLayer = new Ai.Polyline(lineWktStr, {color: 'red', opacity: 1.0})
290
          targetPoint.getAttributes().lineLayer = lineLayer
291
          rescuerPoint.getAttributes().lineLayer = lineLayer
292
          targetPoint.getAttributes().point = rescuerPoint
293
          rescuerPoint.getAttributes().point = targetPoint
291
          targetPoint.lineLayer = lineLayer
292
          rescuerPoint.lineLayer = lineLayer
293
          targetPoint.point = rescuerPoint
294
          rescuerPoint.point = targetPoint
294 295
          this.map.addLayer(lineLayer)
295 296
        }
296 297
      }
@ -467,56 +468,11 @@ export default {
467 468
              this.personLayer.eachLayer(layer => {
468 469
                this.map.removeLayer(layer)
469 470
                this.map.closePopup()
471
                if (layer.lineLayer && this.map.hasLayer(layer.lineLayer)) {
472
                  this.map.removeLayer(layer.lineLayer)
473
                }
470 474
              })
471 475
              this.load()
472
              // var alarmPoint = this.rescuerPoint({rescueEntityPosition: res.data})
473
              // var lineWktStr = 'LINESTRING ( ' + res.data.longitude + ' ' + res.data.latitude + ',' + this.appointAlarm.rescueTargetEntityPosition.longitude + ' ' + this.appointAlarm.rescueTargetEntityPosition.latitude + ')'
474
              // var lineLayer = new Ai.Polyline(lineWktStr, {color: 'red', opacity: 1.0})
475
              // this.personLayer.addLayer(alarmPoint)
476
              // this.map.addLayer(lineLayer)
477
              // var that = this
478
              // this.personLayer.eachLayer(layer => {
479
              //   if (layer.getAttributes().rescueTargetEntityPosition.entityId === that.appointAlarm.rescueTargetEntityPosition.entityId) {
480
              //     var className = 'alarm'
481
              //     if (layer.getAttributes().businessType == '2') {
482
              //       className = 'hand-alarm'
483
              //     } else if (layer.getAttributes().businessType == '4') {
484
              //       className = 'offline'
485
              //     }
486
              //     var tips = '<div class="' + className + '">' + layer.getAttributes().businessTypeZH + '</div>'
487
              //     var content =
488
              //     '<div class="tips-item"><div class="top"><div class="user-pic"><t-icon icon="user-outline"></t-icon></div><div>' + layer.getAttributes().rescueTargetEntityPosition.name + '</div>' + tips + '</div><div class="middle"><div class="row">' +
489
              //     '<div>终端编号</div>' +
490
              //     '<div>' + layer.getAttributes().terminalId + '</div>' +
491
              //     '</div>' +
492
              //     '<div class="row">' +
493
              //     '<div>经度</div>' +
494
              //     '<div>' + layer.getAttributes().rescueTargetEntityPosition.longitude + '</div>' +
495
              //     '</div>' +
496
              //     '<div class="row">' +
497
              //     '<div>纬度</div>' +
498
              //     '<div>' + layer.getAttributes().rescueTargetEntityPosition.latitude + '</div>' +
499
              //     '</div>' + '<div class="row sos">' +
500
              //   '<div>求救时间</div>' +
501
              //   '<div>' + layer.getAttributes().alarmTime + '</div>' +
502
              //   '</div>' + '<div class="row sos">' +
503
              //   '<div>求救时长</div>' +
504
              //   '<div>' + 1 + 'min</div>' +
505
              //   '</div>' +
506
              //     '<div class="row">' +
507
              //     '<div>最新定位时间</div>' +
508
              //     '<div>' + layer.getAttributes().alarmTime + '</div>' +
509
              //     '</div></div></div>' + '<div style="display:flex;justify-content: flex-end;">' +
510
              //   "<button class='close-confirm' onClick='window.Vue.close(" + JSON.stringify(layer.getAttributes()) + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
511
              //   '</div>' +
512
              //     '</div></div>'
513
              //     layer.getAttributes().popup.setContent(content).openOn(this.map)
514
              //     alarmPoint.getAttributes().lineLayer = lineLayer
515
              //     layer.getAttributes().lineLayer = lineLayer
516
              //     alarmPoint.getAttributes().point = layer
517
              //     layer.getAttributes().point = alarmPoint
518
              //   }
519
              // })
520 476
            })
521 477
            .catch((res) => {
522 478
              // 请求失败处理...
@ -537,24 +493,11 @@ export default {
537 493
              this.personLayer.eachLayer(layer => {
538 494
                this.map.removeLayer(layer)
539 495
                this.map.closePopup()
496
                if (layer.lineLayer && this.map.hasLayer(layer.lineLayer)) {
497
                  this.map.removeLayer(layer.lineLayer)
498
                }
540 499
              })
541 500
              this.load()
542
              // var chooseLayer
543
              // this.personLayer.eachLayer(layer => {
544
              //   if (layer.getAttributes().rescueTargetEntityPosition.entityId === item.rescueTargetEntityPosition.entityId) {
545
              //     chooseLayer = layer
546
              //     if (layer.getAttributes().point) {
547
              //       this.map.removeLayer(layer.getAttributes().point)
548
              //       this.map.closePopup(layer.getAttributes().point.popup)
549
              //       this.map.removeLayer(layer.getAttributes().lineLayer)
550
              //     }
551
              //   }
552
              // })
553
              // this.personLayer.removeLayer(chooseLayer)
554
              // if (chooseLayer.getAttributes().point) {
555
              //   this.personLayer.removeLayer(chooseLayer.getAttributes().point)
556
              // }
557
              // this.map.closePopup(chooseLayer.popup)
558 501
            })
559 502
            .catch((res) => {
560 503
            // 请求失败处理...