/**
 *
 * @author BOGON
 * @version 1.0
 */

var page = {
    init: function () {
        $("#tb").datagrid({
            singleSelect: single===1,
            pagination: true,
            height: $(window).height() - 20,
            rownumbers: true,
            striped: true,
            method: "GET",
            url: g.ctx + "pc/supplier/contact/rest/list?supplierCode=" + supplierCode + "&type=" + type,
            columns: [[
                {
                    field: 'ck',
                    checkbox: true
                }, {
                    field: 'contactsType',
                    title: '联系人类型',
                    width: '15%',
                    align: 'left',
                    formatter: function (value, row) {
                        return getDicName("supplier_role_type", value);
                    },
                }, {
                    field: 'contactsName', title: '姓名', width: '15%', align: 'left',
                }, {
                    field: 'contactsTel', title: '电话', width: '15%', align: 'left',
                }, {
                    field: 'email', title: '邮箱', width: '15%', align: 'left',
                }, {
                    field: 'remark', title: '备注', width: '20%', align: 'left',
                }]],
        });
    }
}

function getChecked() {
    return $("#tb").datagrid("getChecked")
}
function chooseRow(callback) {
    let rows = $('#tb').datagrid('getSelections');
    if (single===1) {
        callback(rows[0]);
    } else {
        callback(rows);
    }

}
$(function () {
    initDict("supplier_role_type")
    page.init();
})