<!--  -->
<template>
  <div class="set-mian commonFont common-main">
    <el-menu
      :default-active="activeIndex"
      mode="horizontal"
      @select="handleSelect"
      text-color="#52575b"
      active-text-color="#3ba1ff"
    >
      <el-menu-item
        v-if="auth.evaluationSet"
        index="0"
      >考评组设置</el-menu-item>
      <el-menu-item index="2">指标库</el-menu-item>
      <el-menu-item
        v-if="auth.roleSet"
        index="1"
      >权限设置</el-menu-item>
    </el-menu>
    <ground-table
      class="kaoping"
      v-if="activeIndex==='0'"
    ></ground-table>
    <div v-else-if="activeIndex==='1'">
      <try-authority></try-authority>
    </div>
    <div v-else-if="activeIndex==='2'">
      <try-target></try-target>
    </div>
  </div>
</template>

<script>
import groundTable from '../workbench/assessmentGroup/groundTable'
import tryAuthority from './authority'
import tryTarget from './target'

export default {
  data () {
    return {
      activeIndex: this.$route.query.activeIndex || '0'
    }
  },
  components: {
    groundTable,
    tryAuthority,
    tryTarget
  },
  created () {
    if (this.auth.evaluationSet) {
      this.activeIndex = '0'
    } else if (!this.auth.roleSet) {
      this.activeIndex = '1'
    } else if (!this.auth.target) {
      this.activeIndex = '2'
    } else {
      this.activeIndex = ''
    }
    if (this.auth.evaluationSet && this.auth.roleSet) {
      this.activeIndex = this.$route.query.activeIndex
    } else {
      this.activeIndex = this.$route.query.activeIndex || '0'
    }
  },
  beforeMount () { },
  mounted () { },
  methods: {
    handleSelect (key, keyPath) {
      this.activeIndex = key
      this.$router.replace({ name: 'set', query: { activeIndex: key } })
    }
  },
  watch: {}

}

</script>

<style lang='less' scoped>
.set-mian {
  padding-top: 0px;
  // min-height: 600px;
}
.kaoping {
  padding: 20px 0 00 0;
}
</style>
