<template>
  <div class="m-container">
    <h2>
      <el-page-header @back="onCancel"
                      :content="teamName"></el-page-header>

    </h2>
    <div class="m-core">
      <!-- navMenu -->
      <el-tabs v-model.trim="activeIndex"
               type="card"
               @tab-click="handleClick">
        <el-tab-pane label="基本信息"
                     v-if="permission('/resetTeaming/teamBaseInfo')"
                     name="1">
          <teamBaseInfo v-if="activeIndex == 1"
                        @getBaseInfo="getBaseInfo"
                        :baseInfo="baseInfo"
                        @getName='getName' />
        </el-tab-pane>
        <el-tab-pane label="声部设置"
                     v-if="permission('/resetTeaming/resetSound')"
                     name="2">
          <resetSound v-if="activeIndex == 2" />
        </el-tab-pane>
        <!-- <el-tab-pane label="学员缴费设置"
                     v-if="permission('/resetTeaming/studentPayBase')"
                     name="4">
          <studentPayBase v-if="activeIndex == 4" />
        </el-tab-pane> -->
        <el-tab-pane label="学员缴费设置"
                     v-if="permission('/resetTeaming/resetPayList')"
                     name="3">
          <resetPayList :baseInfo="baseInfo"
                        v-if="activeIndex == 3"
                        @changeActive="handleClick" />
        </el-tab-pane>
        <el-tab-pane label="学校缴费设置"
                     v-if="permission('/resetTeaming/resetPayList')"
                     name="6">
          <resetPayListSchool :baseInfo="baseInfo"
                              v-if="activeIndex == 6"
                              @changeActive="handleClick" />
        </el-tab-pane>

        <el-tab-pane label="班级调整"
                     v-if="permission('/resetTeaming/resetClass')"
                     name="5">
          <resetClass v-if="activeIndex == 5"  :musicGroupInfo='musicGroupInfo'/>
        </el-tab-pane>
        <!-- <el-tab-pane label="新增排课"
                     v-if="permission('/resetTeaming/coursePlan')"
                     name="4">
          <coursePlan :teamid='teamid'
                      v-if="activeIndex == 4" />
        </el-tab-pane> -->
        <!-- <el-tab-pane label="新增小班课"
                     name="5">
          <improvement :teamid='teamid' />
        </el-tab-pane> 1-->
        <!-- 啦啦啦 -->
      </el-tabs>
    </div>
  </div>
</template>
<script>
import teamBaseInfo from '@/views/teamBuild/components/teamBaseInfo'
import resetSound from '@/views/resetTeaming/components/resetSoundv2'
import resetClass from '@/views/teamDetail/components/resetClass'
// import coursePlan from '@/views/teamBuild/teamSeting/components/coursePlan'
// import lookCourse from '@/views/teamBuild/teamSeting/components/lookCourse'
// import improvement from '@/views/teamBuild/teamSeting/components/improvementClass'
import resetPayList from '@/views/resetTeaming/components/resetPayList'
import resetPayListSchool from '@/views/resetTeaming/components/resetPayListSchool'
import studentPayBase from '@/views/resetTeaming/components/studentPayBase'
import { permission } from '@/utils/directivePage'
export default {
  components: { teamBaseInfo, resetSound, resetClass, resetPayList, resetPayListSchool, studentPayBase },
  name: 'resetTeaming',
  data () {
    return {
      activeIndex: '1',
      teamid: '',
      baseInfo: null,
      // permissionStatus: {
      //   teamBaseInfo: true,
      //   resetSound: true,
      //   resetClass: true,
      //   resetSound: true,
      //   coursePlan: true,
      // }
      name: null,
      teamName: '乐团修改',
      musicGroupInfo:null
    }
  },
  created () {
    // this.__init()
  },
  beforeDestroy () {
    sessionStorage.setItem('setStep', 0)
    sessionStorage.setItem('resetCode', 1)
  },
  mounted () {
    let obj = {}
    obj.name = this.activeIndex
    this.handleClick(obj)
    this.__init()
  },
  activated () {
    let obj = {}
    obj.name = this.activeIndex
    this.handleClick(obj)
    this.__init()
  },
  methods: {
    __init () {
      this.activeIndex = sessionStorage.getItem('resetCode') || '1';
      this.teamid = this.$route.query.id;
    },
    onCancel () {
      this.$router.push({ path: '/business/teamDetail' })
    },
    getBaseInfo (baseInfo) {
      this.baseInfo = baseInfo
      this.teamName = baseInfo.musicGroup.name
      this.musicGroupInfo = baseInfo.musicGroup
    },
    handleClick (val) {
      this.activeIndex = val.name
    },
    permission (str) {
      return permission(str)
    },
    getName (val) {
      // this.name = val
    }
  },
}
</script>
<style lang="scss" scoped>
</style>
