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

View File

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

View File

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

View File

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