<template>
  <div class="inline-16">
    <el-popconfirm
        title="确定要删除该联系人吗？"
        @confirm="toVoidRow()">
      <el-button slot="reference" size="small" type="text" :disabled="!tool.checkAuth($route.name,'contactManage') || !disabled">删 除</el-button>
    </el-popconfirm>
  </div>
</template>

<script>
export default {
  name: "toVoid",
  props:["data","disabled"],
  data(){
    return {
      form:{
        "contactsid": '',
        "sys_enterpriseid": '',
        "deletereason":"",
        "ownerid": this.$route.query.id,
        "ownertable": "sa_customers"
      },
      rules:{
        deletereason:[
          { required: true, message: '作废原因不能为空', trigger: 'blur' },
        ]
      }
    }
  },
  methods:{
    toVoidRow(){
      this.form.sys_enterpriseid = this.data.sys_enterpriseid
      this.form.contactsid = this.data.contactsid
      this.onSubmit()
    },
    async onSubmit(){
      const res = await this.$api.requested({
        "id": "20221018145502",
        "content": this.form
      })
      this.tool.showMessage(res,()=>{
        this.$emit("toVoidSuccess")
        this.$refs['form'].resetFields()
      })

    }
  }
}
</script>

<style scoped>

</style>