<template>
  <div>
    <el-button type="text" size="mini" @click="onshow" :disabled="!tool.checkAuth($route.name,'delData')" style="color: #f56c6c">{{$t('删 除')}}</el-button>
  </div>
</template>

<script>
export default {
  name: "saleClueDel",
  props:["sys_object","ownerid"],
  methods:{
    onshow() {
      this.$confirm(this.$t('是否确认彻底删除数据,一旦删除,无法恢复')+'?', this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        closeOnClickModal:false,
        type: 'warning'
      }).then(() => {
        this.onDel()
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('已取消删除')
        });
      });
    },
    async onDel(){
      const res = await this.$api.requested({
        "id": 20230103131204,
        "content": {
          "sys_object": this.sys_object,//1-线索,2-客户,3-合同,4-项目商机,5-报价单
          "ownerids": [this.ownerid]
        }
      })
      this.tool.showMessage(res,()=>{
        this.$emit("delSuccess")
      })
    }
  }
}
</script>

<style scoped>

</style>
