added batch restart tasks

This commit is contained in:
marvzhang
2020-07-18 11:33:07 +08:00
parent af420972ed
commit b1c5ffc540
5 changed files with 72 additions and 20 deletions

View File

@@ -219,25 +219,25 @@ export const constantRouterMap = [
}
]
},
{
path: '/challenges',
component: Layout,
meta: {
title: 'ChallengeList',
icon: 'fa fa-flash'
},
children: [
{
path: '',
name: 'ChallengeList',
component: () => import('../views/challenge/ChallengeList'),
meta: {
title: 'Challenges',
icon: 'fa fa-flash'
}
}
]
},
// {
// path: '/challenges',
// component: Layout,
// meta: {
// title: 'ChallengeList',
// icon: 'fa fa-flash'
// },
// children: [
// {
// path: '',
// name: 'ChallengeList',
// component: () => import('../views/challenge/ChallengeList'),
// meta: {
// title: 'Challenges',
// icon: 'fa fa-flash'
// }
// }
// ]
// },
{
path: '/feedback',
component: Layout,

View File

@@ -56,6 +56,16 @@
>
{{ $t('Cancel') }}
</el-button>
<el-button
v-if="selectedTasks.length > 0"
icon="el-icon-refresh"
class="btn-restart"
size="small"
type="warning"
@click="onRestartMultipleTask"
>
{{ $t('Restart') }}
</el-button>
<el-button
v-if="selectedTasks.length > 0"
icon="el-icon-delete"
@@ -392,6 +402,31 @@
this.$store.dispatch('task/getTaskList')
this.$st.sendEv('任务列表', '搜索')
},
onRestartMultipleTask() {
this.$confirm(this.$t('Are you sure to restart these tasks'), this.$t('Notification'), {
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'),
type: 'warning'
}).then(() => {
const ids = this.selectedTasks.map(item => item._id)
this.$store.dispatch('task/restartTaskMultiple', ids).then((resp) => {
if (resp.data.status === 'ok') {
this.$message({
type: 'success',
message: this.$t('Restarted successfully')
})
this.$store.dispatch('task/getTaskList')
this.$refs['table'].clearSelection()
return
}
this.$message({
type: 'error',
message: resp.data.error
})
})
}).catch(() => {
})
},
onRemoveMultipleTask() {
this.$confirm(this.$t('Are you sure to delete these tasks'), this.$t('Notification'), {
confirmButtonText: this.$t('Confirm'),