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

export const columns = [
  {
    type: 'selection',
    width: 50,
    fixed: 'left',
  },
  {
    title: 'ID',
    key: 'id',
    fixed: 'left',
    width: 50,
  },
  {
    title: '模板编号',
    key: 'number',
    width: 100,
  },
  {
    title: '模板名称',
    key: 'title',
    width: 200,
  },
  {
    title: '模板编码',
    key: 'code',
    width: 150,
  },
  {
    title: '消息类型',
    key: 'type',
    render(record) {
      let typeText = '';
      let color = '';
      switch (record.type) {
        case 1:
          typeText = '系统通知';
          color = 'success';
          break;
        case 2:
          typeText = '用户私信';
          color = 'primary';
          break;
        case 3:
          typeText = '代办事项';
          color = 'warning';
          break;
        default:
          break;
      }
      // return h('span', typeText || '-');
      return h(
        NTag,
        {
          style: {
            marginRight: '6px',
          },
          bordered: false,
          type: color,
        },
        {
          default: () => typeText,
        },
      );
    },
  },
  {
    title: '模板内容',
    key: 'content',
    width: 350,
  },
  {
    title: '创建人',
    key: 'createUser',
    width: 100,
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 180,
  },
];
