import { BasicColumn } from '@/components/Table';
import { ElPopover, ElButton } from 'element-plus';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    label: 'ID',
    prop: 'id',
  },
  {
    label: '来源',
    prop: 'operation',
  },
  {
    label: '操作人',
    prop: 'operator',
  },
  {
    label: 'IP',
    prop: 'ip',
  },
  {
    label: '参数',
    prop: 'parameter',
    render(record) {
      return h(
        ElPopover,
        {
          width: 350,
          style: { 'max-width': '550px' },
          'content-style': {
            'word-break': 'break-all',
          },
          scrollable: true,
        },
        {
          reference: () => h(ElButton, {}, { default: () => '查看参数' }),
          default: () => `${record.row.parameter}`,
        },
      );
    },
  },
  {
    label: '创建时间',
    prop: 'createTime',
  },
];
