From 0eccf24c5350962baec3beb8754775657ccfa7e2 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Wed, 13 Sep 2023 15:48:53 +0800
Subject: [PATCH] 人员,设备

---
 src/types/task.ts |  111 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 93 insertions(+), 18 deletions(-)

diff --git a/src/types/task.ts b/src/types/task.ts
index cd5d97a..9233acb 100644
--- a/src/types/task.ts
+++ b/src/types/task.ts
@@ -2,32 +2,103 @@
 
 // 任务类型
 export enum TaskType {
-  Immediate = 0, // 立即执行
-  Single = 1, // 单次定时任务
+  Immediate = 1, // 立即执行
+  Timed = 2, // 单次定时任务
+  RepeatTimed = 3, // 重复定时任务
+  Continuous//连续执行
 }
 
 export const TaskTypeMap = {
-  [TaskType.Immediate]: 'Immediate',
-  [TaskType.Single]: 'Timed & One-Time',
+  [TaskType.Immediate]: '立即',
+  [TaskType.Timed]: '单次定时',
+  [TaskType.RepeatTimed]: '重复定时',
+  [TaskType.Continuous]: '连续执行',
 }
+
+export const TaskTypeOptions = [
+  { value: TaskType.Immediate, label: TaskTypeMap[TaskType.Immediate] },
+  { value: TaskType.Timed, label: TaskTypeMap[TaskType.Timed] },
+  { value: TaskType.RepeatTimed, label: TaskTypeMap[TaskType.RepeatTimed] },
+  { value: TaskType.Continuous, label: TaskTypeMap[TaskType.Continuous] },
+]
+
+//频率类型
+export enum FrequencyType {
+  day = 1, // 日
+  week = 2, // 周
+  month = 3, // 月
+}
+
+export const FrequencyTypeMap = {
+  [FrequencyType.day]: '日',
+  [FrequencyType.week]: '周',
+  [FrequencyType.month]: '月',
+}
+
+
+export const FrequencyTypeOptions = [
+  { value: FrequencyType.month, label: FrequencyTypeMap[FrequencyType.month]},
+  { value: FrequencyType.week, label: FrequencyTypeMap[FrequencyType.week] },
+  { value: FrequencyType.day, label: FrequencyTypeMap[FrequencyType.day] },
+]
+
+// 重复规则时间类型
+export enum RepeatRuleType {
+  day = 1, // 按日期
+  week = 2, // 按星期
+}
+
+export const RepeatRuleTypeMap = {
+  [RepeatRuleType.day]: '按日期',
+  [RepeatRuleType.week]: '按星期',
+}
+
+export const RepeatRuleTypeOptions=[
+  { value: RepeatRuleType.day, label: RepeatRuleTypeMap[RepeatRuleType.day] },
+  { value: RepeatRuleType.week, label: RepeatRuleTypeMap[RepeatRuleType.week] },
+]
+
+export const WhichWeekOptions = [
+  {value: 1, label: '第一个'},
+  {value: 2, label: '第二个'},
+  {value: 3, label: '第三个'},
+  {value: 4, label: '第四个'},
+]
+export const WhichDayOptions = [
+  {value: 7, label: '周日'},
+  {value: 1, label: '周一'},
+  {value: 2, label: '周二'},
+  {value: 3, label: '周三'},
+  {value: 4, label: '周四'},
+  {value: 5, label: '周五'},
+  {value: 6, label: '周六'},
+]
+
 
 // 失控动作
 export enum OutOfControlAction {
-  ReturnToHome = 0,
-  Hover = 1,
-  Land = 2,
+  ReturnToHome = 0, //返航
+  Hover = 1, //盘旋
+  Land = 2, //降落
+  Continue//继续执行
 }
 
 export const OutOfControlActionMap = {
-  [OutOfControlAction.ReturnToHome]: 'Return to Home',
-  [OutOfControlAction.Hover]: 'Hover',
-  [OutOfControlAction.Land]: 'Land',
+  [OutOfControlAction.ReturnToHome]: '返航',
+  [OutOfControlAction.Hover]: '盘旋',
+  [OutOfControlAction.Land]: '降落',
+  [OutOfControlAction.Continue]: '继续执行'
 }
 
 export const OutOfControlActionOptions = [
   { value: OutOfControlAction.ReturnToHome, label: OutOfControlActionMap[OutOfControlAction.ReturnToHome] },
-  { value: OutOfControlAction.Hover, label: OutOfControlActionMap[OutOfControlAction.Hover] },
-  { value: OutOfControlAction.Land, label: OutOfControlActionMap[OutOfControlAction.Land] },
+  // { value: OutOfControlAction.Hover, label: OutOfControlActionMap[OutOfControlAction.Hover] },
+  // { value: OutOfControlAction.Land, label: OutOfControlActionMap[OutOfControlAction.Land] },
+  { value: OutOfControlAction.Continue, label: OutOfControlActionMap[OutOfControlAction.Continue] },
+]
+
+export const FinishActionOptions = [
+  {value:1,label:"自动返航"}
 ]
 
 // 任务状态
@@ -37,14 +108,17 @@
   Success = 3, // 完成
   CanCel = 4, // 取消
   Fail = 5, // 失败
+  Paused = 6, // 暂停
 }
 
 export const TaskStatusMap = {
-  [TaskStatus.Wait]: 'To be performed',
-  [TaskStatus.Carrying]: 'In progress',
-  [TaskStatus.Success]: 'Task completed',
-  [TaskStatus.CanCel]: 'Task canceled',
-  [TaskStatus.Fail]: 'Task failed',
+  [TaskStatus.Wait]: '待执行',
+  [TaskStatus.Carrying]: '进行中',
+  [TaskStatus.Success]: '任务完成',
+  [TaskStatus.CanCel]: '任务取消',
+  [TaskStatus.Fail]: '任务失败',
+  [TaskStatus.Paused]: '已暂停',
+
 }
 
 export const TaskStatusColor = {
@@ -53,6 +127,7 @@
   [TaskStatus.Success]: commonColor.NORMAL,
   [TaskStatus.CanCel]: commonColor.FAIL,
   [TaskStatus.Fail]: commonColor.FAIL,
+  [TaskStatus.Paused]: commonColor.BLUE,
 }
 
 // 任务执行 ws 消息状态
@@ -93,7 +168,7 @@
   [TaskProgressStatus.Failed]: TaskStatus.Fail,
   [TaskProgressStatus.Canceled]: TaskStatus.CanCel,
   [TaskProgressStatus.Timeout]: TaskStatus.Fail,
-  [TaskProgressStatus.Paused]: TaskStatus.Wait,
+  [TaskProgressStatus.Paused]: TaskStatus.Paused,
 }
 
 // 根据媒体文件上传进度信息,前端自己判断出的状态

--
Gitblit v1.9.3