diff --git a/frontend/src/store/modules/spider.js b/frontend/src/store/modules/spider.js index ac1fc81b..b6dcf223 100644 --- a/frontend/src/store/modules/spider.js +++ b/frontend/src/store/modules/spider.js @@ -105,15 +105,9 @@ const actions = { }, editSpider ({ state, dispatch }) { return request.post(`/spiders/${state.spiderForm._id}`, state.spiderForm) - .then(() => { - dispatch('getSpiderList') - }) }, deleteSpider ({ state, dispatch }, id) { return request.delete(`/spiders/${id}`) - .then(() => { - dispatch('getSpiderList') - }) }, getSpiderData ({ state, commit }, id) { return request.get(`/spiders/${id}`) diff --git a/frontend/src/views/spider/SpiderList.vue b/frontend/src/views/spider/SpiderList.vue index d01b657f..b068448a 100644 --- a/frontend/src/views/spider/SpiderList.vue +++ b/frontend/src/views/spider/SpiderList.vue @@ -105,7 +105,8 @@ - + { - this.$store.dispatch('spider/deleteSpider', row._id) - .then(() => { - this.$message({ - type: 'success', - message: 'Deleted successfully' - }) - }) + }).then(async () => { + await this.$store.dispatch('spider/deleteSpider', row._id) + this.$message({ + type: 'success', + message: 'Deleted successfully' + }) + await this.getList() this.$st.sendEv('爬虫列表', '删除爬虫') }) }, @@ -721,7 +721,7 @@ export default { this.filter.type = tab.name this.getList() }, - getList () { + async getList () { let params = { page_num: this.pagination.pageNum, page_size: this.pagination.pageSize, @@ -730,7 +730,7 @@ export default { keyword: this.filter.keyword, type: this.filter.type } - this.$store.dispatch('spider/getSpiderList', params) + await this.$store.dispatch('spider/getSpiderList', params) } }, async created () {