import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.SaleQuotationComponentEntity;
export type TableColumnItem = TableColumn<TableListItem>;
export const baseColumns: TableColumnItem[] = [
  {
    title: '配件名称',
    dataIndex: 'name',
  },
  {
    title: '配件规格',
    dataIndex: 'componentSpecification',
  },
  {
    title: '单位',
    dataIndex: 'unit',
    width: 80,
    customRender: ({ record }) => {
      return record?.unit?.label || '';
    },
  },
  {
    title: '单价',
    hideInSearch: true,
    width: 80,
    dataIndex: 'unitPrice',
    customRender: ({ record }) => {
      return parseFloat(record.unitPrice) || 0;
    },
  },
  {
    title: '备注',
    dataIndex: 'remark',
  },
];
