From 54a974611a1c1d240b26ff0d864ecd8cc1bfff02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E7=A5=96=E6=9C=9B?= <573413756@qq.com> Date: Thu, 7 Sep 2023 09:34:41 +0800 Subject: [PATCH] add task retry & task finish function --- xiuosiot-frontend/src/api/terminal/ota.js | 16 ++++++++ .../src/views/terminal/OTA/index.vue | 40 ++++++++++++++++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/xiuosiot-frontend/src/api/terminal/ota.js b/xiuosiot-frontend/src/api/terminal/ota.js index 603d734..68af63c 100644 --- a/xiuosiot-frontend/src/api/terminal/ota.js +++ b/xiuosiot-frontend/src/api/terminal/ota.js @@ -81,6 +81,22 @@ export function addTask(data) { }) } +export function endTask(data) { + return request({ + url: '/ota/overJob', + method: 'post', + data + }) +} + +export function retryTask(data) { + return request({ + url: '/ota/reTryJob', + method: 'post', + data + }) +} + export function getTaskList(data) { return request({ url: '/ota/getAll', diff --git a/xiuosiot-frontend/src/views/terminal/OTA/index.vue b/xiuosiot-frontend/src/views/terminal/OTA/index.vue index 88d6dca..e776b2c 100644 --- a/xiuosiot-frontend/src/views/terminal/OTA/index.vue +++ b/xiuosiot-frontend/src/views/terminal/OTA/index.vue @@ -204,11 +204,11 @@ >{{ item.statusDesc }}

- - + + - - + +

@@ -280,6 +280,8 @@ import { getByName, getTaskList, addTask, + endTask, + retryTask, getClient } from '@/api/terminal/ota.js' @@ -518,6 +520,34 @@ export default { }) this.taskListVisible = true }, + retryTask(task) { + const data = { + fileName: task.fileName, + deviceId: task.deviceId, + createTime: task.createTime, + fileVersion: task.fileVersion, + updateType: task.updateType, + id: task.id + } + this.$confirm('确认重试任务?', '提示', { type: 'warning' }).then(() => { + retryTask(data).then(res => { + if (res.code === '200000') { + this.$message.success('任务重试发起成功') + this.refresh(false) + } + }) + }).catch(err => {}) + }, + endTask(id) { + this.$confirm('确认强制结束任务?', '提示', { type: 'warning' }).then(() => { + endTask({ id }).then(res => { + if (res.code === '200000') { + this.$message.success('任务强制结束成功') + this.refresh() + } + }) + }).catch(err => {}) + }, refresh(needMsg = true) { getTaskList({ fileName: this.currentFileName }).then((res) => { if (needMsg) { @@ -769,7 +799,7 @@ export default { display: grid; justify-content: space-around; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); - grid-template-rows: repeat(auto-fill, 260px); + grid-template-rows: repeat(auto-fill, 290px); grid-gap: 0 20px; height: 100%; width: 100%;