<template>
  <el-table v-loading="loading" :data="list" border stripe height="500">
    <el-table-column label="" width="50">
      <template slot-scope="scope">
        {{ scope.$index + 1 }}
      </template>
    </el-table-column>
    <!-- 文件名称 -->
    <el-table-column :label="$t('trials:reviewTrack:title:fileName')" :min-width="50">
      <template slot-scope="scope">
        {{ scope.row.FileName }}
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('common:action:action')" min-width="80">
      <template slot-scope="scope">
        <!-- 下载 -->
        <el-button icon="el-icon-download" circle :title="$t('trials:reviewTrack:title:download')" size="mini"
          @click="handleExport(scope.row.ExportCatogory)" />
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import {
  getCommonEvaluationList_Export,
  getCommonJudgeRatioList_Export,
  getReadingTaskList_Export,
  getTrialReadingCriterionCanExportDocumentList,
  getTumor_CDISC_Export,
  getTumor_CDISC_IVUSOCT_Export,
  getOverallTumorEvaluationList_Export,
  getEvaluationOfTumorEfficacy_Export,
  getDetailedOfEvaluatedLesion_Export,
} from '@/api/export'
export default {
  name: 'exportList',
  props: {
    trialReadingCriterionId: {
      type: String,
      required: true,
    },
    data: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      loading: false,
      trialId: null,
      list: [],
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    async getList() {
      this.loading = true
      try {
        let res = await getTrialReadingCriterionCanExportDocumentList({
          TrialReadingCriterionId: this.trialReadingCriterionId,
        })
        if (res.IsSuccess) {
          this.list = res.Result
        }
        this.loading = false
      } catch (e) {
        console.log(e)
        this.loading = false
      }
    },
    handleExport(type) {
      var searchData = { ...this.data }
      searchData.TrialReadingCriterionId = this.trialReadingCriterionId
      switch (type) {
        case 0:
          getReadingTaskList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 1:
          searchData.ReadingExportType = 1
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 2:
          searchData.ReadingExportType = 2
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 3:
          searchData.ReadingExportType = 3
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 4:
          searchData.ReadingExportType = 4
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 7:
          searchData.ReadingExportType = 7
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 8:
          searchData.ReadingExportType = 8
          getCommonEvaluationList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 17:
          searchData.ReadingExportType = 17
          getCommonJudgeRatioList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 18:
          searchData.ReadingExportType = 18
          getCommonJudgeRatioList_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 20:
          searchData.ReadingExportType = 20
          getTumor_CDISC_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 21:
          searchData.ReadingExportType = 21
          getTumor_CDISC_IVUSOCT_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
        case 22:
          searchData.ReadingExportType = 22
          getTumor_CDISC_IVUSOCT_Export(searchData)
            .then((res) => { })
            .catch(() => {
              this.loading = false
            })
          break
      }
    },
  },
}
</script>

<style scoped></style>
