<template>
  <DataSourceList ref="DataSource" :columns="columns" :is-choose-model="true"
                  @handleCurrentChange="handleCurrentChange"/>
</template>

<script>
import DataSourceList from '../../pages/DataSource'

export default {
  name: 'DataSourceChoose',
  components: {
    DataSourceList
  },
  data() {
    return {
      currentVal: {},
      columns: [
        {
          label: '数据源名称',
          prop: 'dataSourceName',
        },
        {
          label: '分类',
          prop: 'classify',
          formatter: this.classifyFmt
        },
        {
          label: '数据源备注',
          prop: 'remark',
        }]
    }
  },
  methods: {
    handleCurrentChange(val) {
      this.currentVal = val
    },
    getData() {
      if (this.currentVal) {
        return {label: this.currentVal.remark, value: this.currentVal.dataSourceName}
      }
    }
  }
}
</script>
