From 6dbd709ab0a0f17f1b27790971be864f64bca606 Mon Sep 17 00:00:00 2001 From: LiuJiaNan Date: Tue, 16 Apr 2024 11:51:53 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=BD=A8=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/index.vue | 53 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/src/views/map/index.vue b/src/views/map/index.vue index 86b2360..f36f9c3 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -1116,6 +1116,7 @@ export default { }, subscription: { // '+'是通配符 + // topic: '+/+/+/alarm', topic: '+/UwbBQ/+/prop', qos: 0 }, @@ -1143,7 +1144,8 @@ export default { vmport: '7010', linkPort: '8093', VIIDPort: '8088' - } + }, + trajectoryEntityCollection: {} } }, mounted() { @@ -1466,6 +1468,50 @@ export default { } // var cartesian = this.getCatesian3FromPX(movement.position) }, Cesium.ScreenSpaceEventType.LEFT_CLICK) + this.handler.setInputAction(movement => { + const pick = viewer.scene.pick(movement.position) + if (Cesium.defined(pick) && (pick.id.id)) { + if (!pick.id._monitoItems) { + this.removeTrajectory() + return + } + const point_type = pick.id._monitoItems.data.point_type + const point_id = pick.id._monitoItems.data.id + const corpInfoId = pick.id._monitoItems.data.corpInfoId + if (point_type === '标记点peoplePositionOne') { + this.addTrajectory(point_id, corpInfoId) + } + } else { + this.removeTrajectory() + } + }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) + }, + addTrajectory(point_id, corpInfoId) { + requestFN( + '/map/getPersonTrace', + { + id: point_id, + corpId: corpInfoId + } + ).then((data) => { + console.log(data.list) + const positions = [] + for (let i = 0; i < data.list.length; i++) { + positions.push(Cesium.Cartesian3.fromDegrees(data.list[i].XAxis, data.list[i].YAxis)) + } + const entity = new Cesium.Entity({ + id: 'trajectory', + polyline: { positions, width: 5.0, material: Cesium.Color.RED } + }) + const collection = new Cesium.CustomDataSource('trajectoryEntityCollection') + collection.entities.add(entity) + viewer.dataSources.add(collection) + this.trajectoryEntityCollection = collection + }) + }, + removeTrajectory() { + viewer.dataSources.remove(this.trajectoryEntityCollection) + this.trajectoryEntityCollection = {} }, getCatesian3FromPX: function(px) { @@ -1820,6 +1866,7 @@ export default { this.destroyConnection() this.clearAllBottomOptionsItemsCheck() this.clearAllBottomOptionsItemsEntityCollection() + this.removeTrajectory() this.onePerLocArr = [] this.perLocArr = [] this.clearMqttPoint() @@ -1864,6 +1911,7 @@ export default { this.addBranchPoint() this.clearAllBottomOptionsItemsCheck() this.clearAllBottomOptionsItemsEntityCollection() + this.removeTrajectory() }, bottomOptionsClick(index) { if (this.bottomClickDisable) return @@ -1938,6 +1986,7 @@ export default { } else if (this.CORP_INFO_ID) { this.CORP_INFO_ID = '' this.clearAllBottomOptionsItemsEntityCollection() + this.removeTrajectory() this.dragAreaEntity(this.branchPoint) this.toCenter(this.parentCenter) this.destroyConnection() @@ -2010,7 +2059,7 @@ export default { } if (this.gangkouActive === '00003' && this.CORP_INFO_ID === '035958e685cf4850bc40151c5e0617a6' && urlType === 'peoplePosition') { this.doUnSubscribe() - this.clearMqttPoint('1698584148364034050/UwbBQ/') + this.clearMqttPoint('+/UwbBQ/') } this.bottomOptionsList[pindex].list[index].check = false if (this.gangkouActive === '00004') { From c863afb393578b29a80cf1197a6c5ef20061ba4a Mon Sep 17 00:00:00 2001 From: LiuJiaNan Date: Tue, 16 Apr 2024 14:07:33 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=BD=A8=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/views/map/index.vue b/src/views/map/index.vue index f36f9c3..fe409e2 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -1468,6 +1468,11 @@ export default { } // var cartesian = this.getCatesian3FromPX(movement.position) }, Cesium.ScreenSpaceEventType.LEFT_CLICK) + viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_DOUBLE_CLICK) + viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK) + document.addEventListener('contextmenu', function(event) { + event.preventDefault() + }) this.handler.setInputAction(movement => { const pick = viewer.scene.pick(movement.position) if (Cesium.defined(pick) && (pick.id.id)) { @@ -2060,6 +2065,7 @@ export default { if (this.gangkouActive === '00003' && this.CORP_INFO_ID === '035958e685cf4850bc40151c5e0617a6' && urlType === 'peoplePosition') { this.doUnSubscribe() this.clearMqttPoint('+/UwbBQ/') + this.removeTrajectory() } this.bottomOptionsList[pindex].list[index].check = false if (this.gangkouActive === '00004') { From 718756ad841386cb6d3eab3b5ae5a8eb2a09c010 Mon Sep 17 00:00:00 2001 From: LiuJiaNan Date: Tue, 16 Apr 2024 15:30:10 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/index.vue | 119 ++++++++++++++++++++++------------------ 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/src/views/map/index.vue b/src/views/map/index.vue index fe409e2..194373d 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -1116,8 +1116,8 @@ export default { }, subscription: { // '+'是通配符 - // topic: '+/+/+/alarm', topic: '+/UwbBQ/+/prop', + topic1: '+/+/+/alarm', qos: 0 }, @@ -1484,6 +1484,7 @@ export default { const point_id = pick.id._monitoItems.data.id const corpInfoId = pick.id._monitoItems.data.corpInfoId if (point_type === '标记点peoplePositionOne') { + this.removeTrajectory() this.addTrajectory(point_id, corpInfoId) } } else { @@ -1499,22 +1500,24 @@ export default { corpId: corpInfoId } ).then((data) => { - console.log(data.list) - const positions = [] - for (let i = 0; i < data.list.length; i++) { - positions.push(Cesium.Cartesian3.fromDegrees(data.list[i].XAxis, data.list[i].YAxis)) + if (data.list) { + const positions = [] + for (let i = 0; i < data.list.length; i++) { + positions.push(Cesium.Cartesian3.fromDegrees(data.list[i].XAxis, data.list[i].YAxis)) + } + const entity = new Cesium.Entity({ + id: 'trajectory', + polyline: { positions, width: 5.0, material: Cesium.Color.RED } + }) + const collection = new Cesium.CustomDataSource('trajectoryEntityCollection') + collection.entities.add(entity) + viewer.dataSources.add(collection) + this.trajectoryEntityCollection = collection } - const entity = new Cesium.Entity({ - id: 'trajectory', - polyline: { positions, width: 5.0, material: Cesium.Color.RED } - }) - const collection = new Cesium.CustomDataSource('trajectoryEntityCollection') - collection.entities.add(entity) - viewer.dataSources.add(collection) - this.trajectoryEntityCollection = collection }) }, removeTrajectory() { + if (Object.keys(this.trajectoryEntityCollection).length === 0) return viewer.dataSources.remove(this.trajectoryEntityCollection) this.trajectoryEntityCollection = {} }, @@ -2584,45 +2587,55 @@ export default { }, mqttMessage(CORP_INFO_ID) { this.client.on('message', (topic, message) => { - // 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] - // 如果不是人员信息则跳过 - // UwbBQ是人员定位卡的id(UwbJiZhan这是基站的id) - if (item.productKey !== 'UwbBQ') { - continue + if (topic.indexOf('UwbBQ') !== -1 && topic.indexOf('prop') !== -1) { + // created by liu jun mqtt返回的参数可能是一个数组 + let peopleList = JSON.parse(message) + if (!Array.isArray(peopleList)) { + peopleList = [peopleList] } - // 将地图上剩余的点与最新的定位人员点进行对比更新地图上已存在的点新增地图上之前没有的点 - 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 perLoc = { - id: item.deviceCode, - x: x, - y: y, - icon_type: 'img4_0' + pointColor, - data_id: item.deviceCode, - point_type: '标记点peoplePositionOne', - label: '人员定位', - corpInfoId: CORP_INFO_ID + for (let i = 0; i < peopleList.length; i++) { + const item = peopleList[i] + // 如果不是人员信息则跳过 + // UwbBQ是人员定位卡的id(UwbJiZhan这是基站的id) + if (item.productKey !== 'UwbBQ') { + 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 perLoc = { + id: item.deviceCode, + x: x, + y: y, + icon_type: 'img4_0' + pointColor, + 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.onePerLocArr.push(perLoc) - ry_drag.addEntity(perLoc) - this.mqttPoint[this.subscription.topic.substring(0, this.subscription.topic.lastIndexOf('+')) + item.deviceCode] = item.deviceCode } + } else if (topic.indexOf('alarm') !== -1) { + const formatMessage = JSON.parse(message) + this.$notify({ + title: '报警信息', + dangerouslyUseHTMLString: true, + message: `部门:${formatMessage.deptName}
类型:${formatMessage.identifierName}`, + type: 'error' + }) } }) }, @@ -2644,8 +2657,8 @@ export default { }, // 订阅 doSubscribe() { - const { topic, qos } = this.subscription - this.client.subscribe(topic, { qos }, (error, res) => { + const { topic, topic1, qos } = this.subscription + this.client.subscribe([topic, topic1], { qos }, (error, res) => { if (error) { console.log('Subscribe to topics error', error) return @@ -2656,8 +2669,8 @@ export default { }, // 取消订阅 doUnSubscribe() { - const { topic } = this.subscription - this.client.unsubscribe(topic, error => { + const { topic, topic1 } = this.subscription + this.client.unsubscribe([topic, topic1], error => { if (error) { console.log('Subscribe to topics error', error) } From 90ae5f50bf0e0b5719702ec98dcbbc5b75db74ab Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 16 Apr 2024 17:22:43 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AE=9A=E4=BD=8D=E5=9C=B0=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/dialog/index.vue | 2 +- src/views/map/dialog/peoplePositionYGS.vue | 27 ++++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/views/map/dialog/index.vue b/src/views/map/dialog/index.vue index 855fd0e..96d68f2 100644 --- a/src/views/map/dialog/index.vue +++ b/src/views/map/dialog/index.vue @@ -54,7 +54,7 @@ - + diff --git a/src/views/map/dialog/peoplePositionYGS.vue b/src/views/map/dialog/peoplePositionYGS.vue index ea15b25..6e5ad24 100644 --- a/src/views/map/dialog/peoplePositionYGS.vue +++ b/src/views/map/dialog/peoplePositionYGS.vue @@ -8,19 +8,19 @@ 照片 姓名 - {{ info?info.NAME:'' }} + {{ info?info.userName:'' }} + 公司 + {{ info?info.corpName:'' }} 部门 - {{ info?info.DEPARTMENT_NAME:'' }} - 岗位 - {{ info?info.POST_NAME:'' }} + {{ info?info.departmentName:'' }} - 人员类型 - {{ info?info.PERSON_TYPE:'' }} - 是否为隐患确认人 - {{ info.IS_HAZARDCONFIRMER == 0 ?'否':'是' }} + 设备id + {{ info?info.deviceId:'' }} + 设备名称 + {{ info?info.deviceName:'' }} @@ -42,6 +42,12 @@ export default { default() { return '' } + }, + corpId: { + type: String, + default() { + return '' + } } }, data() { @@ -58,10 +64,11 @@ export default { requestFN( '/map/getPersonByCardNo', { - CARDNO: this.id + CARDNO: this.id, + corpId: this.corpId } ).then((data) => { - this.info = data.pd + this.info = data.info.required }).catch((e) => { }) } From 6dda995d3eb114fe5ac8350de8a333d19ab5cc45 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 17 Apr 2024 08:57:43 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AE=9A=E4=BD=8D=E5=9C=B0=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/components/renyuan.vue | 88 +++++++++++++++++++++- src/views/map/dialog/peoplePositionYGS.vue | 10 ++- 2 files changed, 93 insertions(+), 5 deletions(-) diff --git a/src/views/map/components/renyuan.vue b/src/views/map/components/renyuan.vue index f3bbb76..c74e60b 100644 --- a/src/views/map/components/renyuan.vue +++ b/src/views/map/components/renyuan.vue @@ -1,6 +1,6 @@ + + diff --git a/src/views/classMessage/classMessage/components/edit.vue b/src/views/classMessage/classMessage/components/edit.vue index 13d8018..fe31e5a 100644 --- a/src/views/classMessage/classMessage/components/edit.vue +++ b/src/views/classMessage/classMessage/components/edit.vue @@ -1,5 +1,5 @@