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

const types = {
  1: '材料',
  2: '装备',
  3: '钻石',
  4: '金币',
};
export const columns = [
  {
    title: '序号',
    dataIndex: 'id',
    key: 'id',
    width: 100,
  },
  {
    title: '配装别名',
    dataIndex: 'name',
    key: 'name',
    width: 200,
  },
  {
    title: '配装类型',
    dataIndex: 'type',
    key: 'type',
    render(row) {
      return types[row.type] ?? `未知`;
    },
    width: 100,
  },
  {
    title: '关联ID',
    dataIndex: 'mid',
    key: 'mid',
    width: 100,
  },
  {
    title: '操作数量',
    dataIndex: 'nums',
    key: 'nums',
    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,
  },
];
