<template>
  <div class="inline-16">
    <el-popconfirm title="确定删除当前价格调整单吗？" @confirm="deleteRow()">
      <el-button type="primary" slot="reference" size="mini" :disabled="isEdit()">删 除</el-button>
    </el-popconfirm>
  </div>
</template>

<script>
/* 
id:数据id
nameId:接口id
nameKey:接口字段
 */
export default {
  props: ['id','nameId','nameKey','type','data'],
  inject:['isEdit'],
  data () {
    return {
      param: {
        "id":this.nameId,
        "version":1,
        "content": {
            [this.nameKey]:[this.id]
        }
      },
    }
  },
  methods: {
    async deleteRow() {
      this.param.content[this.nameKey] = [this.id]
      let res = await this.$api.requested(this.param)
      this.tool.showMessage(res,() => {
        this.$emit('deleteSuccess',this.data ? this.data : '')
      })
    },
  },
  created () {
    this.$emit('deleteCreate',this.param)
  }
}

</script>
