| | |
| | | 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, |
| | | dock_sn: string, |
| | | task_type: TaskType, // 任务类型 |
| | | wayline_type: WaylineType, // 航线类型 |
| | | execute_time?: number // 执行时间(毫秒) |
| | | task_days?: number[] // 执行任务的日期(秒) |
| | | task_periods?: number[][] // 执行任务的时间点(秒) |
| | | 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) |
| | |
| | | dock_name: string, |
| | | workspace_id: string, |
| | | username: string, |
| | | execute_time: string, |
| | | begin_time: string, |
| | | end_time: string, |
| | | execute_time: string, |
| | | completed_time: string, |
| | | status: TaskStatus, // 任务状态 |
| | | progress: number, // 执行进度 |
| | | code: number, // 错误码 |
| | |
| | | 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 |
| | | } |
| | | |
| | |
| | | job_id: string |
| | | } |
| | | |
| | | // 取消机场任务 |
| | | // 删除机场任务 |
| | | export async function deleteTask (workspaceId: string, params: DeleteTaskParams): Promise<IWorkspaceResponse<{}>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/jobs` |
| | | const result = await request.delete(url, { |
| | |
| | | return result.data |
| | | } |
| | | |
| | | export enum UpdateTaskStatus { |
| | | Suspend = 0, // 暂停 |
| | | Resume = 1, // 恢复 |
| | | } |
| | | export interface UpdateTaskStatusBody { |
| | | job_id: string |
| | | status: UpdateTaskStatus |
| | | } |
| | | |
| | | // 更新机场任务状态 |
| | | export async function updateTaskStatus (workspaceId: string, body: UpdateTaskStatusBody): Promise<IWorkspaceResponse<{}>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/jobs/${body.job_id}` |
| | | const result = await request.put(url, { |
| | | status: body.status |
| | | }) |
| | | return result.data |
| | | } |
| | | |
| | | // Upload Wayline file |
| | | export const importKmzFile = async function (workspaceId: string, file: {}): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/waylines/file/upload` |