From 1506caf8aae1422a2b9a6a929fad62aae05d82cc Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 11 Sep 2023 16:51:09 +0800
Subject: [PATCH] 计划

---
 src/api/wayline.ts |   50 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/src/api/wayline.ts b/src/api/wayline.ts
index 230b7a9..04c017c 100644
--- a/src/api/wayline.ts
+++ b/src/api/wayline.ts
@@ -3,7 +3,7 @@
 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>> {
@@ -36,21 +36,35 @@
   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: number
+  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
 }
@@ -80,10 +94,10 @@
   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
 }
 
@@ -120,7 +134,7 @@
 
 // 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, {
     headers: {
       'Content-Type': 'multipart/form-data',

--
Gitblit v1.9.3