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

export const columns = [
  {
    title: '城市名称',
    dataIndex: 'name',
    key: 'name',
    width: 300,
  },
  {
    title: '城市拼音',
    dataIndex: 'pinyin',
    key: 'pinyin',
    width: 100,
  },
  {
    title: '城市级别',
    dataIndex: 'level',
    key: 'level',
    width: 100,
    customRender({ record }) {
      let levelText = '';
      switch (record.level) {
        case 0:
          levelText = '省份';
          break;
        case 1:
          levelText = '城市';
          break;
        case 2:
          levelText = '县区';
          break;
        case 3:
          levelText = '街道';
          break;
        case 4:
          levelText = '居委会';
          break;
        default:
          break;
      }
      return h('span', levelText || '-');
    },
  },
  {
    title: '城市区号',
    dataIndex: 'cityCode',
    key: 'cityCode',
    width: 100,
  },
  {
    title: '行政编码',
    dataIndex: 'areaCode',
    key: 'areaCode',
    width: 100,
  },
  {
    title: '城市邮编',
    dataIndex: 'zipCode',
    key: 'zipCode',
    width: 100,
  },
  {
    title: '操作',
    width: 200,
    fixed: 'right',
    key: 'action',
    dataIndex: 'action',
  },
];
