feat: 增加utask 恢复功能

This commit is contained in:
caoqianming 2024-06-25 09:13:33 +08:00
parent 74ba7e6f97
commit c384335ebe
5 changed files with 36 additions and 31 deletions

View File

@ -179,5 +179,13 @@ export default {
);
}
},
toggle:{
name: "停止/恢复任务",
req: async function(id){
return await http.post(
`${config.API_URL}/pm/utask/${id}/toggle/`
);
}
},
}
}

View File

@ -61,7 +61,7 @@
编辑
</el-link>
<el-divider direction="vertical" v-if="scope.row.state==30"></el-divider>
<el-link type="primary" @click="table_end(scope.row)" v-if="scope.row.state==30">终止</el-link>
<el-link type="primary" @click="table_toggle(scope.row)" v-if="scope.row.state==30">终止</el-link>
<el-divider direction="vertical" v-if="scope.row.state==10||scope.row.state==20"></el-divider>
<el-link type="danger" @click="table_del(scope.row)" v-if="scope.row.state==10||scope.row.state==20">
删除
@ -189,8 +189,8 @@
编辑
</el-link>
<el-divider direction="vertical" v-if="scope.row.state == 30 || scope.row.state == 20"></el-divider>
<el-link type="danger" @click="table_end(scope.row)"
v-if="scope.row.state == 30 || scope.row.state == 20">终止</el-link>
<el-link type="danger" @click="table_toggle(scope.row)"
v-if="scope.row.state == 30 || scope.row.state == 34">停止/恢复</el-link>
<el-divider direction="vertical" v-if="scope.row.state == 10 || scope.row.state == 14"></el-divider>
<el-link type="danger" @click="table_del(scope.row)"
v-if="scope.row.state == 10 || scope.row.state == 14">
@ -427,12 +427,12 @@ export default {
.catch(() => { });
},
//
table_end(row) {
this.$confirm(`确定终止该任务吗?`, "提示", {
table_toggle(row) {
this.$confirm(`确定停止/恢复该任务吗?`, "提示", {
type: "warning",
})
.then(() => {
this.$API.pm.utask.stop
this.$API.pm.utask.toggle
.req(row.id)
.then((res) => {
this.$message.success("操作成功");

View File

@ -178,17 +178,14 @@
</template>
</el-popconfirm>
<el-popconfirm
title="确定终止该任务吗?"
@confirm.stop="table_stop(scope.row)"
v-if="scope.row.state == 30"
v-auth="'utask.stop'"
title="确定停止/恢复该任务吗?"
@confirm.stop="table_toggle(scope.row)"
v-if="scope.row.state == 30 || scope.row.state == 34"
v-auth="'utask.toggle'"
>
<template #reference>
<el-button
link
type="danger"
v-if="scope.row.state == 30"
>终止</el-button
<el-button link type="danger"
>/</el-button
>
</template>
</el-popconfirm>
@ -437,8 +434,8 @@ export default {
return err;
});
},
table_stop(row) {
this.$API.pm.utask.stop
table_toggle(row) {
this.$API.pm.utask.toggle
.req(row.id)
.then((res) => {
this.$message.success("操作成功");

View File

@ -185,14 +185,14 @@
</template>
</el-popconfirm>
<el-popconfirm
title="确定终止该任务吗?"
@confirm.stop="table_stop(scope.row)"
v-if="scope.row.state == 30"
v-auth="'utask.stop'"
title="确定停止/恢复该任务吗?"
@confirm.stop="table_toggle(scope.row)"
v-if="scope.row.state == 30||scope.row.state == 34"
v-auth="'utask.toggle'"
>
<template #reference>
<el-button link type="danger"
>终止</el-button
>停止/恢复</el-button
>
</template>
</el-popconfirm>
@ -464,8 +464,8 @@ export default {
return err;
});
},
table_stop(row) {
this.$API.pm.utask.stop
table_toggle(row) {
this.$API.pm.utask.toggle
.req(row.id)
.then((res) => {
this.$message.success("操作成功");

View File

@ -178,14 +178,14 @@
</template>
</el-popconfirm>
<el-popconfirm
title="确定终止该任务吗?"
@confirm.stop="table_stop(scope.row)"
v-if="scope.row.state == 30"
v-auth="'utask.stop'"
title="确定停止/恢复该任务吗?"
@confirm.stop="table_toggle(scope.row)"
v-if="scope.row.state == 30 || scope.row.state == 34"
v-auth="'utask.toggle'"
>
<template #reference>
<el-button link type="danger"
>终止</el-button
>/</el-button
>
</template>
</el-popconfirm>
@ -425,8 +425,8 @@ export default {
return err;
});
},
table_stop(row) {
this.$API.pm.utask.stop
table_toggle(row) {
this.$API.pm.utask.toggle
.req(row.id)
.then((res) => {
this.$message.success("操作成功");