import { RenderScope } from "@/components/ProTable/interface";
// 销售订单  表格配置项
export const COLUMNS = [
    { type: "selection", fixed: "left", width: 40 },
    {
        align: "left",
        fixed: true,
        label: "订单号",
        prop: "orderBillNo",
        width: "200"
    },

    {
        align: "left",
        fixed: true,
        label: "装箱序号",
        prop: "boxSortCount",
        width: "80",
        render: (scope: RenderScope<any>): VNode | string | any => {
            if (scope.row.isTail) {
                return scope.row.boxSortCount + "/" + scope.row.boxSortCount;
            } else {
                return scope.row.sort + "/" + scope.row.boxSortCount;
            }
        }
    },

    {
        align: "left",
        label: "规格型号",
        prop: "specifications",
        width: "220"
    },
    {
        align: "left",
        label: "物料编码",
        prop: "materialNumber",
        width: "160"
    },
    {
        align: "left",
        label: "物料名称",
        prop: "materialName",
        width: "160"
    },
    {
        align: "left",
        label: "内装数量(PSC)", //productQty
        prop: "Qty",
        width: "120",
        render: (scope: RenderScope<any>): VNode | string | any => {
            //当总数小于等于1时，显示产品数量
            if (scope.row.boxSortCount <= 1) {
                return scope.row.productQty;
            }
            //是否尾数
            if (scope.row.isTail) {
                return scope.row.tailboxQty;
            } else {
                return scope.row.cratingQty;
            }
        }
    },
    {
        align: "left",
        label: "可装箱数量(PSC)",
        prop: "cratingQty",
        width: "120"
    },
    {
        align: "left",
        label: "净重(KG)",
        prop: "weightQty",
        width: "120",
        render: (scope: RenderScope<any>): VNode | string =>
            scope.row.isTail ? scope.row.tailboxNetWeightQty : scope.row.cratingNetWeightQty
    },
    {
        align: "left",
        label: "毛重(KG)",
        prop: "grossQty",
        width: "120",
        render: (scope: RenderScope<any>): VNode | string =>
            scope.row.isTail ? scope.row.tailboxGrossWeightQty : scope.row.cratingGrossWeightQty
    },
    {
        align: "left",
        label: "备注",
        prop: "remark",
        width: "200",
        render: (scope: RenderScope<any>): VNode | string => (scope.row.remark ? scope.row.remark : "--")
    },
    {
        align: "left",
        label: "操作人",
        prop: "creator",
        width: "200"
    },
    {
        align: "left",
        label: "生成时间",
        prop: "createTime",
        width: "200"
    },
    {
        align: "left",
        label: "箱唛",
        prop: "billNo",
        width: "160"
    }
];
