import { ColumnType } from '@/common/methods/table';
import { getWareHouseTypeName } from '@/common/constants/enumsName';

/**
 * 明细表头
 */
export function getDetailColumns(code: string): ColumnType[] {
    let type;
    switch (code) {
        case 'inventory_manager_inbound_details':
            type = '入库';
            break;
        case 'inventory_manager_outbound_details':
            type = '出库';
            break;
    }

    return [
        {
            title: '现货品种',
            dataIndex: 'deliverygoodsname',
            key: 'deliverygoodsname',
            align: 'center',
            width: 120,
        },
        {
            title: '商品',
            dataIndex: 'wrstandardname',
            key: 'wrstandardname',
            align: 'center',
            width: 120,
        },
        {
            title: '品牌',
            dataIndex: 'brandname',
            key: 'brandname',
            align: 'center',
            width: 120,
        },
        {
            title: '仓库',
            dataIndex: 'warehousename',
            key: 'warehousename',
            align: 'center',
            width: 120,
        },
        {
            title: type + '类型',
            dataIndex: 'warehousetype',
            key: 'warehousetype',
            align: 'center',
            width: 120,
            customRender: ({ text }: { text: number }) => {
                return getWareHouseTypeName(text);
            }
        },
        {
            title: type + '数量',
            dataIndex: 'qty',
            key: 'qty',
            align: 'center',
            width: 120,
        },
        {
            title: '合同编号',
            dataIndex: 'contractno',
            key: 'contractno',
            align: 'center',
            width: 120,
        },
        {
            title: type + '登记时间',
            dataIndex: 'applytime',
            key: 'applytime',
            align: 'center',
            width: 120,
        },
        {
            title: type + '登记人',
            dataIndex: 'applyname',
            key: 'applyname',
            align: 'center',
            width: 120,
        },
        {
            title: type + '审核时间',
            dataIndex: 'audittime',
            key: 'audittime',
            align: 'center',
            width: 120,
        },
        {
            title: type + '审核人',
            dataIndex: 'auditname',
            key: 'auditname',
            align: 'center',
            width: 120,
        },
    ];
}