| | |
| | | import { TaskType, TaskStatus, OutOfControlAction } from '/@/types/task' |
| | | import { WaylineType } from '/@/types/wayline' |
| | | |
| | | const HTTP_PREFIX = 'drone/waylineFile' |
| | | const HTTP_PREFIX = '/api/drone' |
| | | |
| | | // Get Wayline Files |
| | | export const getWaylineFiles = async function (wid: string, body: {}): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${wid}/waylines?order_by=${body.order_by}&page=${body.page}&page_size=${body.page_size}` |
| | | const result = await request.get(url) |
| | | export const getWaylineFiles = async function (params:any): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/waylineFile/getList` |
| | | const result = await request.get(url, { params }) |
| | | return result.data |
| | | } |
| | | |
| | |
| | | return result.data |
| | | } |
| | | |
| | | export interface CreatePlan { |
| | | name: string, |
| | | file_id: string, |
| | | dock_sn: string, |
| | | task_type: TaskType, // 任务类型 |
| | | wayline_type: WaylineType, // 航线类型 |
| | | task_days?: number[] // 执行任务的日期(秒) |
| | | task_periods?: number[][] // 执行任务的时间点(秒) |
| | | rth_altitude: number // 相对机场返航高度 20 - 500 |
| | | out_of_control_action: OutOfControlAction // 失控动作 |
| | | 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 |
| | | } |
| | | |
| | | // Create Wayline Job |
| | | export const createPlan = async function (workspaceId: string, plan: CreatePlan): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/flight-tasks` |
| | | // 新增计划 |
| | | export const createPlan = async function (plan:any): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/waylineJob/add` |
| | | const result = await request.post(url, plan) |
| | | return result.data |
| | | } |
| | |
| | | uploaded_count: number // 已上传媒体数量 |
| | | } |
| | | |
| | | // Get Wayline Jobs |
| | | // 获取计划列表(分页) |
| | | export const getWaylineJobs = async function (workspaceId: string, page: IPage): 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 url = `${HTTP_PREFIX}/waylineJob/getPage` |
| | | const result = await request.get(url, { params: { workspaceId } }) |
| | | 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}/waylineFile/upload` |
| | | const result = await request.post(url, file, { |
| | | params: { |
| | | projectId: workspaceId |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data', |
| | | } |