|
|
@@ -36,8 +36,8 @@
|
|
|
<script lang="ts">
|
|
|
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
|
|
|
import { getLatAndLon } from '@/views/groupPage/util'
|
|
|
+import { getZhgdCameraData, getZhgdEquipmentData, getZhgdHelmetData } from '@/views/groupPage/apis'
|
|
|
import deviceInfo from '@/views/groupPage/districtPageModules/customTools/infoComponents/deviceInfo.vue'
|
|
|
-import axios from '@/utils/request'
|
|
|
const Cesium = (window as any).Cesium
|
|
|
let customDataSource = new Cesium.CustomDataSource('monitorTree')
|
|
|
let handler = null
|
|
|
@@ -94,14 +94,8 @@ export default class monitorTree extends Vue {
|
|
|
}
|
|
|
//获取监测设备数据
|
|
|
async getData() {
|
|
|
- // this.treeData = []
|
|
|
- let params = { typeCode: 'deviceTree' }
|
|
|
- // const res = await axios.request({ url: '/panoramic/commonData/list', method: 'get', params })
|
|
|
- // let result = res.result
|
|
|
- // Object.keys(result).forEach((item, index) => {
|
|
|
- // this.treeData.push({ name: item, children: result[item] })
|
|
|
- // })
|
|
|
- const cameraRes = await axios.request({ url: '/tofly-sxgk/zhgd/zhgdCamaraData', method: 'get', params: {} })
|
|
|
+ //
|
|
|
+ const cameraRes = await getZhgdCameraData({})
|
|
|
let cameras = cameraRes.result.map((item) => {
|
|
|
return {
|
|
|
...item,
|
|
|
@@ -110,7 +104,8 @@ export default class monitorTree extends Vue {
|
|
|
deviceType: '摄像头'
|
|
|
}
|
|
|
})
|
|
|
- const monitorRes = await axios.request({ url: '/tofly-sxgk/zhgd/zhgdEquipmentData', method: 'get', params: {} })
|
|
|
+ //
|
|
|
+ const monitorRes = await getZhgdEquipmentData({})
|
|
|
let monitors = monitorRes.result.map((item) => {
|
|
|
item.zhgdEquipment.status = item.zhgdEquipment.status == 0 ? '离线' : '在线'
|
|
|
item.zhgdEquipment.deviceType = '监控设备'
|
|
|
@@ -119,9 +114,23 @@ export default class monitorTree extends Vue {
|
|
|
item.zhgdEquipment.longitude = item.zhgdEquipment.lon
|
|
|
return item.zhgdEquipment
|
|
|
})
|
|
|
+ //
|
|
|
+ const helmetRes = await getZhgdHelmetData({})
|
|
|
+ console.log(helmetRes)
|
|
|
+ let helmets = helmetRes.result.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ deviceType: '安全帽',
|
|
|
+ latitude: item.lat,
|
|
|
+ longitude: item.lon,
|
|
|
+ name: item.person_id,
|
|
|
+ status: item.status == 1 ? '未激活' : item.status == 2 ? '离线' : item.status == 3 ? '在线' : '无'
|
|
|
+ }
|
|
|
+ })
|
|
|
this.treeData = [
|
|
|
{ name: '智慧工地摄像头', children: cameras },
|
|
|
- { name: '智慧工地监控设备', children: monitors }
|
|
|
+ { name: '智慧工地监控设备', children: monitors },
|
|
|
+ { name: '智慧工地安全帽', children: helmets }
|
|
|
]
|
|
|
}
|
|
|
setStatusIconColor(type) {
|
|
|
@@ -138,15 +147,15 @@ export default class monitorTree extends Vue {
|
|
|
return iconSrc
|
|
|
}
|
|
|
handleTreeNodeClick(data) {
|
|
|
+ if (!data.longitude || !data.latitude) {
|
|
|
+ this.$message.info('暂无位置信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
let entity = customDataSource.entities.getById(data.name)
|
|
|
let item = {
|
|
|
name: data.name,
|
|
|
id: data.id,
|
|
|
position: [Number(data.longitude), Number(data.latitude)],
|
|
|
- image:
|
|
|
- data.deviceType == '摄像头'
|
|
|
- ? require('@/views/groupPage/images/设备/摄像头.png')
|
|
|
- : require('@/views/groupPage/images/设备/噪声.png'),
|
|
|
info: data
|
|
|
}
|
|
|
this.viewer.flyTo(entity).then(() => {
|
|
|
@@ -190,14 +199,11 @@ export default class monitorTree extends Vue {
|
|
|
}
|
|
|
for (let index = 0; index < this.deviceCheckList.length; index++) {
|
|
|
const item = this.deviceCheckList[index]
|
|
|
+ if (!item.longitude || !item.latitude) continue
|
|
|
const infoData = {
|
|
|
id: item.id,
|
|
|
name: item.name,
|
|
|
position: [Number(item.longitude), Number(item.latitude)],
|
|
|
- image:
|
|
|
- item.deviceType == '摄像头'
|
|
|
- ? require('@/views/groupPage/images/设备/摄像头.png')
|
|
|
- : require('@/views/groupPage/images/设备/噪声.png'),
|
|
|
info: item
|
|
|
}
|
|
|
this.addEntity(infoData)
|
|
|
@@ -205,6 +211,7 @@ export default class monitorTree extends Vue {
|
|
|
this.activeMapEvent()
|
|
|
}
|
|
|
addEntity(options) {
|
|
|
+ let image = this.iconSelect(options.info.deviceType)
|
|
|
const position = Cesium.Cartesian3.fromDegrees(options.position[0], options.position[1], 0)
|
|
|
var bottomPosition = Cesium.Cartographic.fromCartesian(position)
|
|
|
var entity = new Cesium.Entity({
|
|
|
@@ -215,7 +222,7 @@ export default class monitorTree extends Vue {
|
|
|
position: Cesium.Cartographic.toCartesian(bottomPosition),
|
|
|
billboard: {
|
|
|
sizeInMeters: false,
|
|
|
- image: options.image,
|
|
|
+ image: image,
|
|
|
width: 40,
|
|
|
height: 65,
|
|
|
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
@@ -227,6 +234,21 @@ export default class monitorTree extends Vue {
|
|
|
})
|
|
|
customDataSource.entities.add(entity)
|
|
|
}
|
|
|
+ iconSelect(type) {
|
|
|
+ let icon = ''
|
|
|
+ switch (type) {
|
|
|
+ case '摄像头':
|
|
|
+ icon = require('@/views/groupPage/images/设备/摄像头.png')
|
|
|
+ break
|
|
|
+ case '监控设备':
|
|
|
+ icon = require('@/views/groupPage/images/设备/监控设备.png')
|
|
|
+ break
|
|
|
+ case '安全帽':
|
|
|
+ icon = require('@/views/groupPage/images/设备/安全帽.png')
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return icon
|
|
|
+ }
|
|
|
activeMapEvent() {
|
|
|
const that = this
|
|
|
handler = new Cesium.ScreenSpaceEventHandler(this.viewer.canvas)
|