$(function () {
    //筛选用户名
    $("#userNameSerach_Btn").click(function () {
        if ($("#userNameSerach_txt").val() != "") {
            location.href = $(this).attr("href") + "?sift=&username=" + $("#userNameSerach_txt").val() + "&page=1";
            setNaviSpan('查找[' + $("#userNameSerach_txt").val() + ']', $(this).attr("href") + "?sift=&username=" + $("#userNameSerach_txt").val() + "&page=1");
        } else {
            location.href = $(this).attr("href");
        }
        return false;
    })
    //删除日志
    $("a[rel='del']").click(function () {
        if (confirm('确定要删除吗？')) {
            var $delObject = $(this);
            $.ajax({
                type: "POST",
                url: "Ajax/UserDispose.ashx",
                data: { 'com': 'deluserlog', 'logid': $delObject.attr("href") },
                datatype: "json",
                beforeSend: function (data, textStatus) {
                    showMsg("正在删除中", true);
                },
                success: function (data, textStatus) {
                    if (data == "1") {
                        $delObject.parent().parent("tr").remove();
                    } else {
                        alert("删除失败!");
                    }
                    showMsg("", false);
                },
                error: function (e) { alert("连接失败,请向Eoyoo官方技术人员反馈!"); }
            })
        }
        return false;
    })
    //全选反选
    $("#allLogList_Btn").click(function () {
        $("[name='logId_chk']").each(function () {
            if ($(this).attr("checked")) {
                $(this).removeAttr("checked");
            } else {
                $(this).attr("checked", true);
            }
        });
    });
    //删除所选
    $("#delChekLog_Btn").click(function () {
        if (confirm('确定要删除所选日志吗？')) {
            var $delObject = $(this);
            var logObject = "";
            $("[name='logId_chk']").each(function () {
                if ($(this).attr("checked")) {
                    logObject += $(this).val() + ",";
                }
            })
            $.ajax({
                type: "POST",
                url: "Ajax/UserDispose.ashx",
                data: { 'com': 'deluserlog', 'logid': logObject },
                datatype: "json",
                beforeSend: function (data, textStatus) {
                    showMsg("正在删除所选 ", true);
                },
                success: function (data, textStatus) {
                    if (data == "1") {
                        location.reload();
                    } else {
                        alert("删除失败!");
                    }
                    showMsg("", false);
                },
                error: function (e) { alert("连接失败,请向Eoyoo官方技术人员反馈!"); }
            })
        }
        return false;
    })
})