<template>
  <div>
    <add v-if="tool.checkAuth($route.name,'insert')" @onSuccess="onSuccess"></add>
    <tepList ref="teplist" @tableRowClick="tableRowClick">
      <template v-slot:edit="scope">
        <edit  v-if="tool.checkAuth($route.name,'update')" :data="scope.data" @onSuccess="onSuccess"></edit>
      </template>
      <template v-slot:del="scope">
        <ondel v-if="tool.checkAuth($route.name,'delete')" :data="scope.data" @onSuccess="onSuccess"></ondel>
      </template>
      <template v-slot:release="scope">
        <release v-if="tool.checkAuth($route.name,'update')" :data="scope.data" @onSuccess="onSuccess"></release>
      </template>
      <template v-slot:finish="scope">
        <finish v-if="tool.checkAuth($route.name,'update')" :data="scope.data" @onSuccess="onSuccess"></finish>
      </template>
    </tepList>
    <forecastList ref="forecast">
      <template v-slot:detail="scope">
        <el-button type="text" size="small" @click="$router.push({path:'/salesForecastDetail',query:{id:scope.data.sa_salesforecastbillid,modelid:sa_salesforecastmodelid}})">详 情</el-button>
      </template>
    </forecastList>
  </div>
</template>

<script>
import tepList from './modules/templateList.vue'
import forecastList from './modules/forecastList.vue'

import add from './modules/add.vue'
import edit from './modules/edit.vue'
import ondel from './modules/del.vue'
import release from './modules/release.vue'
import finish from './modules/finish.vue'

export default {
  components:{
    tepList,
    add,
    edit,
    ondel,
    release,
    finish,
    forecastList
  },
  data () {
    return {
      sa_salesforecastmodelid:''
    }
  },
  methods:{
    onSuccess(){
      this.$refs['teplist'].listData()
    },
    tableRowClick (row) {
      this.sa_salesforecastmodelid = row.sa_salesforecastmodelid
      this.$refs['forecast'].listData(row.sa_salesforecastmodelid,1)
    },
  }
}

</script>
<style>
</style>