<template>
  <div class="api-body-content border-box">
    <div class="common-nav">
      <nav-bread :nav-path="navPath" />
    </div>
    <div class="api-body-main common-body-main border-box">
      <div class="api-main-content border-box">
        <div class="env-tab-wrap">
          <el-tabs
            v-model="activeName"
            @tab-click="handleClick">
            <el-tab-pane
              label="环境列表"
              name="first">
              <env-list />
            </el-tab-pane>
            <el-tab-pane
              label="配置列表"
              name="second">
              <env-set-list />
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import navBread from '@/components/nav/nav-bread.vue';
import envList from '@/components/env/env-list.vue';
import envSetList from '@/components/env/env-set-list.vue';
import { getRequest } from '@/api/api';
export default {
  name: 'EnvManage',
  components: {
    navBread,
    envList,
    envSetList
  },
  data() {
    return {
      // 面包屑参数
      navPath: [
        {
          name: '环境管理',
          path: ''
        }
      ],
      activeName: 'first'
    };
  },
  methods: {
    /**
     * tab 切换
     */
    /* eslint-disable */
    handleClick(tab, event) {
      console.log(tab, event);
    },
    /**
     *  获取数据
     */
    getData() {
      const that = this;
      let para = {
        project: that.repProjectName,
        router: that.pathName,
        requestProject: that.repProjectName
      };
      getRequest('/haoban-manage-web/menu-detail', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            return;
          }
          that.$message.error({
            duration: 1000,
            message: resData.message
          });
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  watch: {
    $route: {
      handler: function(val, oldVal) {},
      // 深度观察监听
      deep: true
    }
  },

  /* 接收数据 */
  mounted() {
    const that = this;
    that.$emit('showTab', 3);
    if (that.$route.query.tabChildid) {
      that.activeName = that.$route.query.tabChildid;
    }
  }
};
</script>

<style lang="less" scoped></style>
