<!-- 模型结果分析 -->
<template>
      <div class="tableBox" >

      <vxe-table border show-header-overflow show-overflow :row-config="{ isHover: true }"
        :data="myDataSetPage.tableData.impl.dataList" min-height="96">
        <vxe-column title="模型名称">
            <template >
          {{ item.modelVersionIdDictMap.name }}
        </template>
        </vxe-column>
        <vxe-column field="input" title="Prompt问题"></vxe-column>
        <vxe-column field="predict" title="预期回答"></vxe-column>
        <vxe-column field="label" title="模型结果"></vxe-column>

      </vxe-table>
      <el-row slot="pagination" type="flex" justify="end" style="margin-top: 16px;">
        <el-pagination :total="myDataSetPage.tableData.impl.totalCount"
          :current-page="myDataSetPage.tableData.impl.currentPage" :page-size="myDataSetPage.tableData.impl.pageSize"
          :page-sizes="[10, 20, 50, 100]" layout="total, prev, pager, next, sizes"
          @current-change="myDataSetPage.tableData.impl.onCurrentPageChange"
          @size-change="myDataSetPage.tableData.impl.onPageSizeChange">
        </el-pagination>
      </el-row>
    </div>
</template>

<script>
/* eslint-disable-next-line */
import { DropdownWidget, TableWidget, UploadWidget, ChartWidget } from '@/utils/widget.js';
import { ModelEstimate } from '@/api/gptController.js'
export default {
  data () {
    return {
      myDataSetPage: {
        formFilter: {

        },
        tableData: {
          impl: new TableWidget(this.getwidgetData, true, true, false, undefined, false)
        }
      }
    };
  },
  props: ['item'],
  components: {},

  computed: {},

  mounted () {
    console.log(this.item);
    this.formInit()
  },

  methods: {
    getwidgetData (params) {
      params = {
        ...params,
        taskId: this.item.taskId
      }

      return new Promise((resolve, reject) => {
        ModelEstimate.getStatusDetail(this, params).then(res => {
          resolve({
            dataList: res.data.dataList.map((item) => {
              return JSON.parse(item)
            }),
            totalCount: res.data.totalCount
          });
        }).catch(e => {
          reject(e);
        });
      });
    },
    refresh (reloadData = false) {
      if (reloadData) {
        this.myDataSetPage.tableData.impl.refreshTable(true, 1);
      } else {
        this.myDataSetPage.tableData.impl.refreshTable();
      }
    },
    onReset () {
      this.$refs.myDataSetPage.resetFields();
      this.refresh(true);
    },
    formInit () {
      this.refresh();
    }
  }

}

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