航线管理页面UI和操作逻辑实现
							parent
							
								
									15fe7ab26b
								
							
						
					
					
						commit
						30c586d9c0
					
				| @ -0,0 +1,13 @@ | ||||
| import {Airline, AirlinePoint} from "@/types/entityoptions.ts"; | ||||
| 
 | ||||
| export function newAirlinePt() { | ||||
|     let pt: AirlinePoint = {alt: undefined, ch1: 0, ch2: 0, lat: undefined, lon: undefined, nPt: undefined, speed: 0} | ||||
|     return pt | ||||
| } | ||||
| 
 | ||||
| export function newAirline() { | ||||
|     let flyLine: Airline = { | ||||
|         PtNum: undefined, code: undefined, isClose: false, name: "", points: [], totalDistance: undefined | ||||
|     } | ||||
|     return flyLine | ||||
| } | ||||
| @ -1,27 +0,0 @@ | ||||
| import axios from "axios"; | ||||
| 
 | ||||
| function login(username, password) | ||||
| { | ||||
|     return axios({ | ||||
|         method: "POST", | ||||
|         url: "/onlinetest/htfp/cac/logIn", | ||||
|         headers: {"Content-Type": "application/json"}, | ||||
|         data: { | ||||
|             username: username, | ||||
|             password: password, | ||||
|             forceLogOutOtherDeviceAccount: false | ||||
|         } | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| function requestAirline(uavID){ | ||||
|     return axios({ | ||||
|         method: "POST", | ||||
|         url: "/onlinetest/htfp/cac/queryUavBundledRouteList", | ||||
|         headers: [{"Content-Type": "application/json"},{"X-Authorization-With": sessionStorage.getItem("token")}], | ||||
|         data: { | ||||
|             uavId: uavID, | ||||
|         } | ||||
|     }) | ||||
| } | ||||
| export {login, requestAirline} | ||||
| @ -0,0 +1,38 @@ | ||||
| import {Airline, getUnicode} from "@/types/entityoptions.ts"; | ||||
| 
 | ||||
| // let route: AirlinePoint = {alt: 0, ch1: 0, ch2: 0, lat: 0, lon: 0, nPt: 0, speed: 0}
 | ||||
| const route: Airline = { | ||||
|     PtNum: 5, code: 1, isClose: false, name: "测试航线1", totalDistance: 12323, | ||||
|     unicode:getUnicode(), | ||||
|     points: [ | ||||
|         { lon: 120.23234234, lat: 30.232323,alt: 550, ch1: 0, ch2: 3,  nPt: 1, speed: 0}, | ||||
|         { lon: 120.34233234, lat: 30.232312,alt: 550, ch1: 0, ch2: 3,  nPt: 2, speed: 0}, | ||||
|         { lon: 120.23234324, lat: 30.21223,alt: 550, ch1: 0, ch2: 3,  nPt: 3, speed: 0}, | ||||
|         { lon: 120.23289964, lat: 30.256323,alt: 550, ch1: 0, ch2: 3,  nPt: 4, speed: 0}, | ||||
|         { lon: 120.53564234, lat: 30.132323,alt: 550, ch1: 0, ch2: 1,  nPt: 5, speed: 0}, | ||||
|     ], | ||||
| } | ||||
| const route2: Airline = { | ||||
|     PtNum: 4, code: 2, isClose: true, name: "测试航线2", totalDistance: 2341234, | ||||
|     unicode:getUnicode(), | ||||
|     points: [ | ||||
|         { lon: 120.23234234, lat: 30.232323,alt: 550, ch1: 0, ch2: 3,  nPt: 0, speed: 0}, | ||||
|         { lon: 120.34233234, lat: 30.232312,alt: 550, ch1: 0, ch2: 3,  nPt: 1, speed: 0}, | ||||
|         { lon: 120.23234324, lat: 30.21223,alt: 550, ch1: 0, ch2: 3,  nPt: 2, speed: 0}, | ||||
|         { lon: 120.53564234, lat: 30.132323,alt: 550, ch1: 2, ch2: 1,  nPt: 4, speed: 0}, | ||||
|     ], | ||||
| } | ||||
| const route3: Airline = { | ||||
|     PtNum: 7, code: 3, isClose: false, name: "测试航线3", totalDistance: 3234134, | ||||
|     unicode:getUnicode(), | ||||
|     points: [ | ||||
|         { lon: 123.23234234, lat: 30.232323,alt: 550, ch1: 0, ch2: 3,  nPt: 0, speed: 0}, | ||||
|         { lon: 123.34233234, lat: 30.232312,alt: 550, ch1: 0, ch2: 3,  nPt: 1, speed: 0}, | ||||
|         { lon: 123.23234324, lat: 30.21223,alt: 550, ch1: 0, ch2: 3,  nPt: 2, speed: 0}, | ||||
|         { lon: 123.23289964, lat: 30.256323,alt: 550, ch1: 0, ch2: 3,  nPt: 3, speed: 0}, | ||||
|         { lon: 123.53564234, lat: 30.132323,alt: 550, ch1: 0, ch2: 1,  nPt: 4, speed: 0}, | ||||
|         { lon: 123.53564234, lat: 30.132323,alt: 550, ch1: 0, ch2: 1,  nPt: 4, speed: 0}, | ||||
|         { lon: 123.53564234, lat: 30.132323,alt: 550, ch1: 0, ch2: 1,  nPt: 4, speed: 0}, | ||||
|     ], | ||||
| } | ||||
| export {route,route2,route3} | ||||
| @ -1,54 +0,0 @@ | ||||
| import { defineAsyncComponent, render, createVNode } from "vue"; | ||||
| export class routeDialog { | ||||
|      constructor() { | ||||
|          this.component = defineAsyncComponent( | ||||
|              () => import("@/components/RouteOptions.vue")); | ||||
|          this.vnode = null; | ||||
|          this.node = null; | ||||
|          this.props = { | ||||
|              width: "40%", | ||||
|              height: "auto", | ||||
|          }; | ||||
|      } | ||||
|      installRouteDialog() { | ||||
|          if (!this.vnode) { | ||||
|              const dialog = createVNode(this.component, this.props); | ||||
|              const container = document.createElement('div'); | ||||
|              render(dialog, container); | ||||
|              this.vnode = dialog; | ||||
|              this.node = container.childNodes[0]; | ||||
|              document.body.appendChild(this.node); | ||||
|          } | ||||
|      } | ||||
|      /** | ||||
|       * | ||||
|       * @returns {Promise<string>} | ||||
|       * @param points 经纬度坐标点数组 | ||||
|       */ | ||||
|      show(points) { | ||||
|          // 发送信号,显示窗口
 | ||||
|          const event = new CustomEvent('route-dialog-show', { detail: | ||||
|                  { show: true, pts: points } | ||||
|          }); | ||||
|          document.dispatchEvent(event); | ||||
|          return new Promise((resolve,reject) => { | ||||
|              document.addEventListener('route-dialog-confirm', event => { | ||||
|                  if(event.detail==='cancel'){ | ||||
|                      reject('cancel') | ||||
|                  }else{ | ||||
|                      resolve(event.detail); | ||||
|                  } | ||||
|              }); | ||||
|          }) | ||||
|      } | ||||
|  } | ||||
|  const aDialog = new routeDialog(); | ||||
| 
 | ||||
|  /** | ||||
|   * 展示一个阻塞式对话框 | ||||
|   * @returns {Promise<string>} | ||||
|   * @param point 经纬度坐标点数组 | ||||
|   */ | ||||
|  export async function showRouteDialog(point) { | ||||
|      return aDialog.show(point); | ||||
|  } | ||||
					Loading…
					
					
				
		Reference in New Issue