add task retry & task finish function

This commit is contained in:
龚祖望 2023-09-07 09:34:41 +08:00
parent 9515161666
commit 54a974611a
2 changed files with 51 additions and 5 deletions

View File

@ -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) { export function getTaskList(data) {
return request({ return request({
url: '/ota/getAll', url: '/ota/getAll',

View File

@ -204,11 +204,11 @@
>{{ item.statusDesc }}</el-tag> >{{ item.statusDesc }}</el-tag>
</p> </p>
<p> <p>
<el-tooltip content="置为成功"> <el-tooltip content="任务重试">
<i class="el-icon-success success" /> <i class="el-icon-refresh-right success" @click="retryTask(item)" />
</el-tooltip> </el-tooltip>
<el-tooltip content="置为失败"> <el-tooltip content="强制结束">
<i class="el-icon-error error" /> <i class="el-icon-close error" @click="endTask(item.id)" />
</el-tooltip> </el-tooltip>
</p> </p>
</div> </div>
@ -280,6 +280,8 @@ import {
getByName, getByName,
getTaskList, getTaskList,
addTask, addTask,
endTask,
retryTask,
getClient getClient
} from '@/api/terminal/ota.js' } from '@/api/terminal/ota.js'
@ -518,6 +520,34 @@ export default {
}) })
this.taskListVisible = true 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) { refresh(needMsg = true) {
getTaskList({ fileName: this.currentFileName }).then((res) => { getTaskList({ fileName: this.currentFileName }).then((res) => {
if (needMsg) { if (needMsg) {
@ -769,7 +799,7 @@ export default {
display: grid; display: grid;
justify-content: space-around; justify-content: space-around;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 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; grid-gap: 0 20px;
height: 100%; height: 100%;
width: 100%; width: 100%;