优化人员定位标记点

pet
1261008090@qq.com 2024-10-30 14:35:27 +08:00
parent d140f7b27b
commit c85d5a5466
1 changed files with 88 additions and 83 deletions

View File

@ -93,11 +93,11 @@
:corp-info-id="CORP_INFO_ID" :corp-info-id="CORP_INFO_ID"
:area="area" :area="area"
:gangkou="gangkouActive"/> :gangkou="gangkouActive"/>
<renyuan <!-- <renyuan-->
v-if="gangkouActive && gangkouActive !== '00004' && gangkouActive !== '00002' && gangkouActive !== '00005' && bottomOptionsIndex === 4" <!-- v-if="gangkouActive && gangkouActive !== '00004' && gangkouActive !== '00002' && gangkouActive !== '00005' && bottomOptionsIndex === 4"-->
:corp-info-id="CORP_INFO_ID" <!-- :corp-info-id="CORP_INFO_ID"-->
:area="area" <!-- :area="area"-->
:gangkou="gangkouActive"/> <!-- :gangkou="gangkouActive"/>-->
<renyuan-cfd <renyuan-cfd
v-if="gangkouActive && gangkouActive === '00004' && bottomOptionsIndex === 1" v-if="gangkouActive && gangkouActive === '00004' && bottomOptionsIndex === 1"
:corp-info-id="CORP_INFO_ID" :corp-info-id="CORP_INFO_ID"
@ -226,8 +226,8 @@
leave-active-class="animate__animated animate__fadeOutUp" leave-active-class="animate__animated animate__fadeOutUp"
> >
<div v-if="isPeopleTrajectory" class="people_trajectory"> <div v-if="isPeopleTrajectory" class="people_trajectory">
<el-select v-model="peopleTrajectoryValue" popper-class="people_trajectory_select"> <el-select v-model="peopleTrajectoryValue" popper-class="people_trajectory_select" filterable>
<el-option v-for="item in onePerLocArr" :key="item.id" :value="item.id" :label="item.id"/> <el-option v-for="item in onePerLocArr" :key="item.id" :value="item.id" :label="item.name || item.id"/>
</el-select> </el-select>
<el-button class="search_btn" @click="addTrajectory"></el-button> <el-button class="search_btn" @click="addTrajectory"></el-button>
<el-button class="reset_btn" @click="()=>{removeTrajectory();peopleTrajectoryValue = ''}">重置</el-button> <el-button class="reset_btn" @click="()=>{removeTrajectory();peopleTrajectoryValue = ''}">重置</el-button>
@ -326,6 +326,8 @@ var PI = 3.1415926535897932384626
var a = 6378245.0 // var a = 6378245.0 //
var ee = 0.00669342162296594323 // 椭球的偏心率。//判断是否在国内在中国国内的经纬度才需要做偏移 var ee = 0.00669342162296594323 // 椭球的偏心率。//判断是否在国内在中国国内的经纬度才需要做偏移
const iframeObj = null const iframeObj = null
const mqttPoint = {}
let trajectoryEntityCollection = {}
export default { export default {
components: { components: {
AnquanCfd, AnquanCfd,
@ -478,7 +480,7 @@ export default {
], ],
myEntityCollection: {}, myEntityCollection: {},
poinEntity: {}, poinEntity: {},
mqttPoint: {}, // mqttPoint: {},
allOrientationPoint: [], allOrientationPoint: [],
gangkouActive: '', gangkouActive: '',
centerOptionsList: [ centerOptionsList: [
@ -1247,7 +1249,7 @@ export default {
linkPort: '8093', linkPort: '8093',
VIIDPort: '8088' VIIDPort: '8088'
}, },
trajectoryEntityCollection: {}, // trajectoryEntityCollection: {},
isPeopleTrajectory: false, isPeopleTrajectory: false,
peopleTrajectoryValue: '' peopleTrajectoryValue: ''
} }
@ -1595,14 +1597,14 @@ export default {
const collection = new Cesium.CustomDataSource('trajectoryEntityCollection') const collection = new Cesium.CustomDataSource('trajectoryEntityCollection')
collection.entities.add(entity) collection.entities.add(entity)
viewer.dataSources.add(collection) viewer.dataSources.add(collection)
this.trajectoryEntityCollection = collection trajectoryEntityCollection = collection
} }
}) })
}, },
removeTrajectory() { removeTrajectory() {
if (Object.keys(this.trajectoryEntityCollection).length === 0) return if (Object.keys(trajectoryEntityCollection).length === 0) return
viewer.dataSources.remove(this.trajectoryEntityCollection) viewer.dataSources.remove(trajectoryEntityCollection)
this.trajectoryEntityCollection = {} trajectoryEntityCollection = {}
}, },
getCatesian3FromPX: function(px) { getCatesian3FromPX: function(px) {
@ -2361,7 +2363,7 @@ export default {
} else { } else {
ry_drag.addEntity(this.perLocArr[i]) ry_drag.addEntity(this.perLocArr[i])
this.mqttPoint['cfdrydw' + this.perLocArr[i].cardNo] = this.perLocArr[i].cardNo mqttPoint['cfdrydw' + this.perLocArr[i].cardNo] = this.perLocArr[i].cardNo
} }
} }
}, },
@ -2715,7 +2717,7 @@ export default {
czksPerLoc.push(perLoc) czksPerLoc.push(perLoc)
ry_drag.addEntity(perLoc) ry_drag.addEntity(perLoc)
var qianzhui = 'czksperson' var qianzhui = 'czksperson'
_this.mqttPoint[qianzhui + item.cardId] = item.cardId mqttPoint[qianzhui + item.cardId] = item.cardId
} }
} }
// ninePerLocArr // ninePerLocArr
@ -2788,7 +2790,7 @@ export default {
} }
this.onePerLocArr.push(perLoc) this.onePerLocArr.push(perLoc)
ry_drag.addEntity(perLoc) ry_drag.addEntity(perLoc)
this.mqttPoint[this.subscription.topic.substring(0, this.subscription.topic.lastIndexOf('+')) + item.deviceCode] = item.deviceCode mqttPoint[this.subscription.topic.substring(0, this.subscription.topic.lastIndexOf('+')) + item.deviceCode] = item.deviceCode
} }
} }
} else if (topic.indexOf('alarm') !== -1) { } else if (topic.indexOf('alarm') !== -1) {
@ -2803,20 +2805,20 @@ export default {
}) })
}, },
clearMqttPoint(prefix) { clearMqttPoint(prefix) {
for (const mqttPointKey in this.mqttPoint) { for (const mqttPointKey in mqttPoint) {
const key = prefix ? prefix + this.mqttPoint[mqttPointKey] : mqttPointKey const key = prefix ? prefix + mqttPoint[mqttPointKey] : mqttPointKey
viewer.entities.removeById(this.mqttPoint[key]) viewer.entities.removeById(mqttPoint[key])
this.onePerLocArr = this.onePerLocArr.filter(item => item.data_id !== this.mqttPoint[key]) this.onePerLocArr = this.onePerLocArr.filter(item => item.data_id !== mqttPoint[key])
delete this.mqttPoint[key] delete mqttPoint[key]
} }
}, },
clearRYDWPoint(prefix) { clearRYDWPoint(prefix) {
this.fwebsocket.close() this.fwebsocket.close()
for (const mqttPointKey in this.mqttPoint) { for (const mqttPointKey in mqttPoint) {
const key = prefix ? prefix + this.mqttPoint[mqttPointKey] : mqttPointKey const key = prefix ? prefix + mqttPoint[mqttPointKey] : mqttPointKey
viewer.entities.removeById(this.mqttPoint[key]) viewer.entities.removeById(mqttPoint[key])
this.onePerLocArr = this.onePerLocArr.filter(item => item.data_id !== this.mqttPoint[key]) this.onePerLocArr = this.onePerLocArr.filter(item => item.data_id !== mqttPoint[key])
delete this.mqttPoint[key] delete mqttPoint[key]
} }
}, },
// //
@ -2999,8 +3001,9 @@ export default {
_this.fwebsocket = new WebSocket(encodeURI(wsUrl)) _this.fwebsocket = new WebSocket(encodeURI(wsUrl))
_this.fwebsocket.onmessage = function(message) { _this.fwebsocket.onmessage = function(message) {
console.info('接收消息') console.info('接收消息')
const peopleList = JSON.parse(message.data).data.data const peopleList = JSON.parse(message.data)
console.log(peopleList) console.log(peopleList)
viewer.entities.suspendEvents()
for (let i = 0; i < peopleList.length; i++) { for (let i = 0; i < peopleList.length; i++) {
const item = peopleList[i] const item = peopleList[i]
if ((!item)) continue if ((!item)) continue
@ -3019,6 +3022,7 @@ export default {
} else { } else {
const perLoc = { const perLoc = {
id: item.id, id: item.id,
name: item.name,
x: x, x: x,
y: y, y: y,
icon_type: 'img4_0' + pointColor, icon_type: 'img4_0' + pointColor,
@ -3029,9 +3033,10 @@ export default {
} }
_this.onePerLocArr.push(perLoc) _this.onePerLocArr.push(perLoc)
ry_drag.addEntity(perLoc) ry_drag.addEntity(perLoc)
_this.mqttPoint[_this.subscription.topic.substring(0, _this.subscription.topic.lastIndexOf('+')) + item.id] = item.id mqttPoint[_this.subscription.topic.substring(0, _this.subscription.topic.lastIndexOf('+')) + item.id] = item.id
} }
} }
viewer.entities.resumeEvents()
} }
} }
}, },