diff --git a/frontend/src/components/Common/BatchAddScheduleDialog.vue b/frontend/src/components/Common/BatchAddScheduleDialog.vue new file mode 100644 index 00000000..feaa6cc3 --- /dev/null +++ b/frontend/src/components/Common/BatchAddScheduleDialog.vue @@ -0,0 +1,315 @@ + + + + + diff --git a/frontend/src/components/Common/BatchCrawlDialog.vue b/frontend/src/components/Common/BatchCrawlDialog.vue index 42b6647f..09b24589 100644 --- a/frontend/src/components/Common/BatchCrawlDialog.vue +++ b/frontend/src/components/Common/BatchCrawlDialog.vue @@ -157,14 +157,6 @@ ...mapState('node', [ 'nodeList' ]), - isBatchCrawlDialogVisible: { - get() { - return this.$store.state.task.isBatchCrawlDialogVisible - }, - set(value) { - this.$store.commit('task/SET_IS_BATCH_CRAWL_DIALOG_VISIBLE', value) - } - }, activeNodeList() { return this.nodeList.filter(n => n.status === 'online') }, @@ -172,6 +164,9 @@ return this.batchCrawlList.filter(d => !!d.spider_id) }, isConfirmDisabled() { + if (this.validCrawlList.length === 0) { + return true + } for (let i = 0; i < this.validCrawlList.length; i++) { const row = this.validCrawlList[i] const spider = this.getSpiderById(row.spider_id) @@ -243,6 +238,7 @@ })) this.reset() this.$emit('close') + this.$emit('confirm') this.$st.sendEv('批量运行', '确认批量运行') }, async fetchScrapySpiderNames(id) { diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index 02069c48..5c13690e 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -314,6 +314,7 @@ export default { 'Cron Expression': 'Cron 表达式', 'Cron expression is invalid': 'Cron 表达式不正确', 'View Tasks': '查看任务', + 'Batch Add': '批量添加', // 网站 'Site': '网站', diff --git a/frontend/src/store/modules/schedule.js b/frontend/src/store/modules/schedule.js index 7cbe05f7..663abdfa 100644 --- a/frontend/src/store/modules/schedule.js +++ b/frontend/src/store/modules/schedule.js @@ -4,7 +4,8 @@ const state = { scheduleList: [], scheduleForm: { node_ids: [] - } + }, + batchScheduleList: [] } const getters = {} @@ -15,6 +16,9 @@ const mutations = { }, SET_SCHEDULE_FORM(state, value) { state.scheduleForm = value + }, + SET_BATCH_SCHEDULE_LIST(state, value) { + state.batchScheduleList = value } } diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue index d00c95cc..24c25a96 100644 --- a/frontend/src/views/schedule/ScheduleList.vue +++ b/frontend/src/views/schedule/ScheduleList.vue @@ -205,13 +205,30 @@ /> + + + +
+ {{ $t('Batch Add') }} + + { + this.$store.dispatch('schedule/getScheduleList') + }, 1000) } } }