人员轨迹、报警信息
parent
35500daad3
commit
c912472911
|
@ -1052,6 +1052,7 @@ export default {
|
||||||
},
|
},
|
||||||
subscription: {
|
subscription: {
|
||||||
topic: '+/UwbBQ/+/prop',
|
topic: '+/UwbBQ/+/prop',
|
||||||
|
topic1: '+/+/+/alarm',
|
||||||
qos: 0
|
qos: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1072,7 +1073,8 @@ export default {
|
||||||
CORP_INFO_ID: '',
|
CORP_INFO_ID: '',
|
||||||
longitude: '',
|
longitude: '',
|
||||||
latitude: ''
|
latitude: ''
|
||||||
}
|
},
|
||||||
|
trajectoryEntityCollection: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -1183,6 +1185,58 @@ export default {
|
||||||
this.closeBubbles()
|
this.closeBubbles()
|
||||||
}
|
}
|
||||||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
|
||||||
|
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_DOUBLE_CLICK)
|
||||||
|
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK)
|
||||||
|
document.addEventListener('contextmenu', function(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
})
|
||||||
|
this.handler.setInputAction(movement => {
|
||||||
|
const pick = viewer.scene.pick(movement.position)
|
||||||
|
if (Cesium.defined(pick) && (pick.id.id)) {
|
||||||
|
if (!pick.id._monitoItems) {
|
||||||
|
this.removeTrajectory()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const point_type = pick.id._monitoItems.data.point_type
|
||||||
|
const point_id = pick.id._monitoItems.data.id
|
||||||
|
const corpInfoId = pick.id._monitoItems.data.corpInfoId
|
||||||
|
if (point_type === '标记点peoplePositionOne') {
|
||||||
|
this.removeTrajectory()
|
||||||
|
this.addTrajectory(point_id, corpInfoId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.removeTrajectory()
|
||||||
|
}
|
||||||
|
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
|
||||||
|
},
|
||||||
|
addTrajectory(point_id, corpInfoId) {
|
||||||
|
requestFN(
|
||||||
|
'/map/getPersonTrace',
|
||||||
|
{
|
||||||
|
id: point_id,
|
||||||
|
corpId: corpInfoId
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
if (data.list) {
|
||||||
|
const positions = []
|
||||||
|
for (let i = 0; i < data.list.length; i++) {
|
||||||
|
positions.push(Cesium.Cartesian3.fromDegrees(data.list[i].XAxis, data.list[i].YAxis))
|
||||||
|
}
|
||||||
|
const entity = new Cesium.Entity({
|
||||||
|
id: 'trajectory',
|
||||||
|
polyline: { positions, width: 5.0, material: Cesium.Color.RED }
|
||||||
|
})
|
||||||
|
const collection = new Cesium.CustomDataSource('trajectoryEntityCollection')
|
||||||
|
collection.entities.add(entity)
|
||||||
|
viewer.dataSources.add(collection)
|
||||||
|
this.trajectoryEntityCollection = collection
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removeTrajectory() {
|
||||||
|
if (Object.keys(this.trajectoryEntityCollection).length === 0) return
|
||||||
|
viewer.dataSources.remove(this.trajectoryEntityCollection)
|
||||||
|
this.trajectoryEntityCollection = {}
|
||||||
},
|
},
|
||||||
|
|
||||||
getCatesian3FromPX: function(px) {
|
getCatesian3FromPX: function(px) {
|
||||||
|
@ -1520,6 +1574,7 @@ export default {
|
||||||
this.destroyConnection()
|
this.destroyConnection()
|
||||||
this.clearAllBottomOptionsItemsCheck()
|
this.clearAllBottomOptionsItemsCheck()
|
||||||
this.clearAllBottomOptionsItemsEntityCollection()
|
this.clearAllBottomOptionsItemsEntityCollection()
|
||||||
|
this.removeTrajectory()
|
||||||
this.onePerLocArr = []
|
this.onePerLocArr = []
|
||||||
this.perLocArr = []
|
this.perLocArr = []
|
||||||
this.clearMqttPoint()
|
this.clearMqttPoint()
|
||||||
|
@ -1562,6 +1617,7 @@ export default {
|
||||||
this.addBranchPoint()
|
this.addBranchPoint()
|
||||||
this.clearAllBottomOptionsItemsCheck()
|
this.clearAllBottomOptionsItemsCheck()
|
||||||
this.clearAllBottomOptionsItemsEntityCollection()
|
this.clearAllBottomOptionsItemsEntityCollection()
|
||||||
|
this.removeTrajectory()
|
||||||
},
|
},
|
||||||
bottomOptionsClick(index) {
|
bottomOptionsClick(index) {
|
||||||
if (this.bottomClickDisable) return
|
if (this.bottomClickDisable) return
|
||||||
|
@ -1631,6 +1687,7 @@ export default {
|
||||||
} else if (this.CORP_INFO_ID) {
|
} else if (this.CORP_INFO_ID) {
|
||||||
this.CORP_INFO_ID = ''
|
this.CORP_INFO_ID = ''
|
||||||
this.clearAllBottomOptionsItemsEntityCollection()
|
this.clearAllBottomOptionsItemsEntityCollection()
|
||||||
|
this.removeTrajectory()
|
||||||
this.dragAreaEntity(this.branchPoint)
|
this.dragAreaEntity(this.branchPoint)
|
||||||
this.toCenter(this.parentCenter)
|
this.toCenter(this.parentCenter)
|
||||||
this.destroyConnection()
|
this.destroyConnection()
|
||||||
|
@ -1675,7 +1732,8 @@ export default {
|
||||||
}
|
}
|
||||||
if (this.gangkouActive === '00003' && this.CORP_INFO_ID === '035958e685cf4850bc40151c5e0617a6' && urlType === 'peoplePosition') {
|
if (this.gangkouActive === '00003' && this.CORP_INFO_ID === '035958e685cf4850bc40151c5e0617a6' && urlType === 'peoplePosition') {
|
||||||
this.doUnSubscribe()
|
this.doUnSubscribe()
|
||||||
this.clearMqttPoint('1698584148364034050/UwbBQ/')
|
this.clearMqttPoint('+/UwbBQ/')
|
||||||
|
this.removeTrajectory()
|
||||||
}
|
}
|
||||||
this.bottomOptionsList[pindex].list[index].check = false
|
this.bottomOptionsList[pindex].list[index].check = false
|
||||||
if (this.gangkouActive === '00004') {
|
if (this.gangkouActive === '00004') {
|
||||||
|
@ -1997,48 +2055,58 @@ export default {
|
||||||
},
|
},
|
||||||
mqttMessage(CORP_INFO_ID) {
|
mqttMessage(CORP_INFO_ID) {
|
||||||
this.client.on('message', (topic, message) => {
|
this.client.on('message', (topic, message) => {
|
||||||
|
if (topic.indexOf('UwbBQ') !== -1 && topic.indexOf('prop') !== -1) {
|
||||||
// created by liu jun mqtt返回的参数可能是一个数组
|
// created by liu jun mqtt返回的参数可能是一个数组
|
||||||
let peopleList = JSON.parse(message)
|
let peopleList = JSON.parse(message)
|
||||||
if (!Array.isArray(peopleList)) {
|
if (!Array.isArray(peopleList)) {
|
||||||
peopleList = [peopleList]
|
peopleList = [peopleList]
|
||||||
}
|
|
||||||
for (let i = 0; i < peopleList.length; i++) {
|
|
||||||
const item = peopleList[i]
|
|
||||||
// 如果不是人员信息则跳过
|
|
||||||
// UwbBQ是人员定位卡的id(UwbJiZhan这是基站的id)
|
|
||||||
if (item.productKey !== 'UwbBQ') {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
// 将地图上剩余的点与最新的定位人员点进行对比 更新地图上已存在的点 新增地图上之前没有的点
|
for (let i = 0; i < peopleList.length; i++) {
|
||||||
const index = this.onePerLocArr.findIndex(item1 => {
|
const item = peopleList[i]
|
||||||
return item1.id.toString() === item.deviceCode.toString()
|
// 如果不是人员信息则跳过
|
||||||
})
|
// UwbBQ是人员定位卡的id(UwbJiZhan这是基站的id)
|
||||||
const x = item.properties[2].value
|
if (item.productKey !== 'UwbBQ') {
|
||||||
const y = item.properties[3].value
|
continue
|
||||||
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
|
}
|
||||||
if (index !== -1) {
|
// 将地图上剩余的点与最新的定位人员点进行对比 更新地图上已存在的点 新增地图上之前没有的点
|
||||||
this.onePerLocArr[index].x = x
|
const index = this.onePerLocArr.findIndex(item1 => {
|
||||||
this.onePerLocArr[index].y = y
|
return item1.id.toString() === item.deviceCode.toString()
|
||||||
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
|
})
|
||||||
ry_drag.getPosition(this.onePerLocArr[index])
|
const x = item.properties[2].value
|
||||||
} else {
|
const y = item.properties[3].value
|
||||||
// const id = '4_0_' +item.deviceCode
|
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
|
||||||
const perLoc = {
|
if (index !== -1) {
|
||||||
id: item.deviceCode,
|
this.onePerLocArr[index].x = x
|
||||||
// name: item.realName,
|
this.onePerLocArr[index].y = y
|
||||||
x: x,
|
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
|
||||||
y: y,
|
ry_drag.getPosition(this.onePerLocArr[index])
|
||||||
icon_type: 'img4_0' + pointColor,
|
} else {
|
||||||
// infoname: item.realName,
|
// const id = '4_0_' +item.deviceCode
|
||||||
data_id: item.deviceCode,
|
const perLoc = {
|
||||||
point_type: '标记点peoplePositionOne',
|
id: item.deviceCode,
|
||||||
label: '人员定位',
|
// name: item.realName,
|
||||||
corpInfoId: CORP_INFO_ID
|
x: x,
|
||||||
|
y: y,
|
||||||
|
icon_type: 'img4_0' + pointColor,
|
||||||
|
// infoname: item.realName,
|
||||||
|
data_id: item.deviceCode,
|
||||||
|
point_type: '标记点peoplePositionOne',
|
||||||
|
label: '人员定位',
|
||||||
|
corpInfoId: CORP_INFO_ID
|
||||||
|
}
|
||||||
|
this.onePerLocArr.push(perLoc)
|
||||||
|
ry_drag.addEntity(perLoc)
|
||||||
|
this.mqttPoint[this.subscription.topic.substring(0, this.subscription.topic.lastIndexOf('+')) + item.deviceCode] = item.deviceCode
|
||||||
}
|
}
|
||||||
this.onePerLocArr.push(perLoc)
|
|
||||||
ry_drag.addEntity(perLoc)
|
|
||||||
this.mqttPoint[this.subscription.topic.substring(0, this.subscription.topic.lastIndexOf('+')) + item.deviceCode] = item.deviceCode
|
|
||||||
}
|
}
|
||||||
|
} else if (topic.indexOf('alarm') !== -1) {
|
||||||
|
const formatMessage = JSON.parse(message)
|
||||||
|
this.$notify({
|
||||||
|
title: '报警信息',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: `部门:${formatMessage.deptName}<br/>类型:${formatMessage.identifierName}`,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -2052,8 +2120,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 订阅
|
// 订阅
|
||||||
doSubscribe() {
|
doSubscribe() {
|
||||||
const { topic, qos } = this.subscription
|
const { topic, topic1, qos } = this.subscription
|
||||||
this.client.subscribe(topic, { qos }, (error, res) => {
|
this.client.subscribe([topic, topic1], { qos }, (error, res) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log('Subscribe to topics error', error)
|
console.log('Subscribe to topics error', error)
|
||||||
return
|
return
|
||||||
|
@ -2064,8 +2132,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 取消订阅
|
// 取消订阅
|
||||||
doUnSubscribe() {
|
doUnSubscribe() {
|
||||||
const { topic } = this.subscription
|
const { topic, topic1 } = this.subscription
|
||||||
this.client.unsubscribe(topic, error => {
|
this.client.unsubscribe([topic, topic1], error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log('Subscribe to topics error', error)
|
console.log('Subscribe to topics error', error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue