<template>
  <div style="display:inline;margin:0 16px">
    <el-button slot="reference" size="small" type="text" @click="open">删除</el-button>
  </div>
</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.sharematerial",
        "method": "delete",
        "content": {
          "sat_sharematerialid": [this.data.sat_sharematerialid]
        }
      }).then(res => {
        this.tool.showMessage(res)
        res.code === 1 ? this.$emit('onSuccess') : ''
      })
    },
  }
}

</script>
