{"size": 2236, "ext": "js", "max_stars_repo_path": "aspnet-core/src/JK.Web.Mvc/wwwroot/view-resources/Views/LoginLogs/Index.js", "max_stars_repo_name": "Poepon/JK-Template", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "aspnet-core/src/JK.Web.Mvc/wwwroot/view-resources/Views/LoginLogs/Index.js", "max_issues_repo_name": "Poepon/JK-Template", "max_issues_repo_issues_event_min_datetime": "2021-09-02T09:17:29.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T10:03:15.000Z", "max_forks_repo_path": "aspnet-core/src/JK.Web.Mvc/wwwroot/view-resources/Views/LoginLogs/Index.js", "max_forks_repo_name": "Poepon/JK-Template", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 31.4929577465, "max_line_length": 128, "alphanum_fraction": 0.3926654741}
﻿(function () {
    $(function () {
        //对应AppService API.
        var _userLoginService = abp.services.app.userLogin;

        //查询按钮事件
        $('#QueryButton').click(function () {
            dataTableReload();
        });

        $("#datetimeRange").daterangepicker(
            app.createDateRangePickerOptions(),
            function (start, end, label) {
                if (start.isValid() && end.isValid()) {
                    $("#input[name='StartTime']").val(start.format('YYYY-MM-DDT00:00:00Z'));
                    $("#input[name='EndTime']").val(end.format('YYYY-MM-DDT23:59:59.999Z'));
                } else {
                    $("#input[name='StartTime']").val('');
                    $("#input[name='EndTime']").val('');
                }
            });

        var _$dataTable = $('#DataTable');
        //列表
        var dataTable = _$dataTable.DataTable({
            paging: true,
            serverSide: true,
            processing: true,
            listAction: {
                //查询数据的方法
                ajaxFunction: _userLoginService.getUserLoginAttempts,
                inputFilter: function () {
                    var prms = {};
                    $("#LoginLogsFilter").serializeArray().map(function (x) { prms[abp.utils.toCamelCase(x.name)] = x.value; });
                    return prms;
                }
            },
            columnDefs: [
                {
                    targets: 0,
                    data: "userNameOrEmailAddress"
                },
                {
                    targets: 1,
                    data: "clientIpAddress"
                },
                {
                    targets: 2,
                    data: "browserInfo"
                },
                {
                    targets: 3,
                    data: "result"
                }, 
                {
                    targets: 4,
                    data: "creationTime",
                    render: function (creationTime) {
                        return moment(creationTime).format('YYYY-MM-DD HH:mm');
                    }
                }
            ]
        });

        function dataTableReload() {
            dataTable.ajax.reload();
        }

    });
})();
