<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" />
        </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/resetClass')"
                     name="3">
          <resetClass v-if="activeIndex == 3" />
        </el-tab-pane>
        <el-tab-pane label="新增排课"
                     v-if="permission('/resetTeaming/coursePlan')"
                     name="4">
          <coursePlan :teamid='teamid'
                      v-if="activeIndex == 4" />
          <!-- <lookCourse /> -->
        </el-tab-pane>
        <!-- <el-tab-pane label="新增小班课"
                     name="5">
          <improvement :teamid='teamid' />
        </el-tab-pane> -->
      </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 { permission } from '@/utils/directivePage'
export default {
  components: { teamBaseInfo, resetSound, resetClass, coursePlan, lookCourse, improvement },
  name: 'resetTeaming',
  data () {
    return {
      activeIndex: '1',
      teamid: '',
      // permissionStatus: {
      //   teamBaseInfo: true,
      //   resetSound: true,
      //   resetClass: true,
      //   resetSound: true,
      //   coursePlan: true,
      // }
      Fsearch: null,
      Frules: null
    }
  },
  created () {
    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
    }
  },
  beforeDestroy () {
    sessionStorage.setItem('setStep', 0)
    sessionStorage.setItem('resetCode', 1)
  },
  mounted () {
    let obj = {}
    obj.name = this.activeIndex
    this.handleClick(obj)

  }, methods: {
    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)
    }
  },
}
</script>
<style lang="scss">
</style>