<template>
  <div>
    <list ref="list" :campaigntypeList="campaigntypeList">
      <add :campaigntypeList="campaigntypeList" v-if="tool.checkAuth($route.name,'insert')" slot="add" @onSuccess="onSuccess"></add>
      <template v-slot:detail="scope">
        <el-button class="inline-16" type="text" size="small" @click="$router.push({path:'/marketing_activityDetails',query:{id:scope.data.sat_campaignid}})">详 情</el-button>
      </template>
      <template v-slot:edit="scope">
        <edit :campaigntypeList="campaigntypeList" v-if="tool.checkAuth($route.name,'update')" :data="scope.data" @onSuccess="onSuccess"></edit>
      </template>
      <template v-slot:relase="scope">
        <relase v-if="tool.checkAuth($route.name,'relase')" :data="scope.data" @onSuccess="onSuccess"></relase>
      </template>
      <template v-slot:finish="scope">
        <finish v-if="tool.checkAuth($route.name,'finish')" :data="scope.data" @onSuccess="onSuccess"></finish>
      </template>
    </list>
  </div>
</template>

<script>
import list from './modules/list.vue'
import add from './modules/add.vue'
import edit from './modules/edit.vue'
import relase from './modules/relase.vue'
import finish from './modules/finish.vue'

export default {
  components:{
    list,
    add,
    edit,
    relase,
    finish
  },
  data () {
    return {
      campaigntypeList:[]
    }
  },
  methods:{
    onSuccess(){
      this.$refs['list'].listData()
    },
    async campaigntype () {
      const res = await this.$api.requested({
        "id": 20220901092501,
        "content": {
          "typename":'campaigntype'
        }
      })
      this.campaigntypeList = res.data
    }
  },
  mounted () {
    this.campaigntype()
  }
}

</script>
<style>
</style>