diff --git a/src/views/map/index.vue b/src/views/map/index.vue index ef45e86..6173650 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -232,7 +232,6 @@ import { animate } from 'motion' import loadMapBoxCfd from './js/mapboxCfd' import loadMapBox from './js/mapbox' import AnquanCfd from './components/anquanCfd' -import { differenceBy, intersectionBy } from 'lodash' import mqtt from 'mqtt' import img4_0_1 from '../../assets/map/gangkou_index/point/icon27.png' import img4_0_2 from '../../assets/map/gangkou_index/point/icon28.png' @@ -772,7 +771,6 @@ export default { cfdDIngweiTimer: '', cfdCarDIngweiTimer: '', perLocArr: [], - perLocArrDiff: [], carLocArr: [], pointBoxCfd: [], pointBox: [], @@ -1178,7 +1176,6 @@ export default { this.dialog.width = dialog_width || '50%' } } else { - console.log(4) this.closeBubbles() } // var cartesian = this.getCatesian3FromPX(movement.position) @@ -1508,7 +1505,6 @@ export default { }, handleClickRightTools(index) { - console.info(index) if (this.rightOptionsList[index].check !== '') this.rightOptionsList[index].check = !this.rightOptionsList[index].check if (index === 0) { if (this.gangkouActive === '00004') { @@ -1677,8 +1673,6 @@ export default { }, bottomOptionsItemsClick(pindex, index, label, urlType, pointUrl, dialog_width) { - console.info(urlType) - console.info(this.CORP_INFO_ID + '-') if (this.bottomOptionsList[pindex].list[index].check || this.gangkouActive === '00004' && this.cfdBottomOptionsList[pindex].list[index].check) { // 人员定位关闭实时获取定位websocket 并关闭人员对比定时器(曹妃甸使用) if (this.gangkouActive === '00004' && urlType === 'peoplePosition') { @@ -1785,7 +1779,7 @@ export default { await this.initColorList() this.isItWithinTheArea() // this.initPerLocWebsocket() - this.timerCfdDingweiPointInit() + this.timerCfdDingweiPoint() } else { this.dragEntity(points, pindex, index) } @@ -1809,7 +1803,7 @@ export default { // } } }, - timerCfdDingweiPointInit() { + timerCfdDingweiPoint() { for (let i = 0; i < this.perLocArr.length; i++) { if (this.perLocArr[i].color === 'red') this.perLocArr[i].icon_type = 'img4_0_1' else if (this.perLocArr[i].color === 'orange') this.perLocArr[i].icon_type = 'img4_0_2' @@ -1818,19 +1812,12 @@ export default { this.perLocArr[i].id = this.perLocArr[i].cardNo this.perLocArr[i].x = this.perLocArr[i].position.x this.perLocArr[i].y = this.perLocArr[i].position.y - ry_drag.addEntity(this.perLocArr[i]) - this.mqttPoint['cfdrydw' + this.perLocArr[i].cardNo] = this.perLocArr[i].cardNo - } - }, - timerCfdDingweiPointUpdate() { - for (let i = 0; i < this.perLocArrDiff.length; i++) { - if (this.perLocArr[i].color === 'red') this.perLocArr[i].icon_type = 'img4_0_1' - else if (this.perLocArr[i].color === 'orange') this.perLocArr[i].icon_type = 'img4_0_2' - else if (this.perLocArr[i].color === 'yellow') this.perLocArr[i].icon_type = 'img4_0_3' - else this.perLocArr[i].icon_type = 'img4_0' - this.perLocArrDiff[i].x = this.perLocArrDiff[i].position.x - this.perLocArrDiff[i].y = this.perLocArrDiff[i].position.y - ry_drag.getPosition(this.perLocArrDiff[i]) + if (this.perLocArr[i].lastTime) { + ry_drag.getPosition(this.perLocArr[i]) + } else { + ry_drag.addEntity(this.perLocArr[i]) + this.mqttPoint['cfdrydw' + this.perLocArr[i].cardNo] = this.perLocArr[i].cardNo + } } }, timerCfdDingwei() { @@ -1886,13 +1873,24 @@ export default { } if (this.perLocArr.length === 0) { this.perLocArr = points + } else { + for (let i = 0; i < points.length; i++) { + let isExist = false + for (let j = 0; j < this.perLocArr.length; j++) { + if (points[i].cardNo === this.perLocArr[j].cardNo) { + this.perLocArr[j].position = points[i].position + isExist = true + break + } + } + if (!isExist) { + this.perLocArr.push(points[i]) + } + } } - this.perLocArrDiff = intersectionBy(this.perLocArr, points, 'cardNo') - this.perLocArr = differenceBy(this.perLocArr, points, 'cardNo') this.isItWithinTheArea() - this.timerCfdDingweiPointInit() - this.timerCfdDingweiPointUpdate() + this.timerCfdDingweiPoint() }) }, 30000) }, @@ -2068,6 +2066,7 @@ export default { const key = prefix ? prefix + this.mqttPoint[mqttPointKey] : mqttPointKey viewer.entities.removeById(this.mqttPoint[key]) this.onePerLocArr = this.onePerLocArr.filter(item => item.data_id !== this.mqttPoint[key]) + delete this.mqttPoint[key] } }, // 订阅 @@ -2438,7 +2437,6 @@ export default { _this.pointBoxCfd.orangeList.forEach(item => { orangeFiled.push(...item['position']) }) const yellowFiled = [] _this.pointBoxCfd.yellowList.forEach(item => { yellowFiled.push(...item['position']) }) - console.info(_this.pointBoxCfd.orangeList) if (this.redList.indexOf(item.cardNo) > -1) { _this.$set(_this.perLocArr[index], 'color', 'red') } else if (redFiled !== [] && _this.forEachIsPointInPolygon(_this.pointBoxCfd.redList, item.position.x, item.position.y)) {