修复删除后获取所有爬虫的bug

This commit is contained in:
marvzhang
2020-01-30 11:13:39 +08:00
parent caabd099ef
commit 02ed470278
2 changed files with 11 additions and 17 deletions

View File

@@ -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}`)

View File

@@ -105,7 +105,8 @@
<el-input v-model="spiderForm.display_name" :placeholder="$t('Display Name')"/>
</el-form-item>
<el-form-item :label="$t('Template')" prop="template" required>
<el-select id="template" v-model="spiderForm.template" :value="spiderForm.template" :placeholder="$t('Template')">
<el-select id="template" v-model="spiderForm.template" :value="spiderForm.template"
:placeholder="$t('Template')">
<el-option
v-for="template in templateList"
:key="template"
@@ -598,14 +599,13 @@ export default {
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'),
type: 'warning'
}).then(() => {
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 () {