-
Notifications
You must be signed in to change notification settings - Fork 2
/
order.php
400 lines (360 loc) · 11.7 KB
/
order.php
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<?php
/**
* @name 生蚝体育竞赛管理系统-Web2-赛事分组
* @author Jerry Cheung <[email protected]>
* @since 2019-06-27
* @version 2019-07-22
*/
?>
<!DOCTYPE html>
<html>
<?php
$pageName='赛事分组';
include 'include/header.php';
?>
<?php include 'include/component.php'; ?>
<body style="background-color:#57c5e2;">
<div id="app">
<choose-games-modal></choose-games-modal>
<page-navbar></page-navbar>
<games-title ref="header"></games-title>
<div class="container">
<div class="row">
<games-navbar></games-navbar>
<div class="col-md-10">
<ul class="nav nav-tabs">
<li id="orderTab" class="active"><a onclick="vm.clean();vm.type=1;$('#orderSelect').show();$('#groupSelect').hide();$('#athleteSelect').hide();$('#orderTab').attr('class','active');$('#groupTab').attr('class','');$('#athleteTab').attr('class','')">按项次查询</a></li>
<li id="groupTab"><a onclick="vm.clean();vm.type=2;$('#orderSelect').hide();$('#athleteSelect').hide();$('#groupSelect').show();$('#orderTab').attr('class','');$('#athleteTab').attr('class','');$('#groupTab').attr('class','active')">按组别项目查询</a></li>
<li id="athleteTab"><a onclick="vm.clean();vm.type=3;$('#orderSelect').hide();$('#groupSelect').hide();$('#athleteSelect').show();$('#orderTab').attr('class','');$('#groupTab').attr('class','');$('#athleteTab').attr('class','active')">按运动员姓名查询</a></li>
</ul>
<div class="row">
<!-- 按项次查询 选择框组 -->
<div id="orderSelect">
<div class="col-md-2">
<div class="row form-group">
<label for="scene" class="col-sm-1">场次:</label>
<div class="col-sm-8">
<select id="scene" class="form-control" v-model="scene" @change="getItem">
<option v-for="sceneInfo in sceneList" v-bind:value="sceneInfo['scene']">{{sceneInfo['scene']}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-8">
<div class="row form-group">
<label for="item" class="col-sm-1">项目:</label>
<div class="col-sm-10">
<select id="item" class="form-control" v-model="item" @change="getItemGroup">
<template v-if="gamesInfo.kind==='游泳'">
<option v-for="(itemInfo,index) in itemList" v-bind:value="itemInfo['id']+'-'+index">第{{itemInfo['order_index']}}项 {{itemInfo['sex']}}{{itemInfo['group_name']}}{{itemInfo['name']}}</option>
</template>
<template v-else>
<option v-for="(itemInfo,index) in itemList" v-bind:value="itemInfo['id']+'-'+index">[{{itemInfo['kind']}}]第{{itemInfo['order_index']}}项 {{itemInfo['sex']}}{{itemInfo['group_name']}}{{itemInfo['name']}}</option>
</template>
</select>
</div>
</div>
</div>
<!--div class="col-md-3">
<div class="row form-group">
<label for="group" class="col-sm-1">分组:</label>
<div class="col-sm-9">
<select id="group" class="form-control" v-model='group'>
<option value="0">全部</option>
<option v-for="num in selectItemInfo['total_group']" v-bind:value="num">第 {{num}} 组</option>
</select>
</div>
</div>
</div-->
</div>
<!-- ./按项次查询 选择框组 -->
<!-- 按组别查询 选择框组 -->
<div id="groupSelect" style="display:none">
<div class="col-md-3">
<div class="row form-group">
<label for="sex" class="col-sm-1">性别:</label>
<div class="col-sm-9">
<select id="sex" class="form-control" v-model="sex">
<option value="男子">男子</option>
<option value="女子">女子</option>
</select>
</div>
</div>
</div>
<div class="col-md-3">
<div class="row form-group">
<label for="groupName" class="col-sm-1">组别:</label>
<div class="col-sm-9">
<select id="groupName" class="form-control" v-model="groupName" @change="getItemGroup">
<option v-for="groupInfo in groupList" v-bind:value="groupInfo">{{groupInfo}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row form-group">
<label for="name" class="col-sm-1">项目:</label>
<div class="col-sm-10">
<select id="name" class="form-control" v-model='name'>
<option value="0">全部</option>
<option v-for="name in nameList" v-bind:value="name">{{name}}</option>
</select>
</div>
</div>
</div>
</div>
<!-- ./按组别查询 选择框组 -->
<!-- 按运动员项目查询 输入框 -->
<div id="athleteSelect" style="display:none">
<div class="col-md-10">
<div class="row form-group">
<label for="athleteName" class="col-sm-1">姓名:</label>
<div class="col-sm-11">
<input id="athleteName" class="form-control" v-model="athleteName">
</div>
</div>
</div>
</div>
<!-- ./按运动员项目查询 输入框 -->
<div class="col-md-1" style="margin-top: 15px;">
<button class="btn btn-info" @click="search"><i class="fa fa-search" aria-hidden="true"></i> 查 询</button>
</div>
</div>
<hr class="featurette-divider">
<!-- 分组表格显示 -->
<div id="orderResult" style="display:none">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr style="background-color: #cbeff5">
<th>组</th>
<th>道</th>
<th>姓名</th>
<th>备注</th>
</tr>
</thead>
<tbody style="font-size:17px;">
<template v-for="(runGroupData,runGroupNum) in orderData">
<tr v-for="(runwayData,index) in runGroupData">
<template v-if="index==0">
<th v-if="runGroupNum%2==0" style="vertical-align:middle;background-color:#B3E5FC;" v-bind:rowspan="runGroupData.length">{{runwayData['run_group']}}</th>
<th v-else style="vertical-align:middle;background-color:#CCFF90;" v-bind:rowspan="runGroupData.length">{{runwayData['run_group']}}</th>
</template>
<th style="vertical-align:middle;">{{runwayData['runway']}}</th>
<td style="vertical-align:middle;padding:5px 5px 0 5px;">{{runwayData['name']}}<p style="font-size:12px">[{{runwayData['short_name']}}]</p></td>
<td style="vertical-align:middle;">{{runwayData['remark']}}</td>
</tr>
</template>
</tbody>
</table>
</div>
<!-- ./分组表格显示 -->
<!-- 运动员分组表格显示 -->
<div id="athleteOrderResult" style="display:none">
<table v-if="type==3" class="table table-bordered table-hover table-striped">
<thead>
<tr style="background-color: #cbeff5">
<th>场/项</th>
<th>项目名</th>
<th>组/道</th>
<th>姓名</th>
<th>代表队</th>
</tr>
</thead>
<tbody style="font-size:14px;">
<tr v-for="info in orderData">
<th style="vertical-align:middle;">{{info['scene']}}/{{info['order_index']}}</th>
<td style="vertical-align:middle;padding:5px 5px 0 5px;">{{info['sex']}}{{info['group_name']}}{{info['item_name']}}</td>
<td style="vertical-align:middle;">{{info['run_group']}}/{{info['runway']}}</td>
<td style="vertical-align:middle;padding:5px 5px 0 5px;">{{athleteName}}</td>
<td style="vertical-align:middle;">{{info['short_name']}}</td>
</tr>
</tbody>
</table>
</div>
<!-- ./运动员分组表格显示 -->
<center><div style="width:96%;text-align: center;">
<div class="alert alert-info"><i class="fa fa-info-circle" aria-hidden="true"></i> 备注:DNS 弃权、DSQ 犯规、TRI测试</div>
</div></center>
</div>
</div>
</div>
</div>
<script>
var vm = new Vue({
el:'#app',
data:{
gamesInfo:{},
type:1,
scene:1,
sceneList:{},
item:1,
itemList:{},
group:0,
selectItemInfo:{},
orderData:{},
sex:'男子',
groupList:{},
groupName:'',
nameList:{},
name:'',
athleteName:''
},
methods:{
getScene:()=>{
vm.clean();
lockScreen();
$.ajax({
url:'/api/getItemInfo',
data:{'gamesId':vm.gamesInfo['id'],'type':'scene'},
dataType:'json',
error:function(e){
unlockScreen();
showModalTips('服务器错误!<br>获取场次失败!');
return false;
},
success:function(ret){
unlockScreen();
if(ret.code==200){
vm.sceneList=ret.data['sceneList'];
vm.scene=ret.data['sceneList'][0]['scene'];
vm.getItem();
}
}
})
},
getItem:()=>{
vm.clean();
lockScreen();
$.ajax({
url:'/api/getItemInfo',
data:{'gamesId':vm.gamesInfo['id'],'type':'item','scene':vm.scene},
dataType:'json',
error:function(e){
unlockScreen();
showModalTips('服务器错误!<br>获取场次项目失败!');
return false;
},
success:function(ret){
unlockScreen();
if(ret.code==200){
vm.itemList=ret.data['itemList'];
vm.item=ret.data['itemList'][0]['id']+'-0';
vm.selectItemInfo=vm.itemList[0];
vm.selectItemInfo['total_group']=parseInt(vm.selectItemInfo['total_group']);
}
}
})
},
getItemGroup:()=>{
vm.clean();
let item=vm.item.split('-');
vm.selectItemInfo=vm.itemList[item[1]];
vm.selectItemInfo['total_group']=parseInt(vm.selectItemInfo['total_group']);
},
getGroup:()=>{
vm.clean();
lockScreen();
$.ajax({
url:'/api/getItemInfo',
data:{'gamesId':vm.gamesInfo['id'],'type':'group'},
dataType:'json',
error:function(e){
unlockScreen();
showModalTips('服务器错误!<br>获取组别失败!');
return false;
},
success:function(ret){
unlockScreen();
if(ret.code==200){
vm.groupList=ret.data['group'];
vm.nameList=ret.data['name'];
vm.groupName=vm.groupList[0];
vm.name=vm.nameList[0];
}
}
})
},
search:()=>{
if(vm.type==3){
vm.athleteSearch();
return;
}
lockScreen();
let item=vm.item.split('-');
let itemId=item[0];
let postData=(vm.type==2)?{'orderBy':"group",'gamesId':vm.gamesInfo['id'],'sex':vm.sex,'groupName':vm.groupName,'name':vm.name}:{"orderBy":"item",'gamesId':vm.gamesInfo['id'],"itemId":itemId};
$.ajax({
url:'/api/getOrder',
data:postData,
dataType:'json',
error:e=>{
unlockScreen();
showModalTips("服务器错误!");
console.log(e);
},
success:ret=>{
if(ret.code==200){
let data=ret.data['orderData'];
let retData=[];
for(i in data){
let info=data[i];
if(retData[info['run_group']]===undefined) retData[info['run_group']]=[];
retData[info['run_group']].push(info);
}
vm.orderData=retData;
console.log(retData);
$("#orderResult").show(500);
unlockScreen();
return true;
}else if(ret.code==1){
showModalTips("无此项目!");
unlockScreen();
}else{
showModalTips("系统错误!");
unlockScreen();
}
}
})
},
athleteSearch:()=>{
lockScreen();
$.ajax({
url:'/api/getAthleteData',
data:{'type':'order','gamesId':vm.gamesInfo['id'],'name':vm.athleteName},
dataType:'json',
error:e=>{
unlockScreen();
showModalTips("服务器错误!");
console.log(e);
},
success:ret=>{
if(ret.code==200){
let data=ret.data['list'];
console.log(data);
vm.orderData=data;
$("#athleteOrderResult").show(500);
unlockScreen();
}else if(ret.code==404){
showModalTips('无此运动员数据!');
unlockScreen();
return false;
}
}
});
},
clean:()=>{
$("#orderResult").hide(400);
$("#athleteOrderResult").hide(400);
vm.orderData={};
}
},
mounted:function(){
this.gamesInfo=this.$refs.header.gamesInfo;
}
});
vm.getScene();
vm.getGroup();
</script>
<?php include 'include/footer.php'; ?>
</body>
</html>