Selaa lähdekoodia

ue功能;核查接口调整

gr 1 kuukausi sitten
vanhempi
commit
83cee4b4d1

+ 1 - 0
src/components/UeVideo.vue

@@ -102,6 +102,7 @@ function handleConnect() {
 							connectStatus.value = '未发现场景资源'
 							return
 						}
+						connectStatus.value = '连接场景...'
 						wsConnect(targetScene.scene_id, targetScene.permission, token)
 					}
 				})

+ 3 - 0
src/service/index.js

@@ -47,6 +47,9 @@ const requestGet = createAxiosInstance({
 const requestNetPost = createAxiosInstance({
 	baseURL: import.meta.env.VITE_NET_API,
 	method: 'post',
+	// headers: {
+	// 	Authorization: ''
+	// }
 })
 
 const requestZWPost = createAxiosInstance({

+ 6 - 1
src/store/panel.js

@@ -1,4 +1,5 @@
 import { defineStore } from 'pinia'
+import { setWeather as setUeWeather } from '@/utils/ueActions'
 
 const usePanelStore = defineStore('panel', {
 	state: () => ({
@@ -6,7 +7,7 @@ const usePanelStore = defineStore('panel', {
 		fcky: {},
 		sgzy: {},
 		kypm: {},
-		weather: 'cloudy',
+		weather: 'Clear Skies',
 	}),
 	getters: {},
 	actions: {
@@ -22,6 +23,10 @@ const usePanelStore = defineStore('panel', {
 		setKypm(val) {
 			this.kypm = val
 		},
+		setWeather(type) {
+			this.weather = type
+			setUeWeather({ WeatherType: type })
+		},
 	},
 })
 

+ 2 - 1
src/utils/peer-stream.js

@@ -1,5 +1,6 @@
 '5.1.3'
-const base = '10.1.80.139:3000'
+// const base = '10.1.80.139:3000'
+const base = '10.1.80.227:3000'
 
 // Must be kept in sync with JavaScriptKeyCodeToFKey C++ array.
 // special keycodes different from KeyboardEvent.keyCode

+ 50 - 113
src/utils/ueActions.js

@@ -1,4 +1,5 @@
 import bus from './bus'
+import { wait } from './tools'
 
 function sendMessage(msgObj) {
 	bus.emit('callUE', msgObj)
@@ -157,7 +158,7 @@ export function renderGrid() {
 }
 
 // 天气切换
-export function setWeather({ RealTime = true, UpdateTime, WeatherType }) {
+export function setWeather({ RealTime = false, UpdateTime = '2025-02-21 8:00:00', WeatherType }) {
 	sendMessage({
 		ModuleName: 'Weather',
 		ActionName: 'Update',
@@ -186,17 +187,6 @@ export function initSceneDemo() {
  * @param {'Near' | 'Yaw' | 'Electricity' | 'BreakInto' | 'Weather'} type
  */
 export function startSceneDemo(type) {
-	initSceneDemo()
-	sendMessage({
-		ModuleName: 'BluePrint',
-		ActionName: '',
-		Params: {
-			ModuleName: 'Uav',
-			ActionName: 'SendDemoSceneWb',
-			Type: type,
-		},
-	})
-
 	const setUav = (id) => {
 		sendMessage({
 			ModuleName: 'BluePrint',
@@ -210,106 +200,53 @@ export function startSceneDemo(type) {
 		})
 	}
 
-	switch (type) {
-		case 'Near': {
-			sendMessage({
-				ModuleName: 'Roam',
-				ActionName: 'Goto',
-				Params: {
-					Type: 'StraightLine',
-					X: 226362.189418,
-					Y: -597424.387253,
-					Z: 6082.809803,
-					Pitch: -38.200001,
-					Yaw: -53.600001,
-					Roll: 0,
-					Duration: 0.1,
-				},
-			})
-			setUav('E5C734B81F9044FC99E54B361D67C487')
-			break
-		}
-		case 'Yaw': {
-			sendMessage({
-				ModuleName: 'Roam',
-				ActionName: 'Goto',
-				Params: {
-					Type: 'StraightLine',
-					X: 226362.189418,
-					Y: -597424.387253,
-					Z: 6082.809803,
-					Pitch: -38.200001,
-					Yaw: -53.600001,
-					Roll: 0,
-					Duration: 0.1,
-				},
-			})
-			setUav('3C50F681255941F88D7B6E5EE7F6AC63')
-			followUav('3C50F681255941F88D7B6E5EE7F6AC63')
-			break
-		}
-		case 'BreakInto': {
-			setTimeout(() => {
-				sendMessage({
-					ModuleName: 'Roam',
-					ActionName: 'Goto',
-					Params: {
-						Type: 'StraightLine',
-						X: 226362.189418,
-						Y: -597424.387253,
-						Z: 6082.809803,
-						Pitch: -38.200001,
-						Yaw: -53.600001,
-						Roll: 0,
-						Duration: 0.1,
-					},
-				})
-				setUav('bdb8859e-b366-4c1a-a964-1e16ba15237a')
-				followUav('bdb8859e-b366-4c1a-a964-1e16ba15237a')
-			})
-			break
-		}
-		case 'Weather': {
-			setTimeout(() => {
-				sendMessage({
-					ModuleName: 'Roam',
-					ActionName: 'Goto',
-					Params: {
-						Type: 'StraightLine',
-						X: 226362.189418,
-						Y: -597424.387253,
-						Z: 6082.809803,
-						Pitch: -38.200001,
-						Yaw: -53.600001,
-						Roll: 0,
-						Duration: 0.1,
-					},
-				})
-				setUav('469193E4D239436BB50767009CC8B29F')
-				followUav('469193E4D239436BB50767009CC8B29F')
-			}, 2000)
-			break
-		}
-		case 'Electricity': {
-			setTimeout(() => {
-				sendMessage({
-					ModuleName: 'Roam',
-					ActionName: 'Goto',
-					Params: {
-						Type: 'StraightLine',
-						X: 226362.189418,
-						Y: -597424.387253,
-						Z: 6082.809803,
-						Pitch: -38.200001,
-						Yaw: -53.600001,
-						Roll: 0,
-						Duration: 0.1,
-					},
-				})
-				setUav('D0CECFB45F494D39ADABB5AF7A7DFEE7')
-				followUav('D0CECFB45F494D39ADABB5AF7A7DFEE7')
-			}, 2000)
-			break
+	initSceneDemo()
+
+	sendMessage({
+		ModuleName: 'BluePrint',
+		ActionName: '',
+		Params: {
+			ModuleName: 'Uav',
+			ActionName: 'SendDemoSceneWb',
+			Type: type,
+		},
+	})
+
+	bus.on('ueMsgReceived', async (message) => {
+		if (message.ModuleName === 'UavController' && message.ActionName === 'DemoSceneUpdateUavData') {
+			await wait(1000)
+			switch (type) {
+				case 'Near': {
+					setUav('E5C734B81F9044FC99E54B361D67C487')
+					await wait(1000)
+					followUav('D0CECFB45F494D39ADABB5AF7A7DFEE7')
+					break
+				}
+				case 'Yaw': {
+					setUav('3C50F681255941F88D7B6E5EE7F6AC63')
+					await wait(1000)
+					followUav('3C50F681255941F88D7B6E5EE7F6AC63')
+					break
+				}
+				case 'BreakInto': {
+					setUav('bdb8859e-b366-4c1a-a964-1e16ba15237a')
+					await wait(1000)
+					followUav('bdb8859e-b366-4c1a-a964-1e16ba15237a')
+					break
+				}
+				case 'Weather': {
+					setUav('469193E4D239436BB50767009CC8B29F')
+					await wait(1000)
+					followUav('469193E4D239436BB50767009CC8B29F')
+					break
+				}
+				case 'Electricity': {
+					setUav('D0CECFB45F494D39ADABB5AF7A7DFEE7')
+					await wait(1000)
+					followUav('D0CECFB45F494D39ADABB5AF7A7DFEE7')
+					break
+				}
+			}
 		}
-	}
+	})
 }

+ 86 - 32
src/views/home/cpns/FloatPanelTsjs.vue

@@ -23,7 +23,7 @@
 		</div>
 
 		<Transition name="emerge-left">
-			<FloatPanelUav class="uav-demo" v-if="uavInfoShow" :alert="alertInfo" @close="uavInfoShow = false" />
+			<FloatPanelUav class="uav-demo" v-if="uavInfoShow" :alert="alertInfo" :base="baseInfo" @close="handleCloseInfo" />
 		</Transition>
 	</div>
 </template>
@@ -31,17 +31,19 @@
 <script setup>
 import { GetRouteList } from '@/service/http'
 import useLayoutStore from '@/store/layout'
+import usePanelStore from '@/store/panel'
 import useUeStore from '@/store/ue'
 import { getAssetsFile } from '@/utils/require'
-import { clearAllShapes, startSceneDemo, toggleUav } from '@/utils/ueActions'
+import { hexToRgb } from '@/utils/tools'
+import { clearAllShapes, startSceneDemo, toggleUav, initSceneDemo, setWeather } from '@/utils/ueActions'
 import { getCurrentInstance, onBeforeMount, onBeforeUnmount, reactive, ref, watch } from 'vue'
 import FloatPanelUav from './FloatPanelUav.vue'
-import { hexToRgb } from '@/utils/tools'
 
 const { proxy } = getCurrentInstance()
 
 const ueStore = useUeStore()
 const layoutStore = useLayoutStore()
+const panelStore = usePanelStore()
 
 const uavInfoShow = ref(false)
 
@@ -54,13 +56,16 @@ const listData = ref([
 ])
 
 function handleDemo(item) {
+	layoutStore.sceneLoading = true
 	startSceneDemo(item.value)
-	uavInfoShow.value = true
+	panelStore.setWeather('Clear Skies')
+	uavInfoShow.value = false
+	alertInfo.value = {}
 }
 
 const options = reactive({
-	airLine: true,
-	track: true,
+	airLine: false,
+	track: false,
 })
 
 function toggleOption(target) {
@@ -99,13 +104,13 @@ function getData() {
 	GetRouteList()
 		.then((res) => {
 			if (!Array.isArray(res.data.data)) {
-				showWarning('航线信息查询失败')
+				ElMessage({ offset: 90, type: 'warning', message: '航线信息查询失败' })
 				return
 			}
 			routeList = res.data.data
 		})
 		.catch(() => {
-			showWarning('航线信息查询失败')
+			ElMessage({ offset: 90, type: 'warning', message: '航线信息查询失败' })
 		})
 }
 
@@ -119,46 +124,94 @@ watch(
 	{ immediate: true }
 )
 
-const alertInfo = ref({
-	collision: {
-		distance: 20,
-	},
-	offCourse: {
-		distance: 20,
-		lineCode: 'MG22100WRJ',
-	},
-	power: {
-		battery: 27,
-		distance: 310,
-		estimation: 720,
-	},
-	area: {
-		type: '禁飞区',
-		name: '禁飞区11',
-	},
-	weather: {
-		type: '',
-	},
+const baseInfo = ref({
+	name: '美团001',
+	seriesCode: '1581F5FHD23CT00D9F73',
+	regCode: 'UAS03647299',
+	manufacturer: '深圳市大疆创新科技有限公司',
+	size: '小型',
+	type: '多桨或多轴航空器',
+	model: 'M3E',
+
+	status: '正常',
+	battery: '70%',
+	height: '110m',
+	velocity: '10m/s',
+	taskType: '城配物流',
+	updateTime: '2025-02-20 14:48',
+
+	unit: '深圳市大疆创新科技有限公司',
+	manager: '深圳市大疆创新科技有限公司',
+	tel: '18000000000',
 })
 
+const alertInfo = ref({})
+
+function handleCloseInfo() {
+	uavInfoShow.value = false
+	initSceneDemo()
+	panelStore.setWeather('Clear Skies')
+}
+
 onBeforeMount(() => {
 	getData()
 	proxy.$bus.on('ueMsgReceived', (msg) => {
 		if (msg.ModuleName !== 'DemoScene') return
 		switch (msg.ActionName) {
 			case 'AlarmDetail': {
+				baseInfo.value.name = msg.Data.name
+				baseInfo.value.seriesCode = msg.Data.flightIdentify
+				baseInfo.value.type = msg.Data.type
+				baseInfo.value.battery = msg.Data.electricity
+				baseInfo.value.height = msg.Data.height.toFixed(2) + 'm'
+				baseInfo.value.velocity = msg.Data.speed.toFixed(2) + 'm/s'
+				if (msg.Data.overall !== 'SAFE') {
+					const { electricityWarning, weatherWarning, collision, noFlyZone, clearZone, nearstAircraft, routeDeviate } =
+						msg.Data.flightDataStatus
+					if (electricityWarning !== 'SAFE' && !('power' in alertInfo.value)) {
+						alertInfo.value.power = {}
+					}
+					if (weatherWarning !== 'SAFE' && !('weather' in alertInfo.value)) {
+						alertInfo.value.weather = {}
+					}
+					if ((nearstAircraft !== 'SAFE' || collision !== 'SAFE') && !('collision' in alertInfo.value)) {
+						alertInfo.value.collision = {}
+					}
+					if ((noFlyZone !== 'SAFE' || clearZone !== 'SAFE') && !('area' in alertInfo.value)) {
+						alertInfo.value.area = {}
+					}
+					if (routeDeviate === true && !('offCourse' in alertInfo.value)) {
+						alertInfo.value.offCourse = {}
+					}
+				}
+				if (!uavInfoShow.value) uavInfoShow.value = true
+				if (layoutStore.sceneLoading) layoutStore.sceneLoading = false
 				break
 			}
 			case 'Weather': {
-				alertInfo.value.weather.type = msg.data.weather
+				alertInfo.value.weather.type = msg.Data.weather
+				panelStore.setWeather('Light Rain')
+				break
+			}
+			case 'BuildingDistance':
+			case 'Near': {
+				alertInfo.value.collision.distance = msg.Data
+				break
+			}
+			case 'YawDistance': {
+				alertInfo.value.offCourse.distance = msg.Data
+				break
+			}
+			case 'BreakInto': {
+				alertInfo.value.area.name = msg.Data.name
 				break
 			}
 			case 'Electricity': {
-				const { battery, distance, destination } = msg.data
+				const { battery, distance, flightDistance } = msg.Data
 				alertInfo.value.power = {
 					battery: battery,
-					estimation: distance,
-					distance: destination,
+					estimation: flightDistance.toFixed(2),
+					distance: distance.toFixed(2),
 				}
 				break
 			}
@@ -169,6 +222,7 @@ onBeforeMount(() => {
 onBeforeUnmount(() => {
 	toggleUav(false)
 	clearAllShapes()
+	panelStore.setWeather('Clear Skies')
 })
 </script>
 

+ 1 - 1
src/views/home/cpns/FloatPanelUav.vue

@@ -249,7 +249,7 @@ watch(
 	(val) => {
 		const alertKeys = Object.keys(val)
 		hasAlert.value = alertKeys.length > 0
-		currentActive.value = alertTypes.value.find((i) => alertKeys.includes(i.id)).id
+		currentActive.value = alertTypes.value.find((i) => alertKeys.includes(i.id))?.id
 	},
 	{ deep: true, immediate: true }
 )

+ 1 - 1
src/views/home/cpns/PanelKyhs.vue

@@ -307,7 +307,7 @@ function handleInspect(show = true) {
 	const shapeType = drawTypes.find((i) => i.value === form.value.drawType).shapeType
 	if (show) {
 		layoutStore.toggleGlobalLoading(true)
-		shape = getShapeInfo()
+		shape = { ...getShapeInfo(), level: '23' }
 		getInspectionData(shape, shapeType)
 			.then((res) => {
 				const conflict = res.data?.data?.gridConflict

+ 1 - 1
src/views/home/cpns/PanelQjchs.vue

@@ -324,7 +324,7 @@ function handleInspect(show = true) {
 	const shapeType = drawTypes.find((i) => i.value === form.value.drawType).shapeType
 	if (show) {
 		layoutStore.toggleGlobalLoading(true)
-		shape = getShapeInfo()
+		shape = { ...getShapeInfo(), level: '23' }
 		getInspectionData(shape, shapeType)
 			.then((res) => {
 				const conflict = res.data?.data?.gridConflict

+ 1 - 1
src/views/home/cpns/PanelSjwg.vue

@@ -313,7 +313,7 @@ function handleCheck(item, type) {
 	} else {
 		renderShapes({
 			id: item.id,
-			data: item.check ? data : null,
+			data: item.check ? data[0] : null,
 		})
 	}
 }

+ 14 - 18
src/views/layout/cpns/Header.vue

@@ -13,10 +13,10 @@
 		</div>
 		<div class="h-right flex justify-end items-center shrink-0">
 			<img
-				:src="getAssetsFile('weather/' + currentWeather.id + '.png')"
+				:src="getAssetsFile('weather/' + currentWeather.icon + '.png')"
 				alt=""
 				:title="currentWeather.label"
-				@click="changeWeather" />
+				@click="switchWeather" />
 			<div class="user-panel">Admin</div>
 		</div>
 	</div>
@@ -37,26 +37,22 @@ const clock = {
 }
 
 const weathers = ref([
-	{ label: '晴天', id: 'sunny' },
-	{ label: '多云', id: 'cloudy' },
-	{ label: '小雨', id: 'rain-s' },
-	{ label: '大雨', id: 'rain-m' },
-	{ label: '暴雨', id: 'rain-l' },
-	{ label: '小雪', id: 'snow-s' },
-	{ label: '大雪', id: 'snow-l' },
-	{ label: '大风', id: 'windy' },
-	{ label: '大雾', id: 'foggy' },
-	{ label: '雾霾', id: 'haze' },
+	{ label: '晴天', icon: 'sunny', value: 'Clear Skies' },
+	{ label: '多云', icon: 'cloudy', value: '' },
+	{ label: '小雨', icon: 'rain-s', value: '' },
+	{ label: '大雨', icon: 'rain-m', value: 'Light Rain' },
+	{ label: '暴雨', icon: 'rain-l', value: '' },
+	{ label: '小雪', icon: 'snow-s', value: '' },
+	{ label: '大雪', icon: 'snow-l', value: '' },
+	{ label: '大风', icon: 'windy', value: '' },
+	{ label: '大雾', icon: 'foggy', value: '' },
+	{ label: '雾霾', icon: 'haze', value: '' },
 ])
 
-function changeWeather() {
-	// const targetIndex = weathers.value.findIndex((i) => i.id === currentWeather.value.id)
-	// const nextIndex = (targetIndex + 1) % weathers.value.length
-	// panelStore.weather = weathers.value[nextIndex].id
-}
+function switchWeather() {}
 
 const currentWeather = computed(() => {
-	return weathers.value.find((i) => i.id === panelStore.weather)
+	return weathers.value.find((i) => i.value === panelStore.weather)
 })
 </script>