columns.tsx 1012 Bytes
import type { ColumnsType } from 'antd/es/table';
import { StatusTag } from '@/components/StatusTag';
import { PermButton, P } from '@/access';
import type { StoreStatus } from '@/config/storeStatus';
import type { StoreRow } from '../tools/fetchStores';

export function buildColumns(): ColumnsType<StoreRow> {
  return [
    { title: '门店ID', dataIndex: 'id' },
    { title: '门店名称', dataIndex: 'name' },
    { title: '城市', dataIndex: 'city' },
    { title: '业务场景', dataIndex: 'scene' },
    {
      title: '状态',
      dataIndex: 'status',
      render: (s: StoreStatus) => <StatusTag status={s} />,
    },
    { title: '负责人', dataIndex: 'owner' },
    {
      title: '操作',
      key: 'op',
      width: 120,
      fixed: 'right',
      render: () => (
        <PermButton
          permission={P.STORE_LISTING_DELETE}
          type="link"
          danger
          unauthorizedTip="无删除权限"
        >
          删除
        </PermButton>
      ),
    },
  ];
}