<!--单列-->
<template>
    <el-dialog class='table-box'
               v-model='dialogVisible'
               top='114px'
               :style="{ height: height+'px', maxHeight: height+'px', overflow: 'hidden' }"
               :title='title'
               :width='width'
               :modal='false'>
      <div class='table-box' :style="{height:(height-64)+'px',maxHeight:(height-64)+'px',overflow:'hidden'}">
      <ProTable
          ref='proTable'
          :columns='columns'
          :data='SourceData'
          type='selection'
      >
        <!-- 表格 header 按钮 -->
        <template #tableHeader="scope">
        <el-tooltip content="通过检测源列表导入检测源" placement="top">
          <el-button type='primary' :icon='Download' tooltip @click="showSourceSelectOpen">筛选检测源</el-button>
        </el-tooltip>
           <el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
           批量移除
         </el-button>
        </template>
        <!-- <el-button type='primary' :icon='Download' >下载报告</el-button> -->
        <!-- 表格操作 -->
        <template #operation='scope'>
          <!-- <el-button type='primary' link :icon='View' >查看</el-button> -->
          <el-button type='primary' link :icon='Delete' >移除</el-button>
        </template>
      </ProTable>
     </div>
     <SourceSelectOpen :width='width' :height='height' ref='openSourceSelectView' />
    </el-dialog>
  </template>
  <script setup lang='tsx'>
  import {  Delete, View ,Upload,Download} from '@element-plus/icons-vue'
  import { reactive,ref } from 'vue'
  import type { TestSource } from '@/api/device/interface/testSource'
  import ProTable from '@/components/ProTable/index.vue'
  import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
  import sourceDataList from '@/api/device/testSource/testSourceData'
  import SourceSelectOpen from '@/views/plan/planList/components/sourceSelectPopup.vue'
 import { useDictStore } from '@/stores/modules/dict'

  const SourceData = sourceDataList
  const dialogVisible = ref(false)
  const title = ref('')
  const openSourceSelectView = ref()
  const dictStore = useDictStore()

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

  const open = (textTitle: string) => {
    dialogVisible.value = true
    title.value = textTitle
  }
  defineExpose({ open })
  
  
  const props = defineProps({
    width: {
      type: Number,
      default: 800,
    },
    height: {
      type: Number,
      default: 744,
    },
  })

  const showSourceSelectOpen = () => {
  openSourceSelectView.value.open('检测源筛选列表')
}
  </script>
  <style>
  
  </style>