一公司人员定位系统没有人员信息bug修复
parent
87ef70fcbe
commit
47d48eebb3
|
@ -1105,7 +1105,7 @@ export default {
|
||||||
password: '58d06a44d56c4445b4c019492f86ee8d'
|
password: '58d06a44d56c4445b4c019492f86ee8d'
|
||||||
},
|
},
|
||||||
subscription: {
|
subscription: {
|
||||||
topic: '1698584148364034050/UwbBQ/+/prop',
|
topic: '1698584148364034050/+/+/prop',
|
||||||
qos: 0
|
qos: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2519,47 +2519,45 @@ export default {
|
||||||
},
|
},
|
||||||
mqttMessage(CORP_INFO_ID) {
|
mqttMessage(CORP_INFO_ID) {
|
||||||
this.client.on('message', (topic, message) => {
|
this.client.on('message', (topic, message) => {
|
||||||
// console.info(message)
|
// created by liu jun mqtt返回的参数可能是一个数组
|
||||||
// if(this.intOne === 0){
|
let peopleList = JSON.parse(message)
|
||||||
// this.receiveNews = this.receiveNews.concat(message)
|
if (!Array.isArray(peopleList)) {
|
||||||
// console.log(`Received message ${message} from topic ${topic}`)
|
peopleList = [peopleList]
|
||||||
const item = JSON.parse(message)
|
}
|
||||||
// 将地图上剩余的点与最新的定位人员点进行对比 更新地图上已存在的点 新增地图上之前没有的点
|
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()
|
// 如果不是人员信息则跳过
|
||||||
})
|
if (item.properties.length < 3 || item.properties[2].identifier !== 'X' || item.properties[3].identifier !== 'Y') {
|
||||||
const x = item.properties[2].value
|
continue
|
||||||
const y = item.properties[3].value
|
}
|
||||||
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
|
// 将地图上剩余的点与最新的定位人员点进行对比更新地图上已存在的点新增地图上之前没有的点
|
||||||
if (index !== -1) {
|
const index = this.onePerLocArr.findIndex(item1 => {
|
||||||
this.onePerLocArr[index].x = x
|
return item1.id.toString() === item.deviceCode.toString()
|
||||||
this.onePerLocArr[index].y = y
|
})
|
||||||
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
|
const x = item.properties[2].value
|
||||||
ry_drag.getPosition(this.onePerLocArr[index])
|
const y = item.properties[3].value
|
||||||
} else {
|
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
|
||||||
// const id = '4_0_' +item.deviceCode
|
if (index !== -1) {
|
||||||
const perLoc = {
|
this.onePerLocArr[index].x = x
|
||||||
id: item.deviceCode,
|
this.onePerLocArr[index].y = y
|
||||||
// name: item.realName,
|
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
|
||||||
x: x,
|
ry_drag.getPosition(this.onePerLocArr[index])
|
||||||
y: y,
|
} else {
|
||||||
icon_type: 'img4_0' + pointColor,
|
const perLoc = {
|
||||||
// infoname: item.realName,
|
id: item.deviceCode,
|
||||||
data_id: item.deviceCode,
|
x: x,
|
||||||
point_type: '标记点peoplePositionOne',
|
y: y,
|
||||||
label: '人员定位',
|
icon_type: 'img4_0' + pointColor,
|
||||||
corpInfoId: CORP_INFO_ID
|
data_id: item.deviceCode,
|
||||||
}
|
point_type: '标记点peoplePositionOne',
|
||||||
this.onePerLocArr.push(perLoc)
|
label: '人员定位',
|
||||||
ry_drag.addEntity(perLoc)
|
corpInfoId: CORP_INFO_ID
|
||||||
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// this.intOne++
|
|
||||||
// } else if(this.intOne < 5){
|
|
||||||
// this.intOne++
|
|
||||||
// } else {
|
|
||||||
// this.intOne = 0
|
|
||||||
// }
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
clearMqttPoint(prefix) {
|
clearMqttPoint(prefix) {
|
||||||
|
|
Loading…
Reference in New Issue