From 54849757852f6ab40eb17afbd03d1d839b60a38d Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 13 Nov 2023 17:09:15 +0800
Subject: [PATCH] 重复定时和连续执行
---
src/components/task/TaskPanel.vue | 82 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 72 insertions(+), 10 deletions(-)
diff --git a/src/components/task/TaskPanel.vue b/src/components/task/TaskPanel.vue
index f432ac5..2309581 100644
--- a/src/components/task/TaskPanel.vue
+++ b/src/components/task/TaskPanel.vue
@@ -33,7 +33,7 @@
<!--表格-->
<div class="plan-panel-wrapper">
- <a-table :loading="tableLoading" class="plan-table" :columns="columns" :data-source="plansData.data"
+ <a-table :loading="tableLoading" class="plan-table" :columns="columns" :data-source="plansData.data" @expand="expand" :indentSize="200"
row-key="job_id"
:pagination="paginationProp" :scroll="{ x: '100%', y: 600 }" @change="refreshData">
<!-- 执行时间 -->
@@ -146,7 +146,7 @@
getWaylineJobs,
Task,
uploadMediaFileNow,
- TaskQueryParam
+ TaskQueryParam, getWaylineChildrenJobs
} from '/@/api/wayline'
import { useMyStore } from '/@/store'
import { ELocalStorageKey } from '/@/types/enums'
@@ -166,6 +166,7 @@
import { getErrorMessage } from '/@/utils/error-code/index'
import { commonColor } from '/@/utils/color'
import { ExclamationCircleOutlined, UploadOutlined } from '@ant-design/icons-vue'
+import { timestampToTime } from '/@/utils/time'
const store = useMyStore()
const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)!
@@ -193,9 +194,17 @@
const searchQuery = reactive<TaskQueryParam>({
taskType: ''
})
+
+function getSearchTime (n:number) {
+ const nowStamp = new Date().getTime()
+ const timestamp = nowStamp + (n * 60 * 60 * 1000 * 24)
+ const time = timestampToTime(timestamp)
+ return time
+}
+
const statusArr = reactive([])
const timeRangeArr = reactive({
- data: [] as string[]
+ data: [getSearchTime(-3), getSearchTime(3)] as string[]
})
const body: IPage = {
@@ -216,19 +225,20 @@
{
title: '计划|实际时间',
dataIndex: 'duration',
- width: 200,
+ width: 240,
slots: { customRender: 'duration' },
},
{
title: '执行状态',
key: 'status',
- width: 150,
+ width: 80,
slots: { customRender: 'status' }
},
{
title: '计划名称',
dataIndex: 'job_name',
- width: 100,
+ ellipsis: true,
+ width: 170,
},
{
title: '设备名称',
@@ -323,6 +333,27 @@
getPlans()
})
+function expand (expand:any, record:any) {
+ if (!expand) {
+ return
+ }
+ tableLoading.value = true
+ const params = {
+ parentId: record.job_id
+ }
+
+ getWaylineChildrenJobs(workspaceId, params).then(res => {
+ const data = res.data
+ plansData.data.forEach(item => {
+ if (item.job_id === record.job_id) {
+ item.children = data
+ }
+ })
+
+ tableLoading.value = false
+ })
+}
+
function dateChange (value: any) {
searchQuery.startTime = value[0]
searchQuery.endTime = value[1]
@@ -343,12 +374,22 @@
}
function getPlans () {
+ searchQuery.startTime = timeRangeArr.data[0]
+ searchQuery.endTime = timeRangeArr.data[1]
+
console.log('计划查询请求参数', searchQuery)
tableLoading.value = true
getWaylineJobs(workspaceId, body, searchQuery).then(res => {
if (res.code !== 0) {
return
}
+
+ res.data.list.forEach(e => {
+ if (e.has_children === '1') {
+ e.children = []
+ }
+ })
+
plansData.data = res.data.list
paginationProp.total = res.data.pagination.total
paginationProp.current = res.data.pagination.page
@@ -372,7 +413,7 @@
job_id: jobId
})
if (code === 0) {
- message.success('Deleted successfully')
+ message.success('删除成功')
getPlans()
}
}
@@ -384,7 +425,7 @@
status: UpdateTaskStatus.Suspend
})
if (code === 0) {
- message.success('Suspended successfully')
+ message.success('暂停成功')
getPlans()
}
}
@@ -396,7 +437,7 @@
status: UpdateTaskStatus.Resume
})
if (code === 0) {
- message.success('Resumed successfully')
+ message.success('恢复成功')
getPlans()
}
}
@@ -405,7 +446,7 @@
async function onUploadMediaFileNow (jobId: string) {
const { code } = await uploadMediaFileNow(workspaceId, jobId)
if (code === 0) {
- message.success('Upload Media File successfully')
+ message.success('上传媒体文件成功')
getPlans()
}
}
@@ -419,6 +460,24 @@
.plan-table {
background: #fff;
margin-top: 10px;
+
+ :deep(.ant-table-tbody) {
+
+ tr.ant-table-row-level-0 {
+ td:first-child {
+ display: flex;
+ align-items: center;
+ }
+ }
+
+ tr.ant-table-row-level-1 {
+ td:first-child {
+ padding-left: 60px;
+ }
+ }
+
+
+ }
}
.action-area {
@@ -465,4 +524,7 @@
}
}
+
+
+
</style>
--
Gitblit v1.9.3