<template>
  <div>
    <el-button size="mini" @click="dialog=true">删除</el-button>
    <el-dialog append-to-body width="30%" title="作废" :visible.sync="dialog">
      <el-input type="textarea" size="small" placeholder="作废原因"></el-input>
      <div class="dialog-footer">
        <el-button size="small" @click="dialog = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: '',
  data() {
    return {
      dialog:false,
      deletereason:''
    };
  },
  props:['idName','idKey','id'],
  computed:{
  },
  watch:{
  },
  methods: {
    async onSubmit () {
      let res = await this.$api.requested({
        "id": this.idName,
        "content": {
            [this.idKey]: [this.id],
            "deletereason":this.deletereason
        },
      })
      this.tool.showMessage(res,() => {
        this.dialog = false
        this.$store.dispatch('changeDetailDrawer',false)
        this.$emit('onSuccess')
      })
    }
  },
};
</script>

<style scoped>

</style>
