
//select2 控件封装
var buildSelect2 = function (node, url, param, formatRepo, formatRepoSelection) {
    $(node).select2({
        language: "zh-CN",
        allowClear: true,
        ajax: {
            url: url,
            dataType: 'json',
            delay: 250,
            data: function (params) {
                if (param==null) {
                    return {
                        name: params.term,
                        page: params.page
                    };
                } else {
                    param.name = params.term;
                    param.page = params.page;

                    return param;
                }
               
            },
            processResults: function (data, params) {
                params.page = params.page || 1;

                return {
                    results: data.list,
                    pagination: {
                        more: (params.page * 30) < data.list.length
                    }
                };
            },
            cache: true
        },
        placeholder: '请选择',
        escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
        minimumInputLength: 1,
        templateResult: formatRepo,
        templateSelection: formatRepoSelection
    });




}


//正则
//邮箱
var emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;