<template>
  <div class="gyzj-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)">
          {{ $t(item.name) }}
        </div>
      </div>

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

<script>
import gyzjList from "./comps/gyzjList";
import ffjlList from "./comps/ffjlList";
export default {
  name: 'Gyzj',
  components: { gyzjList, ffjlList },
  data() {
    return {
      showDetail: false,
      tabList: [
        { key: 'gyzjList', name: 'page.business.resource.gyzj.gyzjgl' },
        { key: 'ffjlList', name: 'page.business.resource.gyzj.ffhsjl' },
      ],
      active: 'gyzjList',
    }
  },
  created() { },
  methods: {
    show(row) {
      this.study = row
    },
    changeTab(item) {
      if (this.active !== item.key) {
        this.active = item.key
      }
    },
    showDetailCallback(val) {
      this.showDetail = val
    }
  }
}
</script>
<style lang="scss" scoped>
.gyzj-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>
