<!-- 数据增强 -->
<template>
  <div style="position: relative">
    <el-collapse v-model="activeName" accordion ref="collapse" v-resize="resize">
      <el-collapse-item name="1">
        <template slot="title">
          <div class="title">使用流程</div>
        </template>
        <div class="instructions">
          <div class="instructionsList">
            <div class="item" v-for="(item, index) in instructionsList" :key="index">
              <img class="img" :src="item.img" alt="" />

              <div class="itemTitle">
                <span class="head-index">{{ index + 1 }} &nbsp;</span>{{ item.title }}
              </div>
              <div class="itemDescribe">{{ item.describe }}</div>
            </div>
          </div>
        </div>
      </el-collapse-item>
    </el-collapse>
    <div class="tableBox" :style="{ height: tableHeight }">
      <el-form ref="myDataSetPage" :model="myDataSetPage" label-width="75px" :size="defaultFormItemSize" label-position="right" @submit.native.prevent>
        <filter-box :item-width="350" @search="search()" @reset="onReset">
          <el-form-item label-width="0px">
            <el-button class="add" type="primary" icon="el-icon-plus" :size="defaultFormItemSize">创建任务</el-button>
          </el-form-item>
          <el-form-item label="数据集名称" prop="formFilter.dataName" label-width="120px">
            <el-input class="filter-item" v-model="myDataSetPage.formFilter.dataName" :clearable="true" placeholder="数据集名称" />
          </el-form-item>
        </filter-box>

      </el-form>

      >
      <vxe-table border show-header-overflow show-overflow :row-config="{ isHover: true }" :data="tableData" min-height="96">
        <vxe-column field="taskName" title="任务名称"></vxe-column>
        <vxe-column field="taskStatus" title="任务状态">
          <template slot-scope="scope">
            {{ TaskStatus.getValue(scope.row.taskStatus) }}
          </template>
        </vxe-column>
        <vxe-column field="enhancementType" title="增强类型"></vxe-column>
        <vxe-column field="enhancementMode" title="增强方式"></vxe-column>
        <vxe-column field="dependencyModel" title="依赖模型"></vxe-column>
        <vxe-column field="dataSetBeforeEnhancement" title="增强前数据集"></vxe-column>
        <vxe-column field="enhancedDataSet" title="增强后数据集"></vxe-column>
        <vxe-column field="startTime" title="开始时间"></vxe-column>
        <vxe-column field="operation" title="操作">
          <!-- <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> -->
        </vxe-column>
      </vxe-table>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      activeName: '1',
      collapseHeight: 0,
      instructionsList: [
        {
          title: '上传数据集',
          describe: '完成文本对话数据上传和标注',
          img: require('@/assets/img/step01.png')
        },
        {
          title: '自监督式数据增强',
          describe: '若样本较少，基于自监督的方式发起数据增强任务',
          img: require('@/assets/img/step02.png')
        },
        {
          title: '过滤低质量样本',
          describe: '当增强任务结束后，对生成的样本进行质量过滤',
          img: require('@/assets/img/step03.svg')
        },
        {
          title: '发起训练调优',
          describe: '基于增强后的新样本发起训练调优任务',
          img: require('@/assets/img/step04.png')
        }
      ],
      myDataSetPage: {
        formFilter: {
          dataName: '1'
        }
      },
      tableData: [
        {
          id: 10001,
          name: 'Test1',
          role: 'Develop',
          sex: 'Man',
          age: 28,
          address: 'test abc'
        }
      ]
    }
  },

  components: {},

  computed: {
    ...mapGetters(['getMainContextHeight']),

    tableHeight() {
      return this.getMainContextHeight - this.collapseHeight - 34 + 'px'
    }
  },

  mounted() {},

  methods: {
    resize(e) {
      setTimeout(() => {
        this.collapseHeight = e.height
      }, 300)
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/assets/style/element-variables.scss';
.instructions {
  background-color: white;
  width: 100%;
  padding: 0px 20px 20px 20px;
  height: 200px;

  .instructionsList {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
  }
  .title {
    color: $--color-text-primary;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
  }
  .describe {
    color: $--color-text-secondary;
    margin-bottom: 16px;
  }
  .itemTitle {
    color: $--color-text-primary;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
  }
  .head-index {
    font-size: 24px;
    color: #e8e9eb;
    line-height: 32px;
  }
  .itemDescribe {
    width: 170px;
    color: $--color-text-secondary;
  }
  .img {
    height: 72px;
    width: 140px;
  }
}
.tableBox {
  background-color: white;
  width: 100%;
  padding: 20px;
  overflow: auto;
  .add {
    margin-bottom: 20px;
  }
}
div /deep/ .el-collapse-item__content {
  padding-bottom: 0;
}
div /deep/ .el-collapse-item__header {
  padding-left: 20px;
}
</style>
