import { h } from 'vue';
import { ElTag } from 'element-plus';

export const columns2 = [
  {
    label: 'ID',
    prop: 'id',
    fixed: 'left',
    width: 50,
  },
  {
    label: '通知标题',
    prop: 'title',
    minWidth: 250,
  },
  {
    label: '通知类型',
    prop: 'type',
    // render(record) {
    //   return h('span', record.row.type === 1 ? '通知' : '公告');
    // },
    minWidth: 100,
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.type == 1 ? 'primary' : 'warning',
        },
        {
          default: () => (record.row.type == 1 ? '通知' : '公告'),
        },
      );
    },
  },
  {
    label: '通知状态',
    prop: 'status',
    minWidth: 100,
    // render(record) {
    //   return h('span', record.row.status === 1 ? '正常' : '关闭')
    // },
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.status == 1 ? 'success' : 'danger',
        },
        {
          default: () => (record.row.status == 1 ? '正常' : '禁用'),
        },
      );
    },
  },
  {
    label: '点击率',
    prop: 'clickNum',
    minWidth: 100,
  },
  {
    label: '创建人',
    prop: 'createUser',
    minWidth: 100,
  },
  {
    label: '创建时间',
    prop: 'createTime',
    minWidth: 180,
  },
];
