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

export const columns = [
  {
    title: '部门名称',
    key: 'name',
    width: 250,
    align: 'left',
  },
  {
    title: '部门类型',
    key: 'type',
    width: 100,
    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;
        case 4:
          typeText = '小组';
          color = '';
          break;
        default:
          break;
      }
      return h(
        NTag,
        {
          type: color,
        },
        {
          default: () => typeText,
        },
      );
    },
  },
  {
    title: '部门排序',
    key: 'sort',
    width: 100,
  },
  {
    title: '部门备注',
    key: 'note',
    width: 200,
  },
  {
    title: '创建人',
    key: 'createUser',
    width: 100,
  },
  {
    title: '创建时间',
    key: 'createTime',
    width: 180,
  },
];
