<template>
  <div class="m-container">
    <h2>
      <el-page-header @back="onCancel"
                      content="乐团修改"></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"
                        @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 v-if="activeIndex == 3" />
        </el-tab-pane>

        <el-tab-pane label="班级调整"
                     v-if="permission('/resetTeaming/resetClass')"
                     name="5">
          <resetClass v-if="activeIndex == 5" />
        </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/resetSound'
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 studentPayBase from '@/views/resetTeaming/components/studentPayBase'
import { permission } from '@/utils/directivePage'
export default {
  components: { teamBaseInfo, resetSound, resetClass, resetPayList, studentPayBase },
  name: 'resetTeaming',
  data () {
    return {
      activeIndex: '1',
      teamid: '',
      // permissionStatus: {
      //   teamBaseInfo: true,
      //   resetSound: true,
      //   resetClass: true,
      //   resetSound: true,
      //   coursePlan: true,
      // }
      Fsearch: null,
      Frules: null,
      name: null
    }
  },
  created () {
    this.__init()
  },
  beforeDestroy () {
    sessionStorage.setItem('setStep', 0)
    sessionStorage.setItem('resetCode', 1)
  },
  mounted () {
    let obj = {}
    obj.name = this.activeIndex
    this.handleClick(obj)
  },
  activated () {
    this.__init()
  },
  methods: {
    __init () {
      this.activeIndex = sessionStorage.getItem('resetCode') || '1';
      this.teamid = this.$route.query.id;
      if (this.$route.query.search) {
        this.Fsearch = this.$route.query.search;
      }
      if (this.$route.query.rules) {
        this.Frules = this.$route.query.rules
      }
    },
    onCancel () {
      this.$router.push({ path: '/business/teamDetail', query: { search: this.Fsearch, rules: this.Frules } })
    },
    handleClick (val) {
      this.activeIndex = val.name
    },
    permission (str) {
      return permission(str)
    },
    getName (val) {
      // this.name = val
    }
  },
}
</script>
<style lang="scss" scoped>
</style>