lisy
2023-07-27 81932e21cb584b992bdbde80df84eb81f77073d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
 * 日志管理初始化
 */
var LoginLog = {
    id: "LoginLogTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
LoginLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '日志名称', field: 'logname', align: 'center', valign: 'middle'},
        {title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
        {title: '时间', field: 'createtime', align: 'center', valign: 'middle'},
        /*{title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true},*/
        {title: 'ip', field: 'ip', align: 'center', valign: 'middle'}];
};
 
/**
 * 检查是否选中
 */
LoginLog.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        if(language==1){
            Feng.info("请先选中表格中的某一记录!");
        }else if(language==2){
            Feng.info("Please select 条记录 in the table first!");
        }else {
            Feng.info("Pilih catatan di tabel terlebih dahulu!");
        }
 
        return false;
    } else {
        LoginLog.seItem = selected[0];
        return true;
    }
};
 
 
/**
 * 清空日志
 */
LoginLog.delLog = function () {
    Feng.confirm("是否清空所有日志?", function () {
        var ajax = Feng.baseAjax("/loginLog/delLoginLog", "清空日志");
        ajax.start();
        LoginLog.table.refresh();
    });
}
 
/**
 * 查询日志列表
 */
LoginLog.search = function () {
    var queryData = {};
 
    queryData['logName'] = $("#logName").val();
    queryData['beginTime'] = $("#beginTime").val();
    queryData['endTime'] = $("#endTime").val();
 
    LoginLog.table.refresh({query: queryData});
};
 
/**
 * 搜索充值
 */
LoginLog.resetSearch = function () {
    $("#beginTime").val("");
    $("#endTime").val("");
    $("#logName").val("");
    LoginLog.search();
}
 
$(function () {
 
    init();
 
    var defaultColunms = LoginLog.initColumn();
    var table = new BSTable(LoginLog.id, "/loginLog/list", defaultColunms);
    table.setPaginationType("server");
    LoginLog.table = table.init();
});
 
function init() {
 
    var BootstrapTable = $.fn.bootstrapTable.Constructor;
    BootstrapTable.prototype.onSort = function (event) {
        var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(),
            $this_ = this.$header.find('th').eq($this.index()),
            sortName = this.header.sortNames[$this.index()];
 
        this.$header.add(this.$header_).find('span.order').remove();
 
        if (this.options.sortName === $this.data('field')) {
            this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
        } else {
            this.options.sortName = sortName || $this.data('field');
            this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
        }
        this.trigger('sort', this.options.sortName, this.options.sortOrder);
 
        $this.add($this_).data('order', this.options.sortOrder);
 
        // Assign the correct sortable arrow
        this.getCaret();
 
        if (this.options.sidePagination === 'server') {
            this.initServer(this.options.silentSort);
            return;
        }
 
        this.initSort();
        this.initBody();
    };
    BootstrapTable.prototype.getCaret = function () {
        var that = this;
 
        $.each(this.$header.find('th'), function (i, th) {
            var sortName = that.header.sortNames[i];
            $(th).find('.sortable').removeClass('desc asc').addClass((sortName || $(th).data('field')) === that.options.sortName ? that.options.sortOrder : 'both');
        });
    };
}