<template>
  <el-button slot="reference" size="small" type="text" @click="open">删除</el-button>
</template>

<script>
export default {
  props: ['data'],
  methods: {
    open() {
      this.$confirm('此操作将永久删除该分类, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => this.deleteRow())
    },
    deleteRow() {
      this.$api.requested({
        "classname": "webmanage.saletool.sharematerial.sharematerialClass",
        "method": "delete",
        "content": {
          "sat_sharematerial_classid": this.data.sat_sharematerial_classid
        }
      }).then(res => {
        this.tool.showMessage(res)
        res.code === 1 ? this.$emit('onSuccess') : ''
      })
    },
  }
}

</script>
