function Pop(_src, _width, _height, _title) {
    if (!_width) {
        _width = 500;
    }

    if (!_height) {
        _height = 380;
    }

    if (!_title) {
        _title = "信息说明";
    }


    layer.open({
        type: 2,
        title: _title,
        shadeClose: true,
        shade: 0.8,
        area: [_width + 'px', _height + 'px'],
        content: _src
    });

}


function ept(url) {
    Pop(url, 850, 550, "");
}



function closedept(cont) {
    $(".department").val($(cont).html());
    layer.closeAll();
}



function chkAll() {
    let form = layui.form;

    form.on('checkbox(chk_all)', function (data) {

        var s = data.elem.checked;
        if (s == true) {
            $(".chk_item[disabled!=disabled]").prop("checked", true);
            form.render('checkbox');
        } else {
            $(".chk_item[disabled!=disabled]").prop("checked", false);
            form.render('checkbox');
        }
    }
    )

    
}

function reRender()
{
    layui.form.render();
}




function op(action, url, popTitle, returnUrl, showIFrame) {


    allvalue = $("#hf_ids").val();

    if (action == "get") {
        return;
    }

    if (action == "delete") {
        return;
    }



    if (showIFrame) {
        ShowIframeNoScroll(url + "&ids=" + allvalue + "&returnUrl=" + returnUrl, "500", "350", popTitle);
    }
    else {
        location.href = url + "&ids=" + allvalue;
    }


}

function ShowIframeNoScroll(_src, _width, _height, _title) {

    layer.open({
        type: 2,
        title: _title,
        shadeClose: true,
        shade: 0.8,
        area: [_width + 'px', _height + 'px'],
        content: _src
    });

}

 

function selectall() {
    var checkFlag = $("#cb_selectall").is(':checked');

    $(".chk_item").each(
        function () {
            if ($(this).prop('disabled') == false) {
                $(this).prop("checked", checkFlag);
            }
        }
        );

}



function isselect() {

    var checked = 0;
    var allvalue = '';

    var _c = 0;
    $(".chk_item").each(

     function () {
         if ($(this).is(':checked')) {
             checked++;

             if (checked > 1) {
                 allvalue += ',' + $(this).val();
             }
             else {
                 allvalue = $(this).val();
             }
         }

     });

    $("#hf_ids").val(allvalue);

    if (checked > 0) {
        return true;
    }
    else {
        layer.alert('请至少选择一条记录', 12);
        return false;
    }

}