<template>
  <div>
    <el-button size="small" class="inline-16" :type="length === 0?'':'primary'" @click="onshow" :disabled="length === 0" >批量恢复</el-button>
  </div>
</template>

<script>
export default {
  name: "batchRecovery",
  props:["sys_object","ownerids"],
  data(){
    return {
      length:0
    }
  },
  methods:{
    onshow() {
      this.$confirm('数据恢复至原账号原位置，是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        closeOnClickModal:false,
        type: 'warning'
      }).then(() => {
        this.onRecovery()
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    async onRecovery(){
      const res = await this.$api.requested({
        "id": 20230103131104,
        "content": {
          "sys_object": this.sys_object,//1-线索,2-客户,3-合同,4-项目商机,5-报价单
          "ownerids": this.ownerids
        }
      })
      this.tool.showMessage(res,()=>{
        this.$emit("recoverySuccess")
      })
    }
  }
}
</script>

<style scoped>

</style>