<template>
  <el-container class="th-equipment--tg th-equipment-tree-panel">
    <el-header height="auto">
      <div class="buttons-wrap">
        <el-button v-for="(a, index) in buttons" :key="index" :loading="a.loading" type="primary" size="mini" :icon="a.icon" @click="handleEvent(a.key)">{{ a.label }}</el-button>
      </div>
      <th-form ref="form" v-bind="form" />
    </el-header>
    <el-main>
      <th-table
        v-bind="list"
        @row-click="handleRowClick"
        @handleSizeChange="handleSizeChange"
        @handleCurrentChange="handleCurrentChange"
      />
    </el-main>
  </el-container>
</template>

<script>
import TgComp from './tg'
export default {
  extends: TgComp,
  data() {
    return {
      list: {
        showSelection: false,
        props: {
          highlightCurrentRow: true
        }
      },
      buttons: [
        {
          label: '查询',
          icon: 'el-icon-search',
          key: 'Search'
        }
      ]
    }
  },
  methods: {
    handleRowClick(row) {
      if (row) {
        this.$emit('select', row)
      }
    }
  }
}
</script>
