added batch enable/disable schedules

This commit is contained in:
marvzhang
2020-07-18 21:16:19 +08:00
parent 695bd3ddf5
commit cb7cfb3224
2 changed files with 44 additions and 0 deletions

View File

@@ -235,6 +235,26 @@
>
{{ $t('Add Schedule') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
type="primary"
icon="el-icon-check"
class="btn-enable"
@click="onBatchEnable"
>
{{ $t('Enable') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
type="info"
icon="el-icon-close"
class="btn-disable"
@click="onBatchDisable"
>
{{ $t('Disable') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
@@ -678,6 +698,26 @@
this.$st.sendEv('定时任务', '批量删除定时任务')
})
},
async onBatchEnable() {
await this.$request.post('/schedules-set-enabled', {
schedule_ids: this.selectedSchedules.map(d => d._id),
enabled: true
})
this.$message.success('Enabled successfully')
this.$refs['table'].clearSelection()
await this.$store.dispatch('schedule/getScheduleList')
this.$st.sendEv('定时任务', '批量启用定时任务')
},
async onBatchDisable() {
await this.$request.post('/schedules-set-enabled', {
schedule_ids: this.selectedSchedules.map(d => d._id),
enabled: false
})
this.$message.success('Disabled successfully')
this.$refs['table'].clearSelection()
await this.$store.dispatch('schedule/getScheduleList')
this.$st.sendEv('定时任务', '批量禁用定时任务')
},
isShowRun(row) {
},
async onEdit(row) {