<!-- 标注 -->
<template>
<div>
    <vxe-table border show-header-overflow show-overflow :row-config="{ isHover: true ,height: 270}" :data="[form.data]" min-height="96">
    <!-- <vxe-column field="index" title="序号"></vxe-column> -->
    <vxe-column :field="'data.'+item" :title="item" v-for="item in columnList" :key="item">
      <template slot-scope="scope">
        <el-input style="height: 100%;" type="textarea"  placeholder="请输入内容" v-model="scope.row[item]" :rows="10">
        </el-input>
      </template>
    </vxe-column>

  </vxe-table>
  <el-row type="flex" justify="end" class="dialog-btn-layer mt20">
      <el-button :size="defaultFormItemSize" :plain="true" @click="onCancel(false)">取消</el-button>
      <el-button type="primary" :size="defaultFormItemSize" @click="onSubmit">确定</el-button>
    </el-row>
</div>
</template>

<script>
import { DatasetData } from '@/api/gptController.js';
export default {
  data () {
    return {
      form: {
        _id: undefined,
        data: {},
        versionId: undefined
      }
    };
  },
  props: ['row', 'columnList', 'refresh'],
  components: {},

  computed: {},

  mounted () {
    this.form._id = this.row._id
    this.form.versionId = this.row.versionId
    this.form.data = this.row.data
    delete this.form.data._X_ROW_KEY
    console.log(this.form.data);
  },

  methods: {
    onCancel (isSuccess) {
      if (this.observer != null) {
        this.observer.cancel(isSuccess);
      }
    },
    onSubmit () {
      let params = {};
      params.datasetMongoDto = this.form;
      console.log(params);
      DatasetData.update(this, params).then(res => {
        this.$message.success('编辑成功');
        this.onCancel(true);
      }).catch(e => {

      });
    }
  }
}

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