<template>
  <div class="mjy-index">
    <div class="content-list">
      <div class="search-box" v-show="!showDetail">
        <div class="search-item" :class="active === item.key ? 'active' : ''" v-for="(item, index) in tabList"
          :key="index" @click="changeTab(item)">
          {{ item.name }}
        </div>
      </div>

      <div class="content-box">
        <gspList v-if="active === 'gspList'" @showDetail="showDetailCallback" />
        <ffjlList v-if="active === 'ffjlList'" @showDetail="showDetailCallback" />
        <rkjlList v-if="active === 'rkjlList'" @showDetail="showDetailCallback" />
      </div>
    </div>
  </div>
</template>

<script>
import gspList from "./comps/gspList";
import ffjlList from "./comps/ffjlList";
import rkjlList from "./comps/rkjlList";
export default {
  name: 'Gsp',
  components: { gspList, ffjlList, rkjlList },
  data() {
    return {
      showDetail: false,
      tabList: [
        { key: 'gspList', name: this.$t('page.business.resource.gsp.gspgl') },
        { key: 'rkjlList', name: this.$t('page.business.resource.gsp.gsprkjl') },
        { key: 'ffjlList', name: this.$t('page.business.resource.gsp.ffhsjl') },
      ],
      active: 'gspList',
    }
  },
  created() { },
  methods: {
    show(row) {
      this.study = row
    },
    changeTab(item) {
      if (this.active !== item.key) {
        this.active = item.key
        this.saveSimpleLog({name:this.$t(item.name,'zh_CN'),nameEn:this.$t(item.name,'en_US'),jcmc:this.$t('system.enterPage','zh_CN'),jcmcEn:this.$t('system.enterPage','en_US')})
      }
    },
    showDetailCallback(val) {
      this.showDetail = val
    }
  }
}
</script>
<style lang="scss" scoped>
.mjy-index {
  padding: 10px 10px;

  .search-box {
    background: #fff;
    padding: 0;
    border-radius: 3px;
    margin-bottom: 10px;

    display: flex;
    flex-direction: row;
    align-items: center;

    .search-item {
      padding: 10px 20px;
      font-size: 14px;
      cursor: pointer;

      &.active {
        background: #1890ff;
        color: #fff;
      }

      &:hover {
        background: #46a6ff;
        color: #fff;
      }

      &:first-child {
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
      }

      &:last-child {
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
      }
    }
  }

  .content-box {}
}
</style>
