From b80ee8c883f279e843071e6b53ab9cddec3f88a0 Mon Sep 17 00:00:00 2001
From: 胡思旗 <931347610@qq.com>
Date: Tue, 29 Aug 2023 15:07:13 +0800
Subject: [PATCH] 登录流程对接、项目列表组件封装
---
src/components/task/TaskPanel.vue | 71 +++++++++++++++++++++++++++++++----
1 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/src/components/task/TaskPanel.vue b/src/components/task/TaskPanel.vue
index 5b70155..fd6a204 100644
--- a/src/components/task/TaskPanel.vue
+++ b/src/components/task/TaskPanel.vue
@@ -5,9 +5,15 @@
:pagination="paginationProp" :scroll="{ x: '100%', y: 600 }" @change="refreshData">
<!-- 执行时间 -->
<template #duration="{ record }">
- <div>
- <div>{{ formatTaskTime(record.execute_time) }}</div>
- <div>{{ formatTaskTime(record.end_time) }}</div>
+ <div class="flex-row" style="white-space: pre-wrap">
+ <div>
+ <div>{{ formatTaskTime(record.begin_time) }}</div>
+ <div>{{ formatTaskTime(record.end_time) }}</div>
+ </div>
+ <div class="ml10">
+ <div>{{ formatTaskTime(record.execute_time) }}</div>
+ <div>{{ formatTaskTime(record.completed_time) }}</div>
+ </div>
</div>
</template>
<!-- 状态 -->
@@ -56,7 +62,7 @@
</template>
<!-- 操作 -->
<template #action="{ record }">
- <span class="action-area">
+ <div class="action-area">
<a-popconfirm
v-if="record.status === TaskStatus.Wait"
title="Are you sure you want to delete flight task?"
@@ -66,7 +72,25 @@
>
<a-button type="primary" size="small">Delete</a-button>
</a-popconfirm>
- </span>
+ <a-popconfirm
+ v-if="record.status === TaskStatus.Carrying"
+ title="Are you sure you want to suspend?"
+ ok-text="Yes"
+ cancel-text="No"
+ @confirm="onSuspendTask(record.job_id)"
+ >
+ <a-button type="primary" size="small">Suspend</a-button>
+ </a-popconfirm>
+ <a-popconfirm
+ v-if="record.status === TaskStatus.Paused"
+ title="Are you sure you want to resume?"
+ ok-text="Yes"
+ cancel-text="No"
+ @confirm="onResumeTask(record.job_id)"
+ >
+ <a-button type="primary" size="small">Resume</a-button>
+ </a-popconfirm>
+ </div>
</template>
</a-table>
</div>
@@ -78,7 +102,7 @@
import { TableState } from 'ant-design-vue/lib/table/interface'
import { onMounted } from 'vue'
import { IPage } from '/@/api/http/type'
-import { deleteTask, getWaylineJobs, Task, uploadMediaFileNow } from '/@/api/wayline'
+import { deleteTask, updateTaskStatus, UpdateTaskStatus, getWaylineJobs, Task, uploadMediaFileNow } from '/@/api/wayline'
import { useMyStore } from '/@/store'
import { ELocalStorageKey } from '/@/types/enums'
import { useFormatTask } from './use-format-task'
@@ -109,7 +133,7 @@
{
title: 'Planned/Actual Time',
dataIndex: 'duration',
- width: 160,
+ width: 200,
slots: { customRender: 'duration' },
},
{
@@ -266,6 +290,30 @@
}
}
+// 挂起任务
+async function onSuspendTask (jobId: string) {
+ const { code } = await updateTaskStatus(workspaceId, {
+ job_id: jobId,
+ status: UpdateTaskStatus.Suspend
+ })
+ if (code === 0) {
+ message.success('Suspended successfully')
+ getPlans()
+ }
+}
+
+// 解除挂起任务
+async function onResumeTask (jobId: string) {
+ const { code } = await updateTaskStatus(workspaceId, {
+ job_id: jobId,
+ status: UpdateTaskStatus.Resume
+ })
+ if (code === 0) {
+ message.success('Resumed successfully')
+ getPlans()
+ }
+}
+
// 立即上传媒体
async function onUploadMediaFileNow (jobId: string) {
const { code } = await uploadMediaFileNow(workspaceId, jobId)
@@ -285,8 +333,13 @@
margin-top: 10px;
}
.action-area {
- color: $primary;
- cursor: pointer;
+
+ &::v-deep {
+ .ant-btn {
+ margin-right: 10px;
+ margin-bottom: 10px;
+ }
+ }
}
.circle-icon {
--
Gitblit v1.9.3