<template>
  <BasicTable @register="registerTable" :searchInfo="searchInfo" :columns="logColumns">
    <template #tableTitle>
      <a-tabs defaultActiveKey="1" @change="tabChange" size="small">
        <a-tab-pane tab="浏览器日志" key="1"></a-tab-pane>
      </a-tabs>
    </template>
  </BasicTable>
</template>
<script lang="ts" name="monitor-log" setup>
import { ref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { getLogList } from './log.api';
import { columns, searchFormSchema } from './log.data';
import { useMessage } from '/@/hooks/web/useMessage';
import { useListPage } from '/@/hooks/system/useListPage';
const { createMessage } = useMessage();
const checkedKeys = ref<Array<string | number>>([]);

const logColumns = ref<any>(columns);
const searchInfo = { logType: '3' };
// 列表页面公共参数、方法
const { prefixCls, tableContext } = useListPage({
  designScope: 'user-list',
  tableProps: {
    title: '日志列表',
    api: getLogList,
    expandRowByClick: true,
    showActionColumn: false,
    rowSelection: {
      columnWidth: 20,
    },
    formConfig: {
      schemas: searchFormSchema,
      fieldMapToTime: [['fieldTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD']],
    },
  },
});

const [registerTable, { reload }] = tableContext;

// 日志类型
function tabChange(key) {
  searchInfo.logType = key;
  if (key == '3') {
    logColumns.value = columns;
  }
  reload();
}

/**
 * 选择事件
 */
function onSelectChange(selectedRowKeys: (string | number)[]) {
  checkedKeys.value = selectedRowKeys;
}
</script>
<style lang="less" scoped>
::v-deep .table-form {
  padding: 0 !important;
  margin: 0 !important;
}
</style>
