<template>
  <div style="min-height:500px">
    <div v-if="isReadingShowSubjectInfo" style="display:flex;align-items: center;
    justify-content: space-between;">
      <h3>
        <span v-if="subjectCode">{{ subjectCode }}</span>
        <span style="margin-left:5px;">{{ taskBlindName }}</span>
      </h3>
      <div>
        <el-button v-if="isExistsClinicalData" type="text" @click="previewCD">{{ $t('trials:reading:button:clinicalData') }}</el-button>
      </div>
    </div>
    <ECRF
      :trial-id="trialId"
      :subject-id="subjectId"
      :criterion-id="criterionId"
      :visit-task-id="visitTaskId"
      :iseCRFShowInDicomReading="iseCRFShowInDicomReading"
    />
  </div>

<!--    </el-tab-pane>-->
  <!-- <el-tab-pane label="标准2" name="second">
      <ECRF ref="second" />
    </el-tab-pane> -->
<!--  </el-tabs>-->
</template>
<script>
import { getTrialConfirmCriterionList } from '@/api/trials'
import ECRF from './ECRF'
export default {
  name: 'Criterions',
  components: { ECRF },
  props: {
    trialId: {
      type: String,
      required: true
    },
    subjectId: {
      type: String,
      required: true
    },
    visitTaskId: {
      type: String,
      required: true
    },
    criterionId: {
      type: String,
      required: true
    },
    subjectCode: {
      type: String,
      required: true
    },
    taskBlindName: {
      type: String,
      required: true
    },
    isReadingShowSubjectInfo: {
      type: Boolean,
      required: true
    },
    iseCRFShowInDicomReading: {
      type: Boolean,
      required: true
    },
    isExistsClinicalData: {
      type: Boolean,
      required: true
    },
  },
  data() {
    return {
      activeName: '',
      loading: false,
      criterions: []
    }
  },
  mounted() {
    this.getCriterions()
  },
  methods: {
    getCriterions() {
      this.loading = true
      var param = {
        trialId: this.$router.currentRoute.query.trialId
      }
      getTrialConfirmCriterionList(param).then(res => {
        this.criterions = res.Result
        this.activeName = this.criterions[0].ReadingQuestionCriterionTrialId
        this.loading = false
      }).catch(() => { this.loading = false })
    },
    previewCD() {
      this.$emit('previewCD')
    },

  }
}
</script>
