<template>
  <div>
    <BasicTable @register="registerTable">
      <template #toolbar>
        <a-button type="primary" @click="updateimage">更新最新影像</a-button>
      </template>
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'enabledMark'">
          <a-tag v-if="record.enabledMark" color="success">正常</a-tag>
          <a-tag v-else color="error">停用</a-tag>
        </template>
      </template>
    </BasicTable>
  </div>
</template>

<script lang="ts" setup>
  // vben
  import { useMessage } from '@/hooks/web/useMessage';
  import { BasicTable, useTable } from '@/components/Table';
  import { columns, searchFormSchema } from './util';

  const { createMessage } = useMessage();

  // 历史记录
  const [registerTable, { reload, getSelectRows }] = useTable({
    // api: getRightTable,
    columns,
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    showIndexColumn: false,
    rowSelection: {
      type: 'radio',
    },
    useSearchForm: true,
    bordered: true,
    showTableSetting: true,
    handleSearchInfoFn(info) {
      return info;
    },
    immediate: false,
  });
</script>
