import { h } from 'vue';
import { NTag } from 'naive-ui';

export const columns2 = [
  {
    type: 'selection',
    width: 50,
    fixed: 'left',
    multiple: false,
  },
  {
    title: 'ID',
    key: 'id',
    width: 60,
    fixed: 'left',
  },
  {
    title: '标题',
    key: 'title',
    width: 200,
  },
  {
    title: '类型',
    key: 'type',
    width: 100,
    render(record) {
      return h(
        NTag,
        {
          type: record.type == 1 ? 'info' : 'success',
        },
        {
          default: () => (record.type == 1 ? '通知' : '公告'),
        },
      );
    },
  },
  {
    title: '状态',
    key: 'status',
    render(record) {
      return h(
        NTag,
        {
          type: record.status == 1 ? 'success' : 'error',
        },
        {
          default: () => (record.status == 1 ? '正常' : '禁用'),
        },
      );
    },
    width: 100,
  },
  {
    title: '点击率',
    key: 'clickNum',
    width: 100,
  },
  {
    title: '创建人',
    key: 'createUser',
    width: 100,
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 180,
  },
];
