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

export const columns = [
  {
    type: 'selection',
    width: 50,
    fixed: 'left',
  },
  {
    title: 'ID',
    key: 'id',
    width: 50,
    fixed: 'left',
  },
  {
    title: '参数名称',
    key: 'name',
    width: 200,
  },
  {
    title: '参数编码',
    key: 'code',
    width: 250,
  },
  {
    title: '参数值',
    key: 'value',
    width: 200,
  },
  {
    title: '参数类型',
    key: 'type',
    width: 100,
    render(record) {
      return h(
        NTag,
        {
          type: record.type == 0 ? 'processing' : 'warning',
        },
        {
          default: () => (record.type == 0 ? '系统' : '业务'),
        },
      );
    },
  },
  {
    title: '参数状态',
    key: 'status',
    width: 100,
    render(record) {
      return h(
        NTag,
        {
          type: record.status == 1 ? 'success' : 'error',
        },
        {
          default: () => (record.status == 1 ? '正常' : '禁用'),
        },
      );
    },
  },
  {
    title: '排序',
    key: 'sort',
    width: 100,
  },
  {
    title: '备注',
    key: 'note',
    width: 150,
  },
  {
    title: '创建人',
    key: 'createUser',
    width: 100,
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 180,
  },
];
