<template>
  <div>
    <el-dialog title="索引内容详情" :visible.sync="isShow" @open="beforeDialogOpen" class="index-field-dlg">
      <div class="layout-no-cols indexes-detail-container">
        <el-tabs class="tabs-wrap" v-model="activeTabs" @tab-click="changeTabClickHandler">
          <el-tab-pane name="stored" label="存储字段">
            <stored-fields :tab-name="activeTabs" :ID="ID"></stored-fields>
          </el-tab-pane>
          <el-tab-pane name="tokenized" label="分词字段">
            <tokenized-fields :tab-name="activeTabs" :ID="ID"></tokenized-fields>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import IndexStoredFields from './indexStoredFields.vue'
import IndexTokenizedFields from './indexTokenizedFields.vue'
export default {
  components: {
    'stored-fields': IndexStoredFields,
    'tokenized-fields': IndexTokenizedFields
  },
  props: { ID: [Number, String], show: Boolean },
  data() {
    return {
      activeTabs: 'stored'
    }
  },
  computed: {
    isShow: {
      get() {
        return this.show
      },
      set(val) {
        this.$emit('update:show', val)
      }
    }
  },
  methods: {
    changeTabClickHandler(tab, event) {
      this.activeTabs = tab.name
    },
    beforeDialogOpen() {
      this.changeTabClickHandler({ name: 'stored' })
    }
  }
}
</script>
<style scoped>
.indexes-detail-container {
  position: relative;
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
  overflow-y: auto;
}
</style>
<style>
.index-field-dlg .el-dialog{
  width:900px;
}
@media (max-width:480px){
  .index-field-dlg .el-dialog{
    width:96%;
  }
}
</style>
<style scoped>
.index-field-dlg{
  line-height:2;
}
</style>
