一公司人员定位系统没有人员信息bug修复

pull/11/head
liujun 2024-03-26 10:14:35 +08:00
parent 26e8b67eba
commit 9adaee5a09
1 changed files with 42 additions and 41 deletions

View File

@ -1051,7 +1051,7 @@ export default {
password: '58d06a44d56c4445b4c019492f86ee8d'
},
subscription: {
topic: '1698584148364034050/UwbBQ/+/prop',
topic: '1698584148364034050/+/+/prop',
qos: 0
},
@ -1997,47 +1997,48 @@ export default {
},
mqttMessage(CORP_INFO_ID) {
this.client.on('message', (topic, message) => {
// console.info(message)
// if(this.intOne === 0){
// this.receiveNews = this.receiveNews.concat(message)
// console.log(`Received message ${message} from topic ${topic}`)
const item = JSON.parse(message)
//
const index = this.onePerLocArr.findIndex(item1 => {
return item1.id.toString() === item.deviceCode.toString()
})
const x = item.properties[2].value
const y = item.properties[3].value
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
if (index !== -1) {
this.onePerLocArr[index].x = x
this.onePerLocArr[index].y = y
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
ry_drag.getPosition(this.onePerLocArr[index])
} else {
// const id = '4_0_' +item.deviceCode
const perLoc = {
id: item.deviceCode,
// name: item.realName,
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
// created by liu jun mqtt
let peopleList = JSON.parse(message)
if (!Array.isArray(peopleList)) {
peopleList = [peopleList]
}
for (let i = 0; i < peopleList.length; i++) {
const item = peopleList[i]
//
if (item.properties.length < 3 || item.properties[2].identifier !== 'X' || item.properties[3].identifier !== 'Y') {
continue
}
//
const index = this.onePerLocArr.findIndex(item1 => {
return item1.id.toString() === item.deviceCode.toString()
})
const x = item.properties[2].value
const y = item.properties[3].value
const pointColor = this.isPointxyWithinTheArea(this.pointBox, x, y)
if (index !== -1) {
this.onePerLocArr[index].x = x
this.onePerLocArr[index].y = y
this.onePerLocArr[index].icon_type = 'img4_0' + pointColor
ry_drag.getPosition(this.onePerLocArr[index])
} else {
// const id = '4_0_' +item.deviceCode
const perLoc = {
id: item.deviceCode,
// name: item.realName,
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.intOne++
// } else if(this.intOne < 5){
// this.intOne++
// } else {
// this.intOne = 0
// }
})
},
clearMqttPoint(prefix) {