<!-- 下载文件列表 -->
<template>
  <div>
    <el-table :data="outputList" border style="width: 1200px">
      <el-table-column prop="markFormatType" label="标注格式类型">
      </el-table-column>
      <el-table-column prop="outputContent" label="导出内容">
      </el-table-column>
      <el-table-column prop="fileSize" label="文件大小">
      </el-table-column>
      <el-table-column prop="dataCount" label="数据量">
      </el-table-column>
      <el-table-column prop="createUserId" label="创建人">
        <template slot-scope="scope">{{scope.row.createUserIdDictMap.name}}</template>
      </el-table-column>
      <el-table-column prop="outputStartTime" label="导出开始时间" width="150">
      </el-table-column>
      <el-table-column prop="outputEndTime" label="导出完成时间" width="150">
      </el-table-column>
      <el-table-column prop="status" label="状态">
        <template slot-scope="scope">
          {{ OutputStatus.getValue(scope.row.status) }}
        </template>
      </el-table-column>
      <el-table-column label="操作" fixed="right">
        <template slot-scope="scope">
          <el-button @click="down(scope.row.downloadUrl)" type="text" size="mini">
            下载
          </el-button>
          <el-button @click="outputDelete(scope.row.outputId)" type="text" size="mini">
            刪除
          </el-button>
        </template>
      </el-table-column>

    </el-table>
  </div>
</template>

<script>
import { DatasetVersion } from '@/api/gptController.js'
export default {
  data() {
    return {}
  },
  props: ['outputList'],
  components: {},

  computed: {},

  mounted() {},

  methods: {
    down(url) {
      let downDom = document.createElement('a')
      downDom.href = url
      downDom.click()
    },

    outputDelete(outputId) {
      this.$confirm('是否确认删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let params = { outputId }
        DatasetVersion.outputDelete(this, params).then((res) => {
          this.outputList = res.data.dataList
          console.log(this.outputList)
        })
      })
    }
  }
}
</script>
<style scoped>
</style>
