<template>
  <div>
    <list ref="list">
      <template #add>
        <add v-if="tool.checkAuth($route.name,'insert')" @onSuccess="onSuccess"></add>
      </template>
      <template v-slot:detail="scope">
        <el-button type="text" size="small" @click="$router.push({path:'/personalTarget_edit',query:{id:scope.data.sa_salestargetbillid,type:'onlyread'}})">详 情</el-button>
      </template>
      <template v-slot:edit="scope">
        <el-button :disabled="scope.data.status === '已下达'" v-if="tool.checkAuth($route.name,'update')" class="inline-16" type="text" size="small" @click="$router.push({path:'/personalTarget_edit',query:{id:scope.data.sa_salestargetbillid}})">编 辑</el-button>
      </template>
      <template v-slot:issue="scope">
        <onissue v-if="tool.checkAuth($route.name,'issue')" :data="scope.data" @onSuccess="onSuccess"></onissue>
      </template>
      <template v-slot:adjustment="scope">
        <adjustment v-if="tool.checkAuth($route.name,'adjust')" :data="scope.data" @onSuccess="onSuccess"></adjustment>
      </template>
    </list>
  </div>
</template>

<script>
import list from './modules/list.vue'
import add from './modules/add.vue'
import onissue from './modules/issue.vue'
import adjustment from './modules/adjustment.vue'

export default {
  components:{
    list,
    add,
    onissue,
    adjustment
  },
  methods:{
    onSuccess () {
      this.$refs['list'].listData()
    }
  }
}
</script>
<style>
</style>