diff --git a/frontend/src/store/modules/schedule.js b/frontend/src/store/modules/schedule.js
index 663abdfa..b6b5b47b 100644
--- a/frontend/src/store/modules/schedule.js
+++ b/frontend/src/store/modules/schedule.js
@@ -26,14 +26,13 @@ const actions = {
getScheduleList({ state, commit }) {
request.get('/schedules')
.then(response => {
- if (response.data.data) {
- commit('SET_SCHEDULE_LIST', response.data.data.map(d => {
- const arr = d.cron.split(' ')
- arr.splice(0, 1)
- d.cron = arr.join(' ')
- return d
- }))
- }
+ if (!response.data.data) response.data.data = []
+ commit('SET_SCHEDULE_LIST', response.data.data.map(d => {
+ const arr = d.cron.split(' ')
+ arr.splice(0, 1)
+ d.cron = arr.join(' ')
+ return d
+ }))
})
},
addSchedule({ state }) {
diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue
index 24c25a96..d1f33f1c 100644
--- a/frontend/src/views/schedule/ScheduleList.vue
+++ b/frontend/src/views/schedule/ScheduleList.vue
@@ -235,18 +235,36 @@
>
{{ $t('Add Schedule') }}
+
+ {{ $t('Remove') }}
+
+
{
+ try {
+ const res = await this.$request.delete('/schedules', {
+ ids: this.selectedSchedules.map(d => d._id)
+ })
+ if (!res.data.error) {
+ this.$message.success('Deleted successfully')
+ this.$refs['table'].clearSelection()
+ await this.$store.dispatch('schedule/getScheduleList')
+ }
+ } finally {
+ // do nothing
+ }
+ this.$st.sendEv('定时任务', '批量删除定时任务')
+ })
+ },
isShowRun(row) {
},
async onEdit(row) {
@@ -750,6 +790,9 @@
setTimeout(() => {
this.$store.dispatch('schedule/getScheduleList')
}, 1000)
+ },
+ onScheduleSelect(schedules) {
+ this.selectedSchedules = schedules
}
}
}