<template>
  <div v-if="data.status === '已下达' && checkDate()" class="inline-16">
    <el-button size="mini" type="primary" @click="adjustmentRow">调 整</el-button>
  </div>
</template>

<script>
export default {
  props:['data'],
  methods:{
    async adjustmentRow () {
      this.$confirm('是否确认调整人员目标，仅可调整当前年度剩余月份目标', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const res = await this.$api.requested({
          "id": 20220901110102,
          "content": {
            "sa_salestargetbillid": this.data.sa_salestargetbillid
          },  
        })
        this.tool.showMessage(res,()=>{
          this.$emit('onSuccess')
        })
      })
    },
    checkDate () {
      let date = new Date()
      let year = date.getFullYear()
      let month = date.getMonth() + 1
      if (year <= this.data.year) 
        return true
    }
  },
  mounted () {
    // console.log(this.checkDate())
  }
}

</script>
<style>
</style>