/**
 *  view/delivery/appointment_record/look_up.ftl
 *  查看页面
 */

let el = {
    tb: '#tb',
    id: "#id",
    bodyHeight: document.documentElement.clientHeight,
};

$(function () {
    loadTable();
});


/**
 * 加载表格
 */
function loadTable() {
    var columns = [], url = "", queryParams = {};
    columns = [
        [
            {
                field: 'ck',
                checkbox: true
            },
            {
                field: 'appointmentCode',
                title: '预约编码',
                width: 120,
            },
            {
                field: 'appointmentDate',
                title: '当前预约时间',
                width: '160',
                align: 'left',
                formatter: function (value, row, index) {
                    if (value) {
                        return moment(value).format('YYYY-MM-DD') + " " + row.appointmentStartTime + "-" + row.appointmentEndTime;
                    } else {
                        return value;
                    }
                }
            },
            {
                field: 'poCode',
                title: '采购订单',
                width: 160,
            },
            {
                field: 'poItemNo',
                title: '订单行号',
                width: 100,
            },
            {
                field: 'materialCode',
                title: '物料编码',
                width: 100,
            },
            {
                field: 'materialName',
                title: '物料名称',
                width: 100,
            },
            {
                field: 'deliveryCode',
                title: '送货编码',
                width: 100,
            },
            {
                field: 'rowNo',
                title: '发货单行号',
                width: 100,
            },
            {
                field: 'materialBatchNum',
                title: '物料批次',
                width: 100,
            },

            {
                field: 'currDeliveryNum',
                title: '本次交货数量',
                width: 100,
            },
            {
                field: 'unit',
                title: '单位',
                width: 100,
            },
            {
                field: 'batchDate',
                title: '生产日期',
                width: 100,
            },
            {
                field: 'cartonSize',
                title: '外箱尺寸',
                width: 100,
            },
            {
                field: 'maxCartonNum',
                title: '外包装满箱数量',
                width: 100,
            },
            {
                field: 'innerSize',
                title: '内箱尺寸',
                width: 100,
            },
            {
                field: 'minInnerNum',
                title: '最小包装数量',
                width: 100,
            },
            {
                field: 'checkMethod',
                title: '检验方式',
                width: 100,
            },
        ]
    ];
    url = g.ctx + "pc/order/appointmentRecord/rest/deliveryDetailsRecord";
    queryParams = {
        id: $(el.id).val(),
    };

    let searchHeight = $(el.form).outerHeight();
    let pager = initGridPagerNew(el.bodyHeight - searchHeight, 37, 40);
    $(el.tb).datagrid({
        iconCls: 'icon-list',
        loadMsg: '数据加载中......',
        url: url,
        height: el.bodyHeight,
        singleSelect: false,
        pagination: true,
        rownumbers: true,
        pageSize: pager.pageSize,
        pageList: pager.pageList,
        queryParams: queryParams,
        columns: columns,
    });
}




