import { h } from 'vue';
import { Tag } from 'ant-design-vue';

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