<!--  -->
<template>
  <div>
    <vxe-table border show-header-overflow show-overflow :row-config="{ isHover: true }"
        :data="tableData.datasetVersionList" min-height="96">
        <vxe-column field="datasetVersion" title="版本">
            <template slot-scope="scope">
                V{{ scope.row.datasetVersion }}
            </template>
        </vxe-column>
        <vxe-column field="versionId" title="版本ID"></vxe-column>
        <vxe-column field="inputStatus" title="导入状态">
            <template slot-scope="scope">{{ InputStatus.getValue(scope.row.inputStatus) }}</template>
        </vxe-column>
        <vxe-column field="derivedState" title="导出状态">
            <template slot-scope="scope">{{ OutputStatus.getValue(scope.row.outputStatus) }}</template>
        </vxe-column>
        <vxe-column field="cleanStatus" title="清洗状态">
            <template slot-scope="scope">{{ CleanStatus.getValue(scope.row.cleanStatus) }}</template>
        </vxe-column>
        <vxe-column field="enhanceStatus" title="增强状态">
            <template slot-scope="scope">{{ EnhanceStatus.getValue(scope.row.enhanceStatus) }}</template>
        </vxe-column>
        <vxe-column field="releaseStatus" title="发布状态">
            <template slot-scope="scope">{{ ReleaseStatus.getValue(scope.row.releaseStatus) }}</template>
        </vxe-column>
        <vxe-column field="dimensionType" title="标注类型>模板">
            <template slot-scope="scope">{{ LabelType.getValue(scope.row.dimensionType ) }} <span v-if="scope.row.template!==undefined">--</span> {{ MarkTemplate.getValue(scope.row.template ) }}</template>

        </vxe-column>
        <vxe-column field="dataVolume" title="数据量"></vxe-column>
        <vxe-column field="markProgress" title="标注进度"></vxe-column>

        <vxe-column field="updateTime" title="最后更新时间"></vxe-column>
        
        <vxe-column field="operation" title="操作" width="230">
            <template slot-scope="scope">
                <el-button type="text" :size="defaultFormItemSize" @click="dataImport(scope.row)">导入</el-button>
                <el-button type="text" :size="defaultFormItemSize" @click="del(scope.row)">删除</el-button>
                <template v-if="scope.row.inputStatus !== 0">
                    <el-button type="text" :size="defaultFormItemSize" @click="particulars(scope.row)">详情</el-button>
                    <!-- <el-button type="text" :size="defaultFormItemSize" @click="label(scope.row)">标注</el-button> -->
                    <el-dropdown style="margin-left:15px;font-size: 12px;color: #0092FF;" :size="defaultFormItemSize">
                        <span class="el-dropdown-link">
                            更多<i class="el-icon-arrow-down el-icon--right"></i>
                        </span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item v-if="scope.row.releaseStatus!==1" @click.native="putOut(scope.row)">发布</el-dropdown-item>
                            <el-dropdown-item @click.native="derived(scope.row)">导出</el-dropdown-item>
                            <el-dropdown-item @click.native="analyse(scope.row)">分析</el-dropdown-item>
                            <el-dropdown-item @click.native="enhance(scope.row)">增强</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </template>
        </vxe-column>
    </vxe-table>
  </div>
</template>

<script>
import derived from '../dialog/derived.vue'
import dataImport from '../dialog/dataImport.vue'
import particulars from '../dialog/particulars.vue'
import { DatasetVersion } from '@/api/gptController.js';
export default {
  data () {
    return {
    };
  },
  props: ['tableData', 'refresh'],
  components: {},

  computed: {},

  mounted () { },

  methods: {
    dataImport (data) {
      this.$dialog.show('导入', dataImport, {
        area: ['600px', '200px']
      }, { row: data }).then(res => {
        this.refresh()
      }).catch(e => { });
    },
    del (data) {
      this.$confirm('是否确认删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let params = { versionId: data.versionId }
        DatasetVersion.delete(this, params).then(res => {
          this.$message.success('删除成功');
          this.refresh()
        }).catch(e => {
          console.log(e);
        });
      }
      );
    },
    particulars (data) { // 详情
      this.$dialog.show('详情', particulars, {
        area: ['100%', '100%']
      }, { row: data }).then(res => {
        this.refresh()
      }).catch(e => { });
    },
    label (data) { // 标注

    },
    derived (data) { // 导出
      this.$dialog.show('导出', derived, {
        area: ['600px', 'auto']
      }, { row: data }).then(res => {
        this.refresh()
      }).catch(e => { });
    },
    analyse (data) { // 分析

    },
    enhance (data) { // 增强

    },
    putOut (data) {
      console.log(data);
    }
  }
}

</script>
<style scoped></style>
