<template>
  <div class="inline-16">
    <el-button type="text" size="mini" @click="releaseNotice">{{data.status === '新建'?'发布':'取消发布'}}</el-button>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {}
  },
  methods:{
    async releaseNotice () {
      const res = await this.$api.requested({
        "classname": "webmanage.saletool.sharematerial.sharematerial",
        "method": "audit",
        "content": {
            "sat_sharematerialid": this.data.sat_sharematerialid,
            "type":this.data.status === '新建'?1:0
        }
      })
      this.tool.showMessage(res)
      res.code === 1?this.$emit('onSuccess'):''
    }
  }
}
</script>