<template>
    <div class='table-box'>
      <ProTable
        ref='proTable'
        :columns='columns'
        :request-api="getTableList"
     >
        <!-- :data='testSourceData'  如果要显示静态数据，就切换该配置-->
        <!-- 表格 header 按钮 -->
        <template #tableHeader='scope'>
          <el-button type='primary' :icon='CirclePlus' >新增</el-button>
          <el-button type='primary' :icon='Download' plain >导出数据</el-button>
          <el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
            批量删除
          </el-button>
        </template>
        <!-- 表格操作 -->
        <template #operation='scope'>
          <el-button type='primary' link :icon='View' >查看</el-button>
          <el-button type='primary' link :icon='EditPen' >编辑</el-button>
          <el-button type='primary' link :icon='Delete' >删除</el-button>
      </template>
  
      </ProTable>
    </div>
  
  </template>
  
  <script setup lang='tsx' name='useRole'>
  import { type TestSource } from '@/api/device/interface/testSource'
  import { useHandleData } from '@/hooks/useHandleData'
  import { useDownload } from '@/hooks/useDownload'
  import { useAuthButtons } from '@/hooks/useAuthButtons'
  import ProTable from '@/components/ProTable/index.vue'
  import ImportExcel from '@/components/ImportExcel/index.vue'
  import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
  import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
  import { useDictStore } from '@/stores/modules/dict'
   import {
    getTestSourceList,
  } from '@/api/device/testSource/index'
import { reactive, ref } from 'vue'
  
  const dictStore = useDictStore()
  
  // const testSourceData = testSourceDataList
  // ProTable 实例
  const proTable = ref<ProTableInstance>()
  

  // 表格配置项
  const columns = reactive<ColumnProps<TestSource.TestSourceBO>[]>([
    { type: 'selection', fixed: 'left', width: 70 },
    { type: 'index', fixed: 'left', width: 70, label: '序号' },
    {
      prop: 'name',
      label: '名称',
      search: { el: 'input' },
      minWidth: 180,
    },
    {
      prop: 'devType',
      label: '设备类型',
      enum: dictStore.getDictData('testSourceDevType'),
      fieldNames: { label: 'label', value: 'id' },
      search: { el: 'select' },
      minWidth: 220,
    },
    {
      prop: 'type',
      label: '源类型',
      enum: dictStore.getDictData('testSourceType'),
      fieldNames: { label: 'label', value: 'id' },
      search: { el: 'select' },
      minWidth: 150,
    },
    { prop: 'operation', label: '操作', fixed: 'right', width: 250 },
  ])
  
  
  </script>
  