单数据删除并不会报错,但最多批量删除操作两次,服务端就报错,前端拿不到数据
//删除
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.BookId
})
console.log(ids)
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '下架' : '批量下架'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (let i = 0; i < ids.length; i++) {
this.$http({
url: 'bg/downbook',
method: 'get',
params: {
"bookid": ids[i]
}
}).then((res) => {
this.data.push(res.data)
console.log(res.data)
})
}
if (this.data && this.data.map((currentValue)=>{return currentValue.status === 200})) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error("部分下架失败")
}
})
}