无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
/**
 * 跨城站点管理管理初始化
 */
var WorldCup = {
    id: "WorldCupTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1,
};
/**
 * 初始化表格的列
 */
WorldCup.initColumn = function () {
    return [
        {field: 'selectItem', checkbox: true},
        {title: 'id', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: '比赛名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',},
        {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',},
        {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'},
        {title: '报名条件', field: 'age', visible: true, align: 'center', valign: 'middle',
            formatter:function (data, item) {
                return item.age + "," + {0:"全部",1:"男",2:"女"}[item.gender]
            }
        },
        {title: '最大报名人数-已报名人数', field: 'maxPeople', visible: true, align: 'center', valign: 'middle'},
        {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return {1:"未开始",2:"已开始",3:"已结束", 4:"已取消"}[data]
            }
        },
    ];
};
 
/**
 * 检查是否选中
 */
WorldCup.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        WorldCup.seItem = selected[0];
        return true;
    }
};
/**
 * 商户号认证
 */
WorldCup.openAddWorldCup = function () {
    var index = layer.open({
        type: 2,
        title: '添加比赛',
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/worldCup/openAddWorldCup'
    });
    this.layerIndex = index;
};
/**
 * 编辑
 */
WorldCup.openEditWorldCup = function () {
    if(this.check()){
        var index = layer.open({
            type: 2,
            title: '编辑比赛',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/worldCup/openEditWorldCup?id=' + WorldCup.seItem.id
        });
        this.layerIndex = index;
    }
};
 
 
WorldCup.openWorldCupInfo = function () {
    if(this.check()){
        var index = layer.open({
            type: 2,
            title: '比赛详情',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/worldCup/openInfoWorldCup?id=' + WorldCup.seItem.id
        });
        this.layerIndex = index;
    }
};
 
 
WorldCup.cancelWorldCup = function(){
    if(this.check()){
        var operation = function(){
            layer.load();
            var id = WorldCup.seItem.id;
            var ajax = new $ax(Feng.ctxPath + "/worldCup/updateState", function (res) {
                if(res.code == 200){
                    Feng.success("取消成功");
                    WorldCup.search();
                    layer.closeAll();
                }else{
                    Feng.error(res.msg);
                }
            }, function (data) {
                Feng.error("取消失败!" + data.responseJSON.message + "!");
            });
            ajax.set("id", id);
            ajax.set("state", 3);
            ajax.start();
        };
        Feng.confirm("是否取消赛事:       " + WorldCup.seItem.name + "?",operation);
 
    }
}
 
 
 
 
/**
 * 下架
 */
WorldCup.registeredPersonnel = function () {
    if(this.check()){
        var index = layer.open({
            type: 2,
            title: '已报名人员',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/worldCup/openRegisteredPersonnel?id=' + WorldCup.seItem.id
        });
        this.layerIndex = index;
    }
};
 
 
 
 
 
 
/**
 * 关闭此对话框
 */
WorldCup.close = function() {
    parent.layer.close(window.parent.WorldCup.layerIndex);
};
 
WorldCup.search = function () {
    var queryData = {};
    queryData['name']  = $("#name").val();
    queryData['startTime'] =$("#startTime").val();
    queryData['endTime'] =$("#endTime").val();
    queryData['status'] =$("#status").val();
    WorldCup.table.refresh({query: queryData});
};
 
WorldCup.resetSearch = function () {
    $("#name").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    $("#status").val("");
    WorldCup.search();
};
 
$(function () {
    var defaultColunms = WorldCup.initColumn();
    var table = new BSTable(WorldCup.id, "/worldCup/listAll", defaultColunms);
    table.setPaginationType("server");
    WorldCup.table = table.init();
 
});