From c769b1809eb92b72c56b4df098ff8ef7b7078378 Mon Sep 17 00:00:00 2001 From: songwenxuan <1924103812@qq.com> Date: Mon, 29 Jan 2024 08:47:18 +0800 Subject: [PATCH] =?UTF-8?q?cmt=E6=B8=AF=E5=9C=B0=E5=9B=BE=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/map/components/renyuanCmt.vue | 413 +++++++++++++++++++++ src/views/map/dialog/index.vue | 6 + src/views/map/dialog/peoplePositionCmt.vue | 120 ++++++ src/views/map/dialog/video_play_cmt.vue | 66 ++++ src/views/map/index.vue | 147 +++++++- src/views/map/js/dragentity.js | 6 +- src/views/map/js/ry_dragentity.js | 4 +- static/config.js | 1 + 8 files changed, 751 insertions(+), 12 deletions(-) create mode 100644 src/views/map/components/renyuanCmt.vue create mode 100644 src/views/map/dialog/peoplePositionCmt.vue create mode 100644 src/views/map/dialog/video_play_cmt.vue diff --git a/src/views/map/components/renyuanCmt.vue b/src/views/map/components/renyuanCmt.vue new file mode 100644 index 0000000..87d28f2 --- /dev/null +++ b/src/views/map/components/renyuanCmt.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/src/views/map/dialog/index.vue b/src/views/map/dialog/index.vue index 785972c..aca7806 100644 --- a/src/views/map/dialog/index.vue +++ b/src/views/map/dialog/index.vue @@ -16,6 +16,7 @@ + @@ -45,6 +46,7 @@ + @@ -80,6 +82,7 @@ import breakgroundOrder from './breakgroundOrder.vue' import hoistingOrder from './hoistingOrder.vue' import videoPlay from './video_play.vue' import videoPlayCfd from './video_play_cfd.vue' +import videoPlayCmt from './video_play_cmt.vue' import videoPlayPlat from './video_play_plat.vue' import videoPlayBianjieruqin from './video_play_bianjieruqin.vue' import hotworkCfdD from './hotworkCfdD.vue' @@ -91,6 +94,7 @@ import cutroadCfdD from './cutroadCfdD.vue' import breakgroundCfdD from './breakgroundCfdD.vue' import hoistingCfdD from './hoistingCfdD.vue' import peoplePositionCfdD from './peoplePositionCfdD.vue' +import peoplePositionCmt from './peoplePositionCmt.vue' import carPositionCfdD from './carPositionCfdD.vue' import peoplePositionOne from './peoplePositionOne.vue' import hotworkFirst from "./hotworkFirst"; @@ -119,6 +123,7 @@ export default { hoistingOrder, videoPlay, videoPlayCfd, + videoPlayCmt, videoPlayPlat, hotworkCfdD, confinedspaceCfdD, @@ -130,6 +135,7 @@ export default { hoistingCfdD, MkGateMachineCfd, peoplePositionCfdD, + peoplePositionCmt, carPositionCfdD, videoPlayBianjieruqin, peoplePositionOne, diff --git a/src/views/map/dialog/peoplePositionCmt.vue b/src/views/map/dialog/peoplePositionCmt.vue new file mode 100644 index 0000000..d2c0a0c --- /dev/null +++ b/src/views/map/dialog/peoplePositionCmt.vue @@ -0,0 +1,120 @@ + + + + diff --git a/src/views/map/dialog/video_play_cmt.vue b/src/views/map/dialog/video_play_cmt.vue new file mode 100644 index 0000000..706f9b7 --- /dev/null +++ b/src/views/map/dialog/video_play_cmt.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/views/map/index.vue b/src/views/map/index.vue index 59cb052..0dd0913 100644 --- a/src/views/map/index.vue +++ b/src/views/map/index.vue @@ -39,8 +39,7 @@ :corp-info-id="CORP_INFO_ID" :gangkou="gangkouActive"/> @@ -85,7 +84,7 @@ :area="area" :gangkou="gangkouActive"/> @@ -99,6 +98,11 @@ :corp-info-id="CORP_INFO_ID" :area="area" :gangkou="gangkouActive"/> + { console.log(e) }) @@ -2457,6 +2487,71 @@ export default { } } }, + // 曹煤炭人员定位websocket + cmtinitNinePerLocWebsocket() { + const _this = this + console.info(config.perRealTimeLocUrl) + if (window.WebSocket) { + this.fwebsocket = new WebSocket(encodeURI('ws://' + config.cmtperRealTimeLocUrl)) // oladress在main.jsp页面定义 + this.fwebsocket.onopen = () => { + console.info('人员定位监听成功') + } + this.fwebsocket.onerror = function() { + console.info('连接失败') + } + this.fwebsocket.onclose = function() { + console.info('onclose') + } + this.fwebsocket.onmessage = function(message) { + const mockData = JSON.parse(message.data) + console.log(mockData) + + // 将地图上的点与最新的定位人员点进行对比 删除地图上多的点 + const ninePerLoc = _this.ninePerLocArr.filter(item => { + const index = mockData.findIndex(item1 => { + return item.id.toString() === item1.cardno.toString() + }) + return index !== -1 + }) + + // 将地图上剩余的点与最新的定位人员点进行对比 更新地图上已存在的点 新增地图上之前没有的点 + for (const item of mockData) { + console.log(item) + const wgs84 = _this.gcj02towgs84(parseFloat(item.longitude), parseFloat(item.latitude)) + item.longitude = wgs84[0] + item.latitude = wgs84[1] + const index = ninePerLoc.findIndex(item1 => { + return item1.id.toString() === item.cardno.toString() + }) + + const pointColor = _this.isPointxyWithinTheArea(_this.pointBox, item.longitude, item.latitude) + if (index !== -1) { + ninePerLoc[index].x = item.longitude + ninePerLoc[index].y = item.latitude + ninePerLoc[index].icon_type = 'img4_0' + pointColor + ry_drag.getPosition(ninePerLoc[index]) + } else { + const perLoc = { + id: item.cardno, + name: item.name, + x: item.longitude, + y: item.latitude, + point_type: 'peoplePosition', + icon_type: 'img4_0' + pointColor + } + ninePerLoc.push(perLoc) + ry_drag.delEntity(perLoc) + ry_drag.addEntity(perLoc) + var qianzhui = 'person' + _this.allOrientationPoint[qianzhui + item.cardno] = item.cardno + // qianzhui 前缀是点位的前缀,用于区分不同类型的点(如一公司人员、二公司人员),删除时,可根据点位前缀进行删除点 + } + } + // 最后更新ninePerLocArr + _this.ninePerLocArr = ninePerLoc + } + } + }, /* 一公司人员定位 mqtt务必使用4.2.1版本*/ // 九公司人员定位websocket initNinePerLocWebsocket() { @@ -2765,6 +2860,7 @@ export default { point.empNo = data.empNo || '' // 工号 point.cardNo = data.cardNo || '' // 卡号 point.gangkou = this.gangkouActive + console.log(point) return point }, // 查询当前所有点位是否在区域内 @@ -2824,7 +2920,42 @@ export default { } }) }, - + gcj02towgs84(lng, lat) { + if (this.out_of_china(lng, lat)) { + return [lng, lat] + } else { + var dlat = this.transformlat(lng - 105.0, lat - 35.0) + var dlng = this.transformlng(lng - 105.0, lat - 35.0) + var radlat = lat / 180.0 * PI + var magic = Math.sin(radlat) + magic = 1 - ee * magic * magic + var sqrtmagic = Math.sqrt(magic) + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI) + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI) + const mglat = lat + dlat + const mglng = lng + dlng + return [lng * 2 - mglng, lat * 2 - mglat] + } + }, + out_of_china(lng, lat) { + return (lng < 72.004 || lng > 137.8347 || (lat < 0.8293 || lat > 55.8271 || false)) + }, + // 转化经度 + transformlng(lng, lat) { + var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)) + ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0 + ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0 + ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0 + return ret + }, + // 转化纬度 + transformlat(lng, lat) { + var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)) + ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0 + ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0 + ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0 + return ret + }, // 重新加载人员定位点位信息 localtionReload(pindex, index) { var _this = this @@ -2985,8 +3116,8 @@ export default { } this.bottomClickDisable = false done() - } - } + }, + }, } diff --git a/src/views/map/js/dragentity.js b/src/views/map/js/dragentity.js index 01b4e6f..9445d96 100644 --- a/src/views/map/js/dragentity.js +++ b/src/views/map/js/dragentity.js @@ -9,8 +9,8 @@ const img0_2 = require('../../../assets/map/gangkou_index/point/ico3.png') const img1_0 = require('../../../assets/map/gangkou_index/point/ico4.png') const img1_1 = require('../../../assets/map/gangkou_index/point/ico5.png') const img1_2 = require('../../../assets/map/gangkou_index/point/ico6.png') -// const img1_3 = require('../../../assets/map/gangkou_index/point/ico7.png') -const img1_3 = require('../../../assets/map/gangkou_index/point/ico8.png') +const img1_3 = require('../../../assets/map/gangkou_index/point/ico7.png') +const img1_4 = require('../../../assets/map/gangkou_index/point/ico8.png') const img2_0 = require('../../../assets/map/gangkou_index/point/ico9.png') const img2_1 = require('../../../assets/map/gangkou_index/point/ico10.png') @@ -53,7 +53,7 @@ const img8_3 = require('../../../assets/map/gangkou_index/point/ico26.png') const imgMap = { img0_0, img0_1, img0_2, - img1_0, img1_1, img1_2, img1_3, + img1_0, img1_1, img1_2, img1_3, img1_4, img2_0, img2_1, img2_2, img2_3, img2_4, img2_5, img2_6, img2_7, cfd_img2_8, cfd_img3_0, img3_0, img3_1, img4_0, img4_0_1, img4_0_2, img4_0_3, img4_1, diff --git a/src/views/map/js/ry_dragentity.js b/src/views/map/js/ry_dragentity.js index 4472aad..f63fb12 100644 --- a/src/views/map/js/ry_dragentity.js +++ b/src/views/map/js/ry_dragentity.js @@ -43,7 +43,9 @@ export default class DragEntity { this.viewer.clock.clockRange = Cesium.ClockRange.CLAMPED this.viewer.clock.shouldAnimate = false } - + delEntity(point) { + this.viewer.entities.remove(point) + } getPosition(point) { if (this.viewer.clock.shouldAnimate === false) { this.viewer.clock.shouldAnimate = true diff --git a/static/config.js b/static/config.js index c002a23..fe3e613 100644 --- a/static/config.js +++ b/static/config.js @@ -11,6 +11,7 @@ const config = { weburlNaiwang: 'http://192.168.192.201:8992/', // 附件服务器地址, httpurlNaiwang: 'http://192.168.192.201:8992//qa-prevention-gwj/', // 附件服务器地址, perRealTimeLocUrl: '192.168.210.32:8084/netty/test.io', + cmtperRealTimeLocUrl: '192.168.0.247:8899', cfdfileUrl: 'http://60.2.209.238:8991/file', xfgUrl: 'https://skqhdg.porthebei.com:9006/static/qrcode/views/xgf_hgz/index.html', messageUrl: 'http://192.168.151.56:8082/static/qrcode/views/xgf_hgz/index.html'