var layer_index;

$("#fidxid").change(function () {
    window.location.href = "/fpljy.aspx?dxid=" + $("#fidxid").val();
});

$(".jsweek").click(function () {
    var week = $(this).attr("attrweek");
    var value10 = $(this).attr("value");
    var fidxid = $("#fidxid").val();
    layer.confirm('确认要设置吗？', {
        icon: 3,
        closeBtn: 0,
        btn: ['确定', '取消'] //按钮
    }, function () {
        var var1 = "beduajax.aspx?act=59BAA0CA980187D564B99612BF4D6B39&week=" + week + "&fidxid=" + fidxid + "&value=" + value10;
        var temptext = "";
        var1 = encodeURI((var1));
        $.ajax({
            type: "Post",
            url: var1,
            data: { data1: '13D17C93EDB', },
            cache: false,
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            success: function (temptext) {
                layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
                    if (temptext.indexOf("成功") > -1) {
                        window.location.reload();
                    }
                    return true;
                });
            }
        });
    }
    ,
    function () {
        //window.location.reload();
        if ($("input[id='w6']").attr("checked") == "checked") {
            $("input[id='w6']").prop("checked", true);
        }
        else {
            $("input[id='w6']").prop("checked", false);
        }

        if ($("input[id='w7']").attr("checked") == "checked") {
            $("input[id='w7']").prop("checked", true);
        }
        else {
            $("input[id='w7']").prop("checked", false);
        }

    });

});

//dpljyedit2按节次及解除 
$(".jsjc").click(function () {
    var jc = $(this).attr("attrjc");
    var value10 = $(this).attr("value");
    var fidxid = $("#fidxid").val();
    layer.confirm('确认要设置吗？', {
        icon: 3,
        closeBtn: 0,
        btn: ['确定', '取消'] //按钮  
    },
    function () {
        var var1 = "beduajax.aspx?act=59BAA0CA980187D540E3EF4048E8A676&jc=" + jc + "&fidxid=" + fidxid + "&value=" + value10;
        var temptext = "";
        var1 = encodeURI((var1));
        $.ajax({
            type: "Post",
            url: var1,
            data: { data1: '13D17C93EDB', },
            cache: false,
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            success: function (temptext) {
                layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
                    if (temptext.indexOf("成功") > -1) {
                        window.location.reload();
                    }
                    return true;
                });
            }
        });
    },
    function () {
        //  window.location.reload();

        if ($("input[id='" + jc + "']").attr("checked") == "checked") {
            $("input[id='" + jc + "']").prop("checked", true);
        }
        else {

            $("input[id='" + jc + "']").prop("checked", false);
        }

    });
});

function ZQDdele(id) {//删除时间段
    var1 = "beduajax.aspx?ACT=0713DE03A249A68C4DED391B5AC0C818&id=" + id;
    var temptext = "";
    var1 = encodeURI((var1));
    $.ajax({
        type: "Post",
        url: var1,
        data: { data1: '13D17C93EDB', },
        cache: false,
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        success: function (temptext) {
            layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
                if (temptext.indexOf("成功删除") > -1) {
                    window.location.reload();
                }
                return true;
            });
        }
    });
}

function addUser(title, id) {
    $("#jswintitle").html(title);
    layer_index = layer.open({
        type: 1,
        title: false,
        closeBtn: 0,
        shift: false,
        content: $("#jsAddUser"),
    });
    $("#id").val(id);
    //如果 id == "0"  是新增
    if (id == "0") {
        // $("#fvdxsm").val("无");
    }
    else {//是修改，调用getuser()
        getuser(id);
    }
}

//AJAX读取USER信息
function getuser(id) {

    var1 = "beduajax.aspx?ACT=4CFFB99DB90E85DA661C824957BD07FE&id=" + id;
    var temptext = "";
    var1 = encodeURI((var1));
    $.ajax({
        type: "Post",
        url: var1,
        data: { data1: '13D17C93EDB', },
        cache: false,
        contentType: "application/x-www-form-urlencoded;?charset=UTF-8",
        success: function (temptext) {
            var arr = new Array();
           // alert(temptext);
            arr = temptext.split("|");
            $("#fvjyks").val(arr[0]);
            $("#fvjyjs").val(arr[1]);

        }
    });


}

//关闭弹出
function cansleAdd() {
    layer.close(layer_index);
    clearWin();
}
//清除窗体中内容
function clearWin() {
    $("#jsAddUser").find("input").each(function () {
        $(this).val("");
    });
}

//新增
function Zsend(var1) {
    temptext = var1;
    layer.msg(temptext, { icon: 1, btn: ['确定'] }, function () {
        if (temptext.indexOf("成功") > -1) {
            window.location.reload();
        }

    });
}
function ZDELESELE(id) {
    layer.confirm('确认要删除吗？', {
        icon: 3, btn: ['确定', '取消'] //按钮
    }, function () {
        temp = ZQDdele(id);
    });
}


////



