puzhibing
2023-11-28 7b726d5ff439e7b8bb66369ecc5881e370286bc8
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
/**
 * 角色管理的单例
 */
var Statistics = {
    id: "StatisticsTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
Statistics.initColumn = function () {
    var columns = [
        {field: 'select_item', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: 'ID', field: '', align: 'center', valign: 'middle', width: '100px',
            formatter: function (value, row, index) {
                return index + 1;
            }
        },
        {title: '时间', field: 'createTime', align: 'center', valign: 'middle', width: '100px'},
        {title: '类型', field: 'type', align: 'center', valign: 'middle', width: '100px',
            formatter: function (value, row) {
                switch (value) {
                    case 1:
                        return '推荐优惠';
                    case 2:
                        return '待办任务';
                    case 3:
                        return '签到';
                    case 4:
                        return '我的订单';
                    case 5:
                        return '权益';
                }
            }
        },
        {title: '列表浏览pv', field: 'browse_list_pv', align: 'center', valign: 'middle', width: '100px'},
        {title: '列表浏览uv', field: 'browse_list_uv', align: 'center', valign: 'middle', width: '100px'},
        {title: '列表按钮点击pv', field: 'click_list_pv', align: 'center', valign: 'middle', width: '120px'},
        {title: '列表按钮点击uv', field: 'click_list_uv', align: 'center', valign: 'middle', width: '120px'},
        {title: '详情浏览pv', field: 'browse_info_pv', align: 'center', valign: 'middle', width: '100px'},
        {title: '详情浏览uv', field: 'browse_info_uv', align: 'center', valign: 'middle', width: '100px'},
        {title: '详情按钮点击pv', field: 'click_info_pv', align: 'center', valign: 'middle', width: '120px'},
        {title: '详情按钮点击uv', field: 'click_info_uv', align: 'center', valign: 'middle', width: '120px'}
    ]
    return columns;
};
 
 
/**
 * 检查是否选中
 */
Statistics.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        Statistics.seItem = selected[0];
        return true;
    }
};
 
 
Statistics.exportStatistics = function(){
    const type = $("#type").val();
    const time = $("#time").val();
    let url = Feng.ctxPath + "/statistics/exportPageViewsStatistics?";
    if(null != type && '' != type){
        url += "type=" + type + "&";
    }
    if(null != time && '' != time){
        url += "time=" + time + "&";
    }
    window.location.href = url;
}
 
 
/**
 * 搜索
 */
Statistics.search = function () {
    var queryData = {};
    queryData['type'] = $("#type").val();
    queryData['time'] = $("#time").val();
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
/**
 * 重置
 */
Statistics.resetSearch = function(){
    var queryData = {};
    $("#type").val('');
    $("#time").val('');
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
 
$(function () {
    var defaultColunms = Statistics.initColumn();
    var table = new BSTable(Statistics.id, "/statistics/queryPageViewsStatistics", defaultColunms);
    table.setPaginationType("server");
    Statistics.table = table.init();
 
});