yanghb
2023-04-10 b2f678ad387ca24e05a11100ea4583f0f2f730f0
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
/**
 * 通知管理初始化
 */
var BalanceModify = {
    id: "BalanceModifyTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
BalanceModify.initColumn = function () {
    return [
        {field: 'selectItem',visible: false, radio: true},
        {title: 'id', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: '修改时间', field: 'createTime', align: 'center', valign: 'middle'},
        {title: '流水ID', field: 'recordID', align: 'center', valign: 'middle'},
        {title: '用户ID', field: 'userId', align: 'center', valign: 'middle'},
        {title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
        {title: '用户手机号', field: 'phone', align: 'center', valign: 'middle'},
        {title: '金额', field: 'money', align: 'center', valign: 'middle'},
        {title: '类型', field: 'type', align: 'center', valign: 'middle',
            formatter: function (value,row) {
                switch (value) {
                    case 1:
                        return "增加";
                    case 2:
                        return "减少";
                }
            }
        }
    ];
};
 
/**
 * 检查是否选中
 */
BalanceModify.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        BalanceModify.seItem = selected[0];
        return true;
    }
};
 
 
 
/**
 * 删除
 */
BalanceModify.delete = function(){
    if (this.check()){
        var operation = function(){
            var ajax = new $ax(Feng.ctxPath + "/paymentRecord/deleteBalanceModify", function (data) {
                Feng.success("删除成功!");
                BalanceModify.table.refresh();
            }, function (data) {
                Feng.error("删除失败!" + data.responseJSON.message + "!");
            });
            ajax.set("balanceModifyId", BalanceModify.seItem.id);
            ajax.start();
        };
        Feng.confirm("是否删除修改记录?", operation);
    }
};
 
 
///  导出
BalanceModify.excel = function(){
    var arr = $("#insertTime").val().split(" - ");
    window.location.href = Feng.ctxPath + "/report/exportRecordBalanceModify?userId=" + $("#userId").val() + "&startTime=" + arr[0] + "&endTime=" + arr[1];
};
 
 
 
/**
 * 查询通知列表
 */
BalanceModify.search = function () {
    var queryData = {};
    queryData['userId'] = $("#userId").val();
    var arr = $("#insertTime").val().split(" - ");
    queryData['startTime'] = arr[0];
    queryData['endTime'] = arr[1];
    BalanceModify.table.refresh({query: queryData});
};
 
 
BalanceModify.toSelectOpt = function () {
    var index = layer.open({
        type: 2,
        title: '选择用户',
        area: ['90%', '80%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/report/user'
    });
    this.layerIndex = index;
}
 
function selectOpt(ids,names){
    $("#userName").val(names);
    $("#userId").val(ids);
}
 
 
BalanceModify.resetSearch = function () {
    $("#insertTime").val("");
    $("#userId").val("");
    $("#userName").val("");
    BalanceModify.search();
};
$(function () {
    var defaultColunms = BalanceModify.initColumn();
    var table = new BSTable(BalanceModify.id, "/report/balanceModifylist", defaultColunms);
    table.setPaginationType("server");
    BalanceModify.table = table.init();
});