<template>
  <el-table v-loading="loading" :data="list" stripe height="500">
    <el-table-column type="index" width="40" />
    <!-- 确认人 -->
    <el-table-column
      prop="CreateUser"
      :label="$t('trials:adjustRecord:table:connfirmor')"
      show-overflow-tooltip
      min-width="60"
    />
    <!-- 确认时间 -->
    <el-table-column
      prop="CreateTime"
      :label="$t('trials:adjustRecord:table:connfirmTime')"
      show-overflow-tooltip
      min-width="60"
    />
    <!-- 超窗结论不一致记录 -->
    <el-table-column
      prop="InconsistentCount"
      :label="$t('trials:adjustRecord:table:record')"
      show-overflow-tooltip
      min-width="60"
    />
    <el-table-column :label="$t('common:action:action')" min-width="60">
      <template slot-scope="scope">
        <!-- 下载 -->
        <el-button
          :disabled="scope.row.InconsistentCount === 0"
          type="text"
          size="small"
          @click="handleDownLoad(scope.row)"
        >
          {{ $t('trials:adjustRecord:action:download') }}
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
import { getInfluenceHistoryList, downloadInflunceStudyList } from '@/api/trials'
export default {
  name: 'VisitPlanAdjust',
  data() {
    return {
      loading: false,
      list: []
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      const trialId = this.$route.query.trialId
      getInfluenceHistoryList(trialId).then(res => {
        this.loading = false
        this.list = res.Result
      }).catch(() => { this.loading = false })
    },
    handleDownLoad(row) {
      this.loading = true
      downloadInflunceStudyList(row.Id).then(data => {
        this.loading = false
      }).catch(() => { this.loading = false })
    }
  }
}
</script>
