/*!
 * Modernizr v2.8.3
 * www.modernizr.com
 *
 * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
 * Available under the BSD and MIT licenses: www.modernizr.com/license/
 */

/*
 * 负责人控件选择
 */


(function ($) {

    $.SelectLeader = function (_l, backData) {

        var id = _l.id;

        $.popAlter({
            content: "正在加载账户，请稍等...",
            Buttons: [{Name:"确定",Val:1}],
            okCallback: function (btnval) {
                if(btnval == 1){
                var that = $(".ok-click");
                that.hide().after("<span>请稍后...</span>");

                var userId = $("#kq_content").find('input:radio:checked').attr("userId");
                var userName = $("#kq_content").find('input:radio:checked').attr("userName");

                if (userId == undefined || userId == "") {
                    alert("请选择用户");
                    that.show().next("span").remove();
                } else {

                    $('#sysmodal').modal('hide');

                    var areaData = '{LeaderId:' + userId + ',LeaderName:"' + userName + '"}';

                    var areas = eval("([" + areaData + "])");
                    backData(areas);
                }}
            }
        });


        $.ajax({
            type: "POST",
            url: "/part/LeaderPartial?id=" + id,
            success: function (data) {
                $(".modal-body").html(data);
            }
        });
    }
})(jQuery);