| | |
| | | import { TaskType, TaskStatus, OutOfControlAction } from '/@/types/task' |
| | | import { WaylineType } from '/@/types/wayline' |
| | | |
| | | const HTTP_PREFIX = 'drone/waylineFile' |
| | | const HTTP_PREFIX = '/wayline/api/v1' |
| | | |
| | | // Get Wayline Files |
| | | export const getWaylineFiles = async function (wid: string, body: {}): Promise<IWorkspaceResponse<any>> { |
| | |
| | | return result.data |
| | | } |
| | | } |
| | | // get Wayline File |
| | | export const getWayLineFile = async function (workspaceId: string, waylineId: string) { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/waylines/${waylineId}/urlData` |
| | | const result = await request.get(url) |
| | | return result.data |
| | | } |
| | | |
| | | // Delete Wayline File |
| | | export const deleteWaylineFile = async function (workspaceId: string, waylineId: string): Promise<IWorkspaceResponse<any>> { |
| | |
| | | return result.data |
| | | } |
| | | |
| | | export interface waylineJob { |
| | | name: string |
| | | fileId: string |
| | | waylineId:string |
| | | dockSn: string |
| | | workspaceId: string |
| | | taskType: TaskType |
| | | executeSingleTime?: string |
| | | repeatExecuteTimeArr?: string[] |
| | | executeStartTime?: string |
| | | executeEndTime?: string |
| | | executeRepeatTime?: string[] |
| | | frequencyValue?: number |
| | | frequencyType?: number |
| | | repeatRuleType?: number |
| | | repeatRuleValueDay?: number[] |
| | | repeatRuleValueWeek?: number[] |
| | | startPower: number |
| | | rthAltitude: number |
| | | outOfControl: number |
| | | finishAction: number |
| | | breakContinue: number |
| | | } |
| | | export interface CreatePlan { |
| | | name: string, |
| | | file_id: string, |
| | |
| | | rth_altitude: number // 相对机场返航高度 20 - 500 |
| | | out_of_control_action: OutOfControlAction // 失控动作 |
| | | } |
| | | |
| | | // Create Wayline Job |
| | | // 新增计划 |
| | | export const createPlan = async function (workspaceId: string, plan: CreatePlan): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/flight-tasks` |
| | | const result = await request.post(url, plan) |
| | |
| | | uploaded_count: number // 已上传媒体数量 |
| | | } |
| | | |
| | | // Get Wayline Jobs |
| | | export const getWaylineJobs = async function (workspaceId: string, page: IPage): Promise<IListWorkspaceResponse<Task>> { |
| | | export interface TaskQueryParam{ |
| | | dockSn?:string |
| | | taskType?:any |
| | | status?:any |
| | | name?:string |
| | | startTime?:string |
| | | endTime?:string |
| | | } |
| | | |
| | | // 获取计划列表(分页) |
| | | export const getWaylineJobs = async function (workspaceId: string, page: IPage, params:TaskQueryParam): Promise<IListWorkspaceResponse<Task>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/jobs?page=${page.page}&page_size=${page.page_size}` |
| | | const result = await request.get(url) |
| | | const result = await request.get(url, { params }) |
| | | return result.data |
| | | } |
| | | |
| | |
| | | |
| | | // Upload Wayline file |
| | | export const importKmzFile = async function (workspaceId: string, file: {}): Promise<IWorkspaceResponse<any>> { |
| | | const url = `api/${HTTP_PREFIX}/upload` |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/waylines/file/upload` |
| | | const result = await request.post(url, file, { |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data', |