批量删除服务端数据,导致服务端报错,前端获取数据失败

单数据删除并不会报错,但最多批量删除操作两次,服务端就报错,前端拿不到数据

img

img

//删除
      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("部分下架失败")
          }
        })
      }

这样操作请求次数太频繁了,直接把数组传到后台批量处理,后台接收数组即可。

批量删除中的数据有没有前端要取的?有的话属于误删,前端取不到值肯定报错