liujie
13 小时以前 8830fb9e58e7e345947b06f6862cdd5b2ae6f0bf
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/**
 * 跨城站点管理管理初始化
 */
var WorldCupGameStatisticsListInfo = {
    id: "WorldCupGameStatisticsListInfoTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1,
    storeIds: [],
    storeIds1: [],
};
 
/**
 * 初始化表格的列
 */
WorldCupGameStatisticsListInfo.initColumn = function () {
    return [
        {field: 'selectItem', checkbox: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '用户姓名', field: 'name', visible: true, align: 'center', valign: 'middle',},
        {title: '比赛时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'},
        {title: '比分', field: 'score', visible: true, align: 'center', valign: 'middle'},
        {title: '结果', field: 'matchResult', visible: true, align: 'center', valign: 'middle'},
        {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',
            formatter:function (data, item) {
                return '<a href="#" onclick="WorldCupGameStatisticsListInfo.changeScore(\'' + data + '\',' + item.blue + ',' + item.red + ')" style="color:blue;">修改比分</a>';
            }
        },
    ];
};
 
/**
 * 检查是否选中
 */
WorldCupGameStatisticsListInfo.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        WorldCupGameStatisticsListInfo.seItem = selected[0];
        return true;
    }
};
/**
 * 商户号认证
 */
WorldCupGameStatisticsListInfo.changeScore = function (id, blue, red) {
    const str = '<div class="row">\n' +
        '                <div class="form-group" style="height: 50px;">\n' +
        '                   <label class="col-sm-3 control-label" style="text-align: right;">蓝方得分:</label>' +
        '                    <div class="col-sm-8">\n' +
        '                        <input id="blue" class="form-control" type="number" min="0" value="' + blue + '"/>\n' +
        '                    </div>\n' +
        '                </div>\n' +
        '                <div class="form-group" style="height: 50px;">\n' +
        '                   <label class="col-sm-3 control-label" style="text-align: right;">红方得分:</label>' +
        '                    <div class="col-sm-8">\n' +
        '                        <input id="red" class="form-control" type="number" min="0" value="' + red + '"/>\n' +
        '                    </div>\n' +
        '                </div>\n' +
        '       </div>'
    layer.open({
        type: 1
        ,title: '修改比分'
        ,area: ['500px', '300px']
        ,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
        ,id: 'layerDemo' //防止重复弹出
        ,content: '<div style="padding: 20px">' + str + '</div>'
        ,btnAlign: 'c' //按钮居中
        ,shade: 0.5 //不显示遮罩
        ,btn: ['确认', '关闭']
        ,yes: function (){
            let blue = $('#blue').val();
            let red = $('#red').val();
            if(null == blue || '' == blue){
                Feng.error("请填写有效的得分");
                return
            }
            if(null == red || '' == red){
                Feng.error("请填写有效的得分");
                return
            }
            //提交信息
            var ajax = new $ax(Feng.ctxPath + "/worldCupRecords/changeScore", function (res) {
                if (res.code==200){
                    Feng.success("修改成功!");
                    WorldCupGameStatisticsListInfo.search();
                    layer.closeAll();
                }else{
                    Feng.error(res.msg);
                }
            }, function (data) {
                Feng.error("修改失败!" + data.responseJSON.message + "!");
            });
            ajax.set({
                'id': id,
                'blue': blue,
                'red': red
            });
            ajax.start();
        }
    });
};
 
WorldCupGameStatisticsListInfo.selecUserOpt = function (arrays){
 
    //获取所有的值
    var subArr= this.storeIds;
 
    $(".timeClass").each(function () {
        subArr.push($(this).find("input[name*='id']").val());
    });
    let size = subArr.length
    console.log(size)
    var str = '';
    for(var i in arrays){
        var b = true;
        for(var j in subArr){
            if(arrays[i].id === Number(subArr[j])){
                b = false;
                break
            }
        }
        if(b){
            this.storeIds.push(arrays[i].id)
            str += '<tr class="timeClass">' +
                '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="id" name="id" value="'+arrays[i].id+'">' + arrays[i].id + '</td>' +
                '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' +
                '<td><input type="hidden" id="phone" name="phone" value="'+arrays[i].phone+'">' + arrays[i].phone +
                '<td><input type="hidden" id="sex" name="sex" value="'+arrays[i].sex+'">' + arrays[i].sex +
                '<td><input type="hidden" id="age" name="age" value="'+arrays[i].age+'">' + arrays[i].age +
                '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
        }
    }
    console.log("添加门店后的场地数组和门店数组")
    console.log(this.storeIds)
    console.log(this.siteIds)
    $("#coun").append(str);
}
WorldCupGameStatisticsListInfo.selecUserOpt1 = function (arrays){
    console.log(3333)
    //获取所有的值
    var subArr= this.storeIds1;
    $(".timeClass").each(function () {
        subArr.push($(this).find("input[name*='id']").val());
    });
    var str = '';
    for(var i in arrays){
        var b = true;
        for(var j in subArr){
            if(arrays[i].id === Number(subArr[j])){
                b = false;
                break
            }
        }
        if(b){
            this.storeIds1.push(arrays[i].id)
            str += '<tr class="timeClass">' +
                '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="id" name="id" value="'+arrays[i].id+'">' + arrays[i].id + '</td>' +
                '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' +
                '<td><input type="hidden" id="phone" name="phone" value="'+arrays[i].phone+'">' + arrays[i].phone +
                '<td><input type="hidden" id="sex" name="sex" value="'+arrays[i].sex+'">' + arrays[i].sex +
                '<td><input type="hidden" id="age" name="age" value="'+arrays[i].age+'">' + arrays[i].age +
                '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
        }
    }
    console.log("添加门店后的场地数组和门店数组")
    console.log(this.storeIds1)
    console.log(this.siteIds)
    $("#coun1").append(str);
}
function deleteSub(e) {
    console.log(e);
    var row = $(e).closest('tr');
    var value = row.find('#id').val();
    WorldCupGameStatisticsListInfo.storeIds.splice(WorldCupGameStatisticsListInfo.storeIds.indexOf(parseInt(value)), 1)
    $(e).parent().parent().remove();
    console.log('storeIds',WorldCupGameStatisticsListInfo.storeIds)
}
 
/**
 * 关闭此对话框
 */
WorldCupGameStatisticsListInfo.close = function() {
    parent.layer.close(window.parent.WorldCupGameStatisticsInfo.layerIndex);
};
 
WorldCupGameStatisticsListInfo.search = function () {
    var queryData = {};
    queryData['participantId']  = $("#participantId").val();
    queryData['participantType']  = $("#participantType").val();
    queryData['name']  = $("#name").val();
    WorldCupGameStatisticsListInfo.table.refresh({query: queryData});
};
 
WorldCupGameStatisticsListInfo.resetSearch = function () {
    $("#name").val("");
    WorldCupGameStatisticsListInfo.search();
};
 
$(function () {
    var defaultColunms = WorldCupGameStatisticsListInfo.initColumn();
    var table = new BSTable(WorldCupGameStatisticsListInfo.id, "/worldCupRecords/worldCupGameStatisticsListInfo", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams({
        'participantId': $('#participantId').val(),
        'participantType': $('#participantType').val()
    })
    WorldCupGameStatisticsListInfo.table = table.init();
 
});