| | |
| | | <div v-for="dock in onlineDocks.data" :key="dock.sn" |
| | | style="background: #3c3c3c; margin-bottom: 10px;"> |
| | | <div class="task_wrapper" v-if="dock.latest_wayline_job"> |
| | | <div class="task_content"> |
| | | <div class="task_content task_content_way" v-if="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code === 5"> |
| | | <div class="task_status"> |
| | | <ContainerOutlined /> |
| | | <span>执行任务中</span> |
| | | </div> |
| | | </div> |
| | | <div class="task_content" v-else> |
| | | <div class="task_status"> |
| | | <ContainerOutlined /> |
| | | <span>待执行</span> |
| | | </div> |
| | | <div class="task_info">{{convertTimestampToDate(dock.latest_wayline_job.begin_time)}}</div> |
| | | <div class="task_info">{{dock.latest_wayline_job.is_later ? '今天': '明天'}}{{convertTimestampToDate(dock.latest_wayline_job.begin_time, 'hh:mm')}}</div> |
| | | </div> |
| | | <div class="task_title">{{dock.latest_wayline_job.name}}</div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import * as Cesium from 'cesium' |
| | | import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue' |
| | | import { EDeviceTypeName, ELocalStorageKey } from '/@/types' |
| | | import rc from '/@/assets/icons/rc.png' |
| | |
| | | } from '@ant-design/icons-vue' |
| | | import { EHmsLevel } from '/@/types/enums' |
| | | import { cesiumOperation } from '/@/hooks/use-cesium-tsa' |
| | | import { convertTimestampToDate } from '/@/utils/time' |
| | | import { convertTimestampToDate, getDateFromTimestamp, isToday, setTodayTime } from '/@/utils/time' |
| | | let droneEntity: any |
| | | |
| | | const { appContext } = getCurrentInstance() |
| | |
| | | const onlineDocks = reactive({ |
| | | data: [] as OnlineDevice[] |
| | | }) |
| | | |
| | | const previousPositions = ref([]) |
| | | const deviceInfo = computed(() => store.state.deviceState.deviceInfo) |
| | | const dockInfo = computed(() => store.state.deviceState.dockInfo) |
| | | const projectName = computed(() => store.state.common.projectName) |
| | |
| | | const getResource = (name: string) => { |
| | | return new URL(`/src/assets/icons/${name}`, import.meta.url).href |
| | | } |
| | | |
| | | // 获取ws连接过来的sn设备号 |
| | | const snCode = ref<string[]>([]) |
| | | const cesium = cesiumOperation() |
| | | // 添加机场标注 |
| | | watch(() => store.state.deviceState, data => { |
| | | watch(() => store.state.deviceState, (data, oldData) => { |
| | | console.log(data, 'data') |
| | | // cesium.removeAllPoint() |
| | | if (data.currentType === EDeviceTypeName.Aircraft && data.deviceInfo[data.currentSn]) { |
| | | // cesium.removeById('drone_fly') |
| | |
| | | heading: data.deviceInfo[data.currentSn].attitude_head, |
| | | } |
| | | cesium.updateEntityPosition(data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude, 'drone_fly', orientation) |
| | | // 根据机场状态码判断是否实时更新轨迹航线 |
| | | if (data.dockInfo[data.currentSn] && (data.dockInfo[data.currentSn].basic_osd.mode_code === 3 || data.dockInfo[data.currentSn].basic_osd.mode_code === 4 || data.dockInfo[data.currentSn].basic_osd.mode_code === 5)) { |
| | | // 生成新的位置数组 |
| | | const newPositions = Cesium.Cartesian3.fromDegreesArray([oldData.deviceInfo[data.currentSn].longitude, oldData.deviceInfo[data.currentSn].latitude, data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude]) |
| | | previousPositions.value = previousPositions.value.concat(newPositions) |
| | | // 更新线段的位置 |
| | | const drone_route = cesium.getEntityById('drone_route') |
| | | drone_route.polyline.positions = previousPositions.value |
| | | } else { |
| | | previousPositions.value = [] |
| | | cesium.removeById('drone_route') |
| | | } |
| | | } else { |
| | | // 无人机图标 |
| | | const setting = { |
| | |
| | | heading: data.deviceInfo[data.currentSn].attitude_head, |
| | | } |
| | | cesium.addPoint(setting) |
| | | // 无人机路线轨迹 |
| | | const routeTrajectory = { |
| | | longitude: 115.85666327144976, |
| | | latitude: 28.62452712442823, |
| | | id: 'drone_route', |
| | | polyline: { |
| | | width: 5, |
| | | positions: previousPositions.value, |
| | | material: Cesium.Color.BLUE |
| | | }, |
| | | } |
| | | cesium.addPolyline(routeTrajectory) |
| | | } |
| | | // if (osdVisible.value.visible && osdVisible.value.sn !== '') { |
| | | // deviceInfo.value.device = data.deviceInfo[osdVisible.value.sn] |
| | | // } |
| | | } |
| | | if (data.currentType === EDeviceTypeName.Dock && data.dockInfo[data.currentSn]) { |
| | | if (snCode.value.includes(data.currentSn)) return |
| | |
| | | Promise.resolve(false) |
| | | } |
| | | } |
| | | // 判断给定日期是否晚于当前时间 |
| | | const isDateLaterThanNow = (dateObj:any) => { |
| | | const todayTimestamp = setTodayTime(dateObj) |
| | | return todayTimestamp > Date.now() |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getOnlineTopo() |
| | | setTimeout(() => { |
| | |
| | | const element = document.getElementsByClassName('scrollbar').item(0) as HTMLDivElement |
| | | const parent = element?.parentNode as HTMLDivElement |
| | | scorllHeight.value = parent?.clientHeight - parent?.firstElementChild?.clientHeight |
| | | previousPositions.value = [] |
| | | }) |
| | | |
| | | function getOnlineTopo () { |
| | |
| | | onlineDocks.data = [] |
| | | res.data.forEach((gateway: any) => { |
| | | const child = gateway.children |
| | | if (gateway.latest_wayline_job) { |
| | | const isLater = isToday(gateway.latest_wayline_job.begin_time) |
| | | // false 代表任务开始时间大于今天 true为任务开始时间为今天 |
| | | gateway.latest_wayline_job.is_later = isLater |
| | | } |
| | | |
| | | const device: OnlineDevice = { |
| | | model: child?.device_name, |
| | | callsign: child?.nickname, |
| | |
| | | } |
| | | |
| | | function switchVisible (e: any, device: OnlineDevice, isDock: boolean, isClick: boolean, sn?: any) { |
| | | console.log(device, 'device') |
| | | // showDrawer.value = !showDrawer.value |
| | | if (!isClick) { |
| | | e.target.style.cursor = 'not-allowed' |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | .task_content { |
| | | background-color: #19be6b; |
| | | background-color: #41bbfa; |
| | | padding: 2px 4px; |
| | | } |
| | | .task_content_way { |
| | | background-color: #19be6b; |
| | | } |
| | | .task_title { |
| | | margin-left: 5px; |
| | | font-size: 14px; |