| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2025-04-15 22:41:40 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2025-04-16 18:38:00 |
| | | * @LastEditTime: 2025-04-16 19:33:52 |
| | | * @FilePath: \command-center-dashboard\src\hooks\useSingleDroneMap\useSingleDroneMap.js |
| | | * @Description: |
| | | * |
| | | * Copyright (c) 2025 by shuishen, All Rights Reserved. |
| | | */ |
| | | import * as Cesium from 'cesium' |
| | | import { render } from 'vue' |
| | | import endingImg from '@/assets/images/aiNowFly/ending.png' |
| | | import endingHighImg from '@/assets/images/aiNowFly/ending-high.png' |
| | | import EventPopUpBox from '@/hooks/components/EventPopUpBox.vue' |
| | | |
| | | import eventSingle from '@/assets/images/home/useEventOperate/eventSingle.png' |
| | | |
| | | import eventPending from '@/assets/images/home/useEventOperate/eventPending.png' // 待处理 0 |
| | | import eventWaitAudit from '@/assets/images/home/useEventOperate/eventWaitAudit.png' // 待审核 2 |
| | | import eventProcessing from '@/assets/images/home/useEventOperate/eventProcessing.png' // 处理中 3 |
| | | import eventCompleted from '@/assets/images/home/useEventOperate/eventCompleted.png' // 已完成 4 |
| | | import eventClosed from '@/assets/images/home/useEventOperate/eventClosed.png' // 已完结 5 |
| | | |
| | | /** |
| | | * |
| | |
| | | eventApi: null, |
| | | eventApiParams: {} |
| | | }) { |
| | | const styleTransform = 'translate(-50%,-110%)' |
| | | |
| | | const { eventPositions, eventApi, eventApiParams } = options |
| | | const eventImage = { |
| | | 0: eventPending, |
| | | 2: eventWaitAudit, |
| | | 3: eventProcessing, |
| | | 4: eventCompleted, |
| | | 5: eventClosed |
| | | } |
| | | |
| | | let viewer = null |
| | | let handler = null |
| | |
| | | } |
| | | |
| | | // 机巢事件地图撒点 |
| | | const initDroneEventEntity = (eventPositions = eventPositions) => { |
| | | const initDroneEventEntity = (eventData = eventPositions) => { |
| | | // 遍历特征并添加实体 |
| | | eventPositions.length && eventPositions.forEach((item, index) => { |
| | | eventData.length && eventData.forEach((item, index) => { |
| | | const { longitude, latitude, status, id } = item |
| | | |
| | | const curImg = eventImage[status] || eventSingle |
| | | |
| | | const position = Cesium.Cartesian3.fromDegrees(+longitude, +latitude, 0) |
| | | |
| | |
| | | id: `single-drone-event-${index}`, |
| | | position: position, |
| | | billboard: { |
| | | image: new Cesium.ConstantProperty(endingHighImg), |
| | | width: 35, |
| | | height: 35, |
| | | image: new Cesium.ConstantProperty(curImg), |
| | | width: 20, |
| | | height: 20, |
| | | }, |
| | | properties: { |
| | | customData: { |
| | | data: { |
| | | type: 'single-drone-sign' |
| | | ...item, |
| | | eventId: item.id, |
| | | type: 'single-drone-event' |
| | | } |
| | | } |
| | | }, |
| | |
| | | ...eventApiParams, |
| | | } |
| | | ).then(res => { |
| | | const result = res.data.data.records |
| | | const result = res.data.data |
| | | |
| | | initDroneEventEntity(result) |
| | | }) |
| | |
| | | |
| | | // 左键单机事件 |
| | | const singleMachineEvent = async click => { |
| | | let clickedEntities = viewer?.scene.drillPick(click.position).map(item => item.id) |
| | | if (!clickedEntities.length) return |
| | | currentEntity = null |
| | | |
| | | const currentEntity = findEntityByType(clickedEntities, 'single-drone-event') |
| | | let clickedEntities = viewer?.scene.drillPick(click.position).map(item => item.id) |
| | | |
| | | console.log(clickedEntities, 1111111) |
| | | |
| | | if (!clickedEntities?.length) return |
| | | |
| | | currentEntity = findEntityByType(clickedEntities, 'single-drone-event') |
| | | |
| | | console.log(currentEntity, 1111111) |
| | | |
| | | removeLabel() |
| | | |
| | |
| | | const labelBoxRender = () => { |
| | | if (!currentEntity) return |
| | | let dom = document.querySelector('#mapPopUpBox') |
| | | |
| | | console.log(currentEntity.properties.customData, 4444) |
| | | |
| | | if (!dom) { |
| | | dom = getLabelDom(currentEntity.properties.customData._value.data) |
| | | } |