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

export const columns = [
  {
    title: '序号',
    dataIndex: 'id',
    key: 'id',
    width: 100,
  },
  {
    title: '模板名称',
    dataIndex: 'name',
    key: 'name',
    width: 150,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    key: 'remark',
    width: 200,
  },
  {
    title: '排序',
    dataIndex: 'sort',
    key: 'sort',
    width: 100,
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    render(row) {
      return h(
        NTag,
        {
          style: {
            marginRight: '6px',
          },
          type: row.status === 1 ? 'info' : 'error',
          bordered: false,
        },
        {
          default: () => (row.status === 1 ? '正常' : '禁用'),
        }
      );
    },
    width: 150,
  },
  {
    title: '更新时间',
    dataIndex: 'updated_at',
    key: 'updated_at',
    width: 160,
  },
  {
    title: '创建时间',
    dataIndex: 'created_at',
    key: 'created_at',
    width: 160,
  },
];
