Quellcode durchsuchen

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

konghl vor 4 Jahren
Ursprung
Commit
f66052086b
1 geänderte Dateien mit 90 neuen und 53 gelöschten Zeilen
  1. 90 53
      ebc-middle-platform/src/modules/call-help/current.vue

+ 90 - 53
ebc-middle-platform/src/modules/call-help/current.vue

@ -147,10 +147,31 @@ export default {
147 147
          // 请求失败处理...
148 148
        })
149 149
      this.$test
150
        .post(services.organization.EQUIPMENT_NOT_BIND, {})
150
        .post(services.alarm.LOAD_MAP_AREA_TOOL, {})
151 151
        .then((res) => {
152 152
          console.log(res)
153
          res.data.forEach(e => {
153
          res.data.mapAreaList.forEach(e => {
154
            var typeObj = res.data.mapAreaTypeList.filter(type => {
155
              return e.businessType == type.mapAreaBusinessType
156
            })
157
            var polygon = Ai.Polygon(e.mapAreaContent, {color: typeObj[0].color})
158
            this.map.addLayer(polygon)
159
          })
160
          res.data.toolList.forEach(e => {
161
            var typeObj = res.data.toolTypeList.filter(type => {
162
              return e.resourceToolType == type.resourceToolType
163
            })
164
            var point = Ai.Point([e.latitude, e.longitude], {
165
              icon: Ai.Icon({
166
              // 设置图标URL路径
167
                iconUrl: typeObj[0].iconUrl,
168
                // 设置图标大小
169
                iconSize: [20, 20],
170
                // 设置点对象和图标的相对偏移量
171
                iconAnchor: [100, 100]
172
              })
173
            })
174
            this.map.addLayer(point)
154 175
          })
155 176
        })
156 177
        .catch((res) => {
@ -161,20 +182,23 @@ export default {
161 182
      var obj = JSON.parse(msg)
162 183
      if (obj.data.currentEntityPosition) {
163 184
        var targetPoint = null
185
        var flag = true
164 186
        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 =
187
          if (flag) {
188
            if (point.getAttributes().rescueEntityPosition && (point.getAttributes().rescueEntityPosition.entityId == obj.data.currentEntityPosition.entityId) && !point.target) { // 救援人
189
              flag = false
190
              point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
191
              point.getAttributes().rescueEntityPosition = obj.data.currentEntityPosition
192
              if (point.getAttributes().lineLayer) {
193
                var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueTargetEntityPosition.longitude + ' ' + point.getAttributes().rescueTargetEntityPosition.latitude + ')'
194
                console.log(lineWktStr)
195
                point.getAttributes().lineLayer.setPoints(lineWktStr)
196
              }
197
              if (point.popup) {
198
                point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
199
                var tips
200
                tips = '<div class="hand-alarm">救援人员</div>'
201
                var content =
178 202
                  '<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 203
                  '<div class="row">' +
180 204
                  '<div>经度</div>' +
@ -186,51 +210,52 @@ export default {
186 210
                  '</div>' +
187 211
                  '<div class="row">' +
188 212
                  '<div>最新定位时间</div>' +
189
                  '<div>' + new Date(obj.data.currentEntityPosition.createDate) + '</div>' +
213
                  '<div>' + this.formatDate(new Date(obj.data.currentEntityPosition.createDate)) + '</div>' +
190 214
                  '</div></div></div>' +
191 215
                  '</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'
216
                point.popup.setContent(content).openOn(this.map)
217
              }
218
            } else if (point.getAttributes().rescueTargetEntityPosition && (point.getAttributes().rescueTargetEntityPosition.entityId == obj.data.currentEntityPosition.entityId) && point.target) { // 报警人
219
              flag = false
220
              point.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
221
              point.getAttributes().rescueTargetEntityPosition = obj.data.currentEntityPosition
222
              if (point.getAttributes().lineLayer) {
223
                var lineWktStr = 'LINESTRING ( ' + obj.data.currentEntityPosition.longitude + ' ' + obj.data.currentEntityPosition.latitude + ',' + point.getAttributes().rescueEntityPosition.longitude + ' ' + point.getAttributes().rescueEntityPosition.latitude + ')'
224
                console.log(lineWktStr)
225
                point.getAttributes().lineLayer.setPoints(lineWktStr)
214 226
              }
215
              tips = '<div class="' + className + '">' + e.businessTypeZH + '</div>'
216
              other = '<div class="row sos">' +
227
              if (point.popup) {
228
                point.popup.setLatLng([obj.data.currentEntityPosition.latitude, obj.data.currentEntityPosition.longitude])
229
                var e = point.getAttributes()
230
                console.log(e.terminalId)
231
                var tips
232
                var callHelp = ''
233
                var other = ''
234
                var className = 'alarm'
235
                if (e.businessType == '2') {
236
                  className = 'hand-alarm'
237
                } else if (e.businessType == '4') {
238
                  className = 'offline'
239
                }
240
                tips = '<div class="' + className + '">' + e.businessTypeZH + '</div>'
241
                other = '<div class="row sos">' +
217 242
                '<div>求救时间</div>' +
218 243
                '<div>' + e.alarmTime + '</div>' +
219 244
                '</div>' + '<div class="row sos">' +
220 245
                '<div>求救时长</div>' +
221 246
                '<div>' + this.getDurationTime(e.alarmTime) + '</div>' +
222 247
                '</div>'
223
              if (e.isAssignAlarm == '0') {
224
                callHelp = '<div style="display:flex;">' +
248
                if (e.isAssignAlarm == '0') {
249
                  callHelp = '<div style="display:flex;">' +
225 250
                "<button class='point-out' onClick='window.Vue.appoint(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-user-outline'></i>指派</button>" +
226 251
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
227 252
                '</div>'
228
              } else {
229
                callHelp = '<div style="display:flex;justify-content: flex-end;">' +
253
                } else {
254
                  callHelp = '<div style="display:flex;justify-content: flex-end;">' +
230 255
                "<button class='close-confirm' onClick='window.Vue.close(" + e + ")'><i style='font-size: 20px;' class='aidicon aidicon-close'></i>关闭</button>" +
231 256
                '</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">' +
257
                }
258
                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 259
                  '<div>终端编号</div>' +
235 260
                  '<div>' + e.terminalId + '</div>' +
236 261
                  '</div>' +
@ -247,12 +272,14 @@ export default {
247 272
                  '<div>' + e.alarmTime + '</div>' +
248 273
                  '</div></div></div>' + callHelp +
249 274
                  '</div></div>'
250
              point.getAttributes().popup.setContent(content)
275
                point.popup.setContent(content).openOn(this.map)
276
              }
251 277
            }
252
          }
253
          if (!point.getAttributes().rescueEntityPosition) {
254
            if (point.getAttributes().rescueWorkEmployeeRoleId == obj.data.currentEntityPosition.entityId) {
255
              targetPoint = point
278
            if (!point.getAttributes().rescueEntityPosition) {
279
              if (point.getAttributes().rescueWorkEmployeeRoleId == obj.data.currentEntityPosition.entityId) {
280
                flag = false
281
                targetPoint = point
282
              }
256 283
            }
257 284
          }
258 285
        })
@ -342,7 +369,8 @@ export default {
342 369
      point.on('click', (pointE) => {
343 370
        popup.openOn(this.map)
344 371
      })
345
      point.getAttributes().popup = popup
372
      point.target = true
373
      point.popup = popup
346 374
      this.personLayer.addLayer(point)
347 375
      return point
348 376
    },
@ -387,13 +415,22 @@ export default {
387 415
      // 设置弹出框弹出内容
388 416
      popup.setContent(content)
389 417
      popup.openOn(this.map)
390
      point.getAttributes().popup = popup
418
      point.target = false
419
      point.popup = popup
391 420
      point.on('click', (pointE) => {
392 421
        popup.openOn(this.map)
393 422
      })
394 423
      this.personLayer.addLayer(point)
395 424
      return point
396 425
    },
426
    formatDate(date) {
427
      var month = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)
428
      var day = (date.getDate()) < 10 ? '0' + (date.getDate()) : (date.getDate())
429
      var hour = (date.getHours()) < 10 ? '0' + (date.getHours()) : (date.getHours())
430
      var minutes = (date.getMinutes()) < 10 ? '0' + (date.getMinutes()) : (date.getMinutes() + 1)
431
      var seconds = (date.getSeconds()) < 10 ? '0' + (date.getSeconds()) : (date.getSeconds())
432
      return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
433
    },
397 434
    getDurationTime(time) {
398 435
      let date = new Date(time)
399 436
      let diff = (new Date().getTime() - date.getTime()) / 1000