let el = {
    table : '#tb',
    bodyHeight: document.documentElement.clientHeight
}
 $(function () {
     loadGrid();
});

function loadGrid() {
    const pager = initGridPagerNew(el.bodyHeight, 37, 40);
    const columns = [
        {
            field: 'ck',
            checkbox: true
        },
        {
            field: 'name',
            title: '名称',
            width: 250
        },
        {
            field: 'code',
            title: '字典值',
            width: 150
        },
        {
            field: 'remark',
            title: '备注',
            width: 250
        }
    ]
    $('#tb').datagrid({
        iconCls: 'icon-list',
        method: "GET",
        height: el.bodyHeight,
        url: g.ctx + 'pc/sys/dict/getDicByType?type=' + dictType,
        singleSelect: true,
        pagination: true,
        autoHeight: true,
        loadMsg: "数据加载中......",
        striped: false,
        rownumbers: false,
        fitColumns: false,
        remoteSort: true,
        pageSize: pager.pageSize,
        pageList: pager.pageList,
        columns: [columns]
    });
}

/**
 * 调用页面回调函数
 * @param callback
 */
function confirmCallback(callback) {
    const rows = $(el.table).datagrid('getChecked');
    if (rows.length === 0) {
        $.messager.alert('提示', '请选择一条记录！');
        return;
    }
    callback(rows[0]);
 }