优化人员定位标记点

hyx_temporaryAccess
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: ''
} }
@ -1555,24 +1557,24 @@ export default {
document.addEventListener('contextmenu', function(event) { document.addEventListener('contextmenu', function(event) {
event.preventDefault() event.preventDefault()
}) })
// this.handler.setInputAction(movement => { // this.handler.setInputAction(movement => {
// const pick = viewer.scene.pick(movement.position) // const pick = viewer.scene.pick(movement.position)
// if (Cesium.defined(pick) && (pick.id.id)) { // if (Cesium.defined(pick) && (pick.id.id)) {
// if (!pick.id._monitoItems) { // if (!pick.id._monitoItems) {
// this.removeTrajectory() // this.removeTrajectory()
// return // return
// } // }
// const point_type = pick.id._monitoItems.data.point_type // const point_type = pick.id._monitoItems.data.point_type
// const point_id = pick.id._monitoItems.data.id // const point_id = pick.id._monitoItems.data.id
// const corpInfoId = pick.id._monitoItems.data.corpInfoId // const corpInfoId = pick.id._monitoItems.data.corpInfoId
// if (point_type === 'peoplePositionOne') { // if (point_type === 'peoplePositionOne') {
// this.removeTrajectory() // this.removeTrajectory()
// this.addTrajectory(point_id, corpInfoId) // this.addTrajectory(point_id, corpInfoId)
// } // }
// } else { // } else {
// this.removeTrajectory() // this.removeTrajectory()
// } // }
// }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) // }, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
}, },
addTrajectory() { addTrajectory() {
this.removeTrajectory() this.removeTrajectory()
@ -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) {
@ -1677,11 +1679,11 @@ export default {
transformWGS84ToCartesian: function(position, alt) { transformWGS84ToCartesian: function(position, alt) {
// eslint-disable-next-line no-return-assign // eslint-disable-next-line no-return-assign
return position ? Cesium.Cartesian3.fromDegrees( return position ? Cesium.Cartesian3.fromDegrees(
position.lng || position.lon, position.lng || position.lon,
position.lat, position.lat,
position.alt = alt || position.alt, position.alt = alt || position.alt,
Cesium.Ellipsoid.WGS84 Cesium.Ellipsoid.WGS84
) )
: Cesium.Cartesian3.ZERO : Cesium.Cartesian3.ZERO
}, },
closeBubbles() { closeBubbles() {
@ -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()
} }
} }
}, },
@ -3067,12 +3072,12 @@ export default {
if (decodedStr) { if (decodedStr) {
// const perTrack = JSON.parse(decodedStr) // const perTrack = JSON.parse(decodedStr)
const perTrack = { 'msg': '000', 'data': [ const perTrack = { 'msg': '000', 'data': [
'8905,118.50022313549867,38.92716921306408,-88.96163116878053,0.15,8905,测试工单', '8905,118.50022313549867,38.92716921306408,-88.96163116878053,0.15,8905,测试工单',
'8001,118.5044033058593,38.926660124965956,-88.96163116878053,0.15,8001,张悦', '8001,118.5044033058593,38.926660124965956,-88.96163116878053,0.15,8001,张悦',
'8002,118.48886198164132,38.916885738277635,-88.96163116878053,0.15,8002,齐津铖', '8002,118.48886198164132,38.916885738277635,-88.96163116878053,0.15,8002,齐津铖',
'8003,118.50289308906841,38.92012841170512,-88.96163116878053,0.15,8003,白伟', '8003,118.50289308906841,38.92012841170512,-88.96163116878053,0.15,8003,白伟',
'8004,118.48820877892216,38.91690951376236,-88.96163116878053,0.15,8004,孙海官' '8004,118.48820877892216,38.91690951376236,-88.96163116878053,0.15,8004,孙海官'
] } ] }
if (perTrack.msg === '000' && perTrack.data && perTrack.data.length > 0) { if (perTrack.msg === '000' && perTrack.data && perTrack.data.length > 0) {
perTrack.data.forEach(item => { perTrack.data.forEach(item => {
const newPos = item.split(',') const newPos = item.split(',')
@ -3743,38 +3748,38 @@ export default {
transform: translateY(0); transform: translateY(0);
} }
} }
.people_trajectory{ .people_trajectory{
position: absolute; position: absolute;
top: -60px; top: -60px;
left: 0; left: 0;
width: 400px; width: 400px;
padding: 10px; padding: 10px;
background-image: linear-gradient(to right, rgb(31 62 129 / 57%) 0%, rgb(17 93 255 / 40%) 50%, rgb(31 62 129 / 57%) 100%); background-image: linear-gradient(to right, rgb(31 62 129 / 57%) 0%, rgb(17 93 255 / 40%) 50%, rgb(31 62 129 / 57%) 100%);
.search_btn{ .search_btn{
background-color: #1563e3; background-color: #1563e3;
color: #fff; color: #fff;
border-color: #1563e3; border-color: #1563e3;
}
.reset_btn{
background-color: #558be5;
color: #fff;
border-color: #558be5;
}
} }
.reset_btn{
background-color: #558be5;
color: #fff;
border-color: #558be5;
}
}
</style> </style>
<style> <style>
.cesium-viewer-toolbar, .cesium-viewer-fullscreenContainer, .cesium-infoBox-visible { .cesium-viewer-toolbar, .cesium-viewer-fullscreenContainer, .cesium-infoBox-visible {
display: none !important; display: none !important;
} }
.people_trajectory .el-input__inner{ .people_trajectory .el-input__inner{
background-color: #100693 !important; background-color: #100693 !important;
border-color: #100693 !important; border-color: #100693 !important;
color: #fff !important; color: #fff !important;
} }
.people_trajectory_select{ .people_trajectory_select{
background-color: #100693 !important; background-color: #100693 !important;
border-color: #100693 !important; border-color: #100693 !important;
} }
.people_trajectory_select .el-select-dropdown__item{ .people_trajectory_select .el-select-dropdown__item{
color: #fff !important; color: #fff !important;
} }