// 归档信息
<template>
  <div class="archiveInfo">
    <data-table :api="api" :queryParas="queryParas" :sourceData.sync="sourceData" operateBtnLayout=""
                :columns="columns" ref="archiveTable">
      <!-- 操作 -->
      <el-table-column :label="$t('common.operate')" align="center">
        <template slot-scope="scope">
          <btn-download size="mini" :fileID="formatFileId(scope.row)"></btn-download>
        </template>
      </el-table-column>
    </data-table>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { DataTable, authButton, btnDownload } from 'newepoch-components'
import taskManageApi from '@/api/dataAudit/taskManageApi.js'
export default {
  extends: new BasePage(),
  components: {
    DataTable,
    authButton,
    btnDownload
  },
  data () {
    return {
      form: {},
      queryParas: {
        pageIndex: 1,
        pageSize: 10,
        assetInfoId: ''
      },
      sourceData: [],
      columns: [
        // 文件名称
        {
          prop: 'fileName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.file
        },
        // 归档份数
        {
          prop: 'actualNum',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.archiveNumber,
          format: (row) => {
            if (this.UtilJs.isEmpty(row.actualNum) || row.actualNum < 0) {
              return '-'
            } else {
              return row.actualNum
            }
          }
        }
      ]
    }
  },
  computed: {
    api () {
      return taskManageApi.archiveInfo
    }
  },
  methods: {
    download () {},
    formatFileId (row) {
      return this.UtilJs.isEmpty(row.ossFileId) || row.ossFileId === '0' || row.ossFileId === '-1' ? '' : row.ossFileId
    },
    handleFilter () {
      let _this = this
      _this.$refs.archiveTable.loadTableData()
    },
    loadData (assetInfoId) {
      this.queryParas.assetInfoId = assetInfoId
      this.queryParas.pageIndex = 1
      this.queryParas.pageSize = 10
      this.handleFilter()
    }
  }
}
</script>
