<template>
  <el-tabs v-model="activeName" @tab-click="handleClick">
    <!-- 器官 -->
    <el-tab-pane :label="$t('trials:readingUnit:baseDataCfg:title:organ')" name="organs">
      <OrgansTbl :trial-reading-criterion-id="trialReadingCriterionId" :is-from-system="isFromSystem" :is-confirm="isConfirm" />
    </el-tab-pane>
    <el-tab-pane :label="$t('trials:readingUnit:baseDataCfg:title:dict')" name="criterionDictionary">
      <CriterionDictionary
        :criterion-id="trialReadingCriterionId"
        :is-complete-config="isConfirm"
      />
    </el-tab-pane>
  </el-tabs>
</template>
<script>
import OrgansTbl from './OrgansTbl'
import CriterionDictionary from './CriterionDictionary'
export default {
  name: 'CriterionsBaseData',
  components: { OrgansTbl, CriterionDictionary },
  props: {
    trialReadingCriterionId: {
      type: String,
      required: true
    },
    isFromSystem: {
      type: Boolean,
      required: true
    },
    isConfirm: {
      type: Boolean,
      required: true
    }
  },
  data() {
    return {
      activeName: 'organs',
      tabs: ['organs']
    }
  },
  methods: {
    handleClick(tab, event) {
      if (this.tabs.includes(tab.name)) {
        return
      } else {
        this.tabs.push(tab.name)
      }
    }
  }
}
</script>
