1663 lines
63 KiB
HTML
1663 lines
63 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-cn">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<link href="https://www.fpvone.cn/assets/css/layui.css" rel="stylesheet">
|
||
<script src="https://www.fpvone.cn/assets/js/jquery.min.js"></script>
|
||
<!-- <script src="https://www.fpvone.cn/assets/js/jquery.printarea.js"></script> -->
|
||
<style>
|
||
.layui-tab .layui-tab-title li {
|
||
background-color: #D8E0E6;
|
||
color: #787979;
|
||
margin: 0 4px;
|
||
}
|
||
.layui-tab .layui-tab-title .layui-this {
|
||
background-color: #fff;
|
||
}
|
||
.tabelPage {
|
||
padding: 30px 30px 0 30px;
|
||
background-color: #fff;
|
||
}
|
||
.btnList {
|
||
margin-bottom: 20px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
.topBtn {
|
||
position: absolute;
|
||
right: 0;
|
||
top: 0;
|
||
}
|
||
.qsn_content {
|
||
padding: 10px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
.pages {
|
||
display: flex;
|
||
justify-content: center;
|
||
margin-top: 20px;
|
||
}
|
||
@font-face {
|
||
font-family: layui-icon;
|
||
src: url(/assets/fonts/iconfont.eot?v=282);
|
||
src: url(/assets/fonts/iconfont.eot?v=282#iefix) format("embedded-opentype"),
|
||
url(/assets/fonts/iconfont.woff2?v=282) format("woff2"),
|
||
url(/assets/fonts/iconfont.woff?v=282) format("woff"),
|
||
url(/assets/fonts/iconfont.ttf?v=282) format("truetype"),
|
||
url(/assets/fonts/iconfont.svg?v=282#layui-icon) format("svg");
|
||
}
|
||
.layui-layer-loading-icon::before {
|
||
display: none;
|
||
}
|
||
.flush_btn {
|
||
position: fixed;
|
||
width: 40px;
|
||
height: 40px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 50%;
|
||
cursor: pointer;
|
||
background-color: #12a5f4;
|
||
color: #fff;
|
||
right: 5px;
|
||
top: 30%;
|
||
z-index: 10000;
|
||
transition: all 0.3s;
|
||
}
|
||
.flush_btn:hover {
|
||
scale: 1.1;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="tabelPage">
|
||
<div class="flush_btn">刷新</div>
|
||
<div class="layui-tab" lay-filter="filter" style="position: relative;">
|
||
<ul class="layui-tab-title">
|
||
<li class="layui-this">资格赛</li>
|
||
<li style="display: none;">排位赛</li>
|
||
<li>淘汰赛</li>
|
||
<li>决赛</li>
|
||
</ul>
|
||
<div class="topBtn">
|
||
<button class="layui-btn layui-btn-primary layui-border-green exportRanking">总排名导出</button>
|
||
</div>
|
||
<div class="layui-tab-content">
|
||
<!-- 资格赛 -->
|
||
<div class="layui-tab-item layui-show layui-tab-item1">
|
||
<div class="btnList">
|
||
<div class="left layui-clear-space">
|
||
<a class="layui-btn layui-btn-primary" href="https://www.fpvone.cn/assets/file/中国无人机竞速联赛分组表格模板.xlsx" download>模版下载</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-green" lay-options="{accept: 'file', exts: 'xlsx|xls'}" id="upload1">分组导入</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-blue" lay-options="{accept: 'file', exts: 'xlsx|xls'}" id="upload-signal" style="margin-left: 10px;">单轮导入</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-red clearData" style="margin-left: 10px;">清空数据</a>
|
||
</div>
|
||
<div class="right layui-clear-space" style="display: flex;">
|
||
<div class="layui-form" style="display: flex; ">
|
||
<div class="layui-form-item sort" style="display: none;">
|
||
<label class="layui-form-label" style="width: 90px;">是否排序</label>
|
||
<div class="layui-input-block" style="margin-left: 90px;">
|
||
<input type="checkbox" name="open" lay-skin="switch" lay-filter="switch1" title="ON|OFF">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" style="width: 190px; margin-right: 10px;">
|
||
<label class="layui-form-label" style="width: 90px;">选择轮次</label>
|
||
<div class="layui-input-block" style="width: 100px; margin-left: 90px;">
|
||
<select id="round1" lay-filter="select_filter_round_1" name="round"></select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table id="table1" lay-filter="table1"></table>
|
||
<div id="page1" class="pages"></div>
|
||
</div>
|
||
<!-- 排位赛 -->
|
||
<div class="layui-tab-item layui-tab-item2" style="display: none;">
|
||
<div class="btnList">
|
||
<div class="left layui-clear-space">
|
||
<a class="layui-btn layui-btn-primary">模版下载</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-green" lay-options="{accept: 'file', exts: 'xlsx|xls'}" id="upload2">分组导入</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-red clearData" style="margin-left: 10px;">清空数据</a>
|
||
</div>
|
||
<div class="right layui-clear-space" style="display: flex;">
|
||
<div class="layui-form" style="display: flex;">
|
||
<div class="layui-form-item" style="width: 190px; margin-right: 10px;">
|
||
<label class="layui-form-label" style="width: 90px;">选择轮次</label>
|
||
<div class="layui-input-block" style="width: 100px; margin-left: 90px;">
|
||
<select id="round2" lay-filter="select_filter_round_2" name="round"></select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table id="table2" lay-filter="table2"></table>
|
||
<div id="page2" class="pages"></div>
|
||
</div>
|
||
<!-- 淘汰赛 -->
|
||
<div class="layui-tab-item layui-tab-item3">
|
||
<div class="btnList">
|
||
<div class="left layui-clear-space">
|
||
<a class="layui-btn layui-btn-primary">模版下载</a>
|
||
<!-- <a class="layui-btn layui-btn-primary layui-border-green" lay-options="{accept: 'file', exts: 'xlsx|xls'}" id="upload3">分组导入</a> -->
|
||
<a class="layui-btn layui-btn-primary layui-border-blue" id="createGroup" style="margin-left: 10px;">生成分组</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-red clearData">清空数据</a>
|
||
</div>
|
||
<div class="right layui-clear-space" style="display: flex;">
|
||
<div class="layui-form" style="display: flex;">
|
||
<div class="layui-form-item" style="width: 190px; margin-right: 10px;">
|
||
<label class="layui-form-label" style="width: 90px;">选择轮次</label>
|
||
<div class="layui-input-block" style="width: 100px; margin-left: 90px;">
|
||
<select id="round3" lay-filter="select_filter_round_3" name="round">
|
||
<option value="1">1</option>
|
||
<option value="2">2</option>
|
||
<option value="3">3</option>
|
||
<option value="4">4</option>
|
||
<option value="5">5</option>
|
||
<option value="6">6</option>
|
||
<option value="7">7</option>
|
||
<option value="8">8</option>
|
||
<option value="9">9</option>
|
||
<option value="10">10</option>
|
||
<option value="11">11</option>
|
||
<option value="12">12</option>
|
||
<option value="13">13</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a class="layui-btn layui-btn-primary layui-border-blue" id="groupExport">分组导出</a>
|
||
</div>
|
||
</div>
|
||
<table id="table3" lay-filter="table3"></table>
|
||
</div>
|
||
<!-- 决赛 -->
|
||
<div class="layui-tab-item layui-tab-item4">
|
||
<div class="btnList">
|
||
<div class="left layui-clear-space">
|
||
<a class="layui-btn layui-btn-primary">模版下载</a>
|
||
<!-- <a class="layui-btn layui-btn-primary layui-border-green" lay-options="{accept: 'file', exts: 'xlsx|xls'}" id="upload">分组导入</a> -->
|
||
<a class="layui-btn layui-btn-primary layui-border-blue" id="createGroup2">生成分组</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-red clearData">清空数据</a>
|
||
</div>
|
||
<div class="right layui-clear-space" style="display: flex;">
|
||
<div class="layui-form" style="display: flex; margin-right: 10px;">
|
||
<!-- <div class="layui-form-item extra">
|
||
<label class="layui-form-label" style="width: 90px;">是否加赛</label>
|
||
<div class="layui-input-block" style="margin-left: 90px;">
|
||
<input type="checkbox" name="open" lay-skin="switch" lay-filter="switch2" title="是|否">
|
||
</div>
|
||
</div> -->
|
||
<div class="layui-form-item final-selected" style="width: 190px; margin-right: 10px;">
|
||
<label class="layui-form-label" style="width: 90px;">选择轮次</label>
|
||
<div class="layui-input-block" style="width: 100px; margin-left: 90px;">
|
||
<select id="round4" lay-filter="select_filter_round_4" name="round">
|
||
<option value="1">公开组</option>
|
||
<option value="2">青少年组</option>
|
||
<option value="3">女子组</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a class="layui-btn layui-btn-primary layui-border-orange" id="extra-popup">加赛</a>
|
||
<a class="layui-btn layui-btn-primary layui-border-blue" id="groupExport2">分组导出</a>
|
||
</div>
|
||
</div>
|
||
<table id="table4" lay-filter="table4"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="print-content" style="display: none;">
|
||
<style>
|
||
.print-content {
|
||
}
|
||
.print-content * {
|
||
box-sizing: border-box;
|
||
}
|
||
.print-content p {
|
||
margin: 0;
|
||
}
|
||
.print-content .divHeader {
|
||
width: 100%;
|
||
position: fixed;
|
||
top: 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 0mm 0mm 0 0mm;
|
||
}
|
||
.print-content .divFooter {
|
||
width: 100%;
|
||
position: fixed;
|
||
bottom: 1mm;
|
||
text-align: center;
|
||
font-size: 11px;
|
||
}
|
||
.print-content table {
|
||
border-collapse: collapse;
|
||
width: 100%;
|
||
margin-top: 30mm;
|
||
}
|
||
.print-content table, .print-content th, .print-content td {
|
||
border: 1px solid black;
|
||
height: 40px;
|
||
}
|
||
.print-content th, .print-content td {
|
||
font-size: 12px;
|
||
text-align: center;
|
||
}
|
||
.print-content .title {
|
||
height: 60px;
|
||
font-size: 16px;
|
||
}
|
||
.print-content .channel {
|
||
width: 10mm;
|
||
}
|
||
.print-content .led {
|
||
width: 15mm;
|
||
}
|
||
.print-content .hw {
|
||
width: 10mm;
|
||
}
|
||
.print-content .group {
|
||
width: 10mm;
|
||
}
|
||
.print-content .id {
|
||
width: 16mm;
|
||
}
|
||
.print-content .name, .print-content .dw {
|
||
width: 25mm;
|
||
}
|
||
@media print {
|
||
.print-content {
|
||
page-break-after: always;
|
||
overflow: hidden;
|
||
}
|
||
.print-content:last-child {
|
||
page-break-after: auto;
|
||
}
|
||
.print-content * {
|
||
box-sizing: border-box;
|
||
}
|
||
.print-content .divHeader{
|
||
width: 100%;
|
||
position: fixed;
|
||
top: 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 0mm 0mm 0 0mm;
|
||
}
|
||
.print-content .divFooter {
|
||
width: 100%;
|
||
position: fixed;
|
||
bottom: 1mm;
|
||
text-align: center;
|
||
font-size: 11px;
|
||
}
|
||
@page {
|
||
size: A4;
|
||
/* margin: 2cm; */
|
||
}
|
||
.print-content table {
|
||
border-collapse: collapse;
|
||
width: 100%;
|
||
margin-top: 30mm;
|
||
}
|
||
.print-content table, .print-content th, .print-content td {
|
||
border: 1px solid black;
|
||
}
|
||
.print-content th, .print-content td {
|
||
font-size: 12px;
|
||
text-align: center;
|
||
}
|
||
.print-content .title {
|
||
height: 60px;
|
||
font-size: 16px;
|
||
}
|
||
.print-content .channel {
|
||
width: 10mm;
|
||
}
|
||
.print-content .led {
|
||
width: 15mm;
|
||
}
|
||
.print-content .hw {
|
||
width: 10mm;
|
||
}
|
||
.print-content .group {
|
||
width: 10mm;
|
||
}
|
||
.print-content .id {
|
||
width: 16mm;
|
||
}
|
||
.print-content .name, .print-content .dw {
|
||
width: 25mm;
|
||
}
|
||
}
|
||
</style>
|
||
<div class="divHeader">
|
||
<img src="http://www.fpvone.cn/assets/imgs/printIcon1.png" alt="">
|
||
<img src="http://www.fpvone.cn/assets/imgs/printIcon2.png" alt="">
|
||
</div>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th class="title" colspan="11"></th>
|
||
</tr>
|
||
<tr>
|
||
<th class="group" rowspan="2">组别</th>
|
||
<th class="id" rowspan="2">编号</th>
|
||
<th class="name" rowspan="2">姓名</th>
|
||
<th class="dw" rowspan="2">所属队伍</th>
|
||
<th class="hw" rowspan="2">号位</th>
|
||
<th colspan="3">成绩</th>
|
||
<th rowspan="2">运动员签字</th>
|
||
<th class="channel" rowspan="2">频道</th>
|
||
<th class="led" rowspan="2">LED颜色</th>
|
||
</tr>
|
||
<tr>
|
||
<th>第一圈</th>
|
||
<th>第二圈</th>
|
||
<th>第三圈</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody></tbody>
|
||
</table>
|
||
<div class="divFooter">
|
||
<p>比翼飞行提供赛事计时服务</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="print-content2" style="display: none;">
|
||
<style>
|
||
.print-content2 * {
|
||
box-sizing: border-box;
|
||
}
|
||
.print-content2 p {
|
||
margin: 0;
|
||
}
|
||
.print-content2 .divHeader {
|
||
width: 100%;
|
||
position: fixed;
|
||
top: 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 0mm 0mm 0 0mm;
|
||
}
|
||
.print-content2 .divFooter {
|
||
width: 100%;
|
||
position: fixed;
|
||
bottom: 0;
|
||
text-align: center;
|
||
font-size: 11px;
|
||
}
|
||
.print-content2 table {
|
||
border-collapse: collapse;
|
||
width: 100%;
|
||
margin-top: 30mm;
|
||
}
|
||
.print-content2 table, .print-content2 th, .print-content2 td {
|
||
border: 1px solid black;
|
||
height: 40px;
|
||
}
|
||
.print-content2 th, .print-content2 td {
|
||
font-size: 12px;
|
||
text-align: center;
|
||
}
|
||
.print-content2 .title {
|
||
height: 60px;
|
||
font-size: 16px;
|
||
}
|
||
.print-content2 .channel {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .led {
|
||
width: 15mm;
|
||
}
|
||
.print-content2 .hw {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .group {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .id {
|
||
width: 16mm;
|
||
}
|
||
.print-content2 .name, .print-content2 .dw {
|
||
width: 25mm;
|
||
}
|
||
@media print {
|
||
.print-content2 {
|
||
page-break-after: always;
|
||
overflow: hidden;
|
||
}
|
||
.print-content2:last-child {
|
||
page-break-after: auto;
|
||
}
|
||
.print-content2 * {
|
||
box-sizing: border-box;
|
||
}
|
||
.print-content2 .divHeader{
|
||
width: 100%;
|
||
position: fixed;
|
||
top: 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 0mm 0mm 0 0mm;
|
||
}
|
||
.print-content2 .divFooter {
|
||
width: 100%;
|
||
position: fixed;
|
||
bottom: 0;
|
||
text-align: center;
|
||
font-size: 11px;
|
||
}
|
||
@page {
|
||
size: A4;
|
||
/* margin: 2cm; */
|
||
}
|
||
.print-content2 table {
|
||
border-collapse: collapse;
|
||
width: 100%;
|
||
margin-top: 30mm;
|
||
}
|
||
.print-content2 table, .print-content2 th, .print-content2 td {
|
||
border: 1px solid black;
|
||
}
|
||
.print-content2 th, .print-content2 td {
|
||
font-size: 12px;
|
||
text-align: center;
|
||
}
|
||
.print-content2 .title {
|
||
height: 60px;
|
||
font-size: 16px;
|
||
}
|
||
.print-content2 .channel {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .led {
|
||
width: 15mm;
|
||
}
|
||
.print-content2 .hw {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .group {
|
||
width: 10mm;
|
||
}
|
||
.print-content2 .id {
|
||
width: 16mm;
|
||
}
|
||
.print-content2 .name, .print-content2 .dw {
|
||
width: 25mm;
|
||
}
|
||
}
|
||
</style>
|
||
<div class="divHeader">
|
||
<img src="http://www.fpvone.cn/assets/imgs/printIcon1.png" alt="">
|
||
<img src="http://www.fpvone.cn/assets/imgs/printIcon2.png" alt="">
|
||
</div>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th class="title" colspan="11"></th>
|
||
</tr>
|
||
<tr>
|
||
<th class="group" rowspan="2">组别</th>
|
||
<th class="id" rowspan="2">编号</th>
|
||
<th class="name" rowspan="2">姓名</th>
|
||
<th class="dw" rowspan="2">所属队伍</th>
|
||
<th class="hw" rowspan="2">号位</th>
|
||
<th colspan="2">成绩</th>
|
||
<th rowspan="2">运动员签字</th>
|
||
<th class="channel" rowspan="2">频道</th>
|
||
<th class="led" rowspan="2">LED颜色</th>
|
||
</tr>
|
||
<tr>
|
||
<th>圈数</th>
|
||
<th>总计时</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody></tbody>
|
||
</table>
|
||
<div class="divFooter">
|
||
<p>比翼飞行提供赛事计时服务</p>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- -->
|
||
<script src="https://www.fpvone.cn/assets/js/layui.js"></script>
|
||
<script type="text/html" id="operate">
|
||
<div class="layui-clear-space">
|
||
<a class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" lay-event="update">修改</a>
|
||
<!-- <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" lay-event="print">打印</a> -->
|
||
</div>
|
||
</script>
|
||
|
||
<script>
|
||
// course 101资格赛 102排位赛 103淘汰赛 104决赛
|
||
const url = window.location.href
|
||
const params = {}
|
||
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, (m, key, value) => {
|
||
params[key] = value
|
||
})
|
||
const match_id = params.id
|
||
let currentPage = 1, limitPage = 50
|
||
let printAreaCount = 0
|
||
|
||
// 排名导出
|
||
$('.layui-tab-content .layui-tab-item1 .btnList .right').append(`<a class="layui-btn layui-btn-primary layui-border-blue downloadX downloadX1" href="https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=101&sorting=false&other_round=1" download>排名导出</a>`)
|
||
$('.layui-tab-content .layui-tab-item2 .btnList .right').append(`<a class="layui-btn layui-btn-primary layui-border-blue downloadX" href="https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=102&sorting=false" download>排名导出</a>`)
|
||
$('.layui-tab-content .layui-tab-item3 .btnList .right').append(`<a class="layui-btn layui-btn-primary layui-border-blue downloadX downloadX3" href="https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=103&sorting=false&other_round=1" download>排名导出</a>`)
|
||
$('.layui-tab-content .layui-tab-item4 .btnList .right').append(`<a class="layui-btn layui-btn-primary layui-border-blue downloadX" href="https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=104&sorting=false" download>排名导出</a>`)
|
||
|
||
|
||
let update_windows = null, clear_window = null, select_round = 1, tabIndex = 1, tableStatus = [true, false, false, false]
|
||
let all_round_first1 = true, all_round_first2 = true, all_round_first3 = true, all_round_first4 = true
|
||
|
||
// 列表头
|
||
const cols1 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "first_fly_time", title: "第1圈" },
|
||
{ field: "second_fly_time", title: "第2圈" },
|
||
{ field: "third_fly_time", title: "第3圈" },
|
||
{ field: "operate", title: "操作", toolbar: "#operate", width: 140 },
|
||
]
|
||
const cols2 = [
|
||
{ field: "no", title: "排名" },
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "完成圈数" },
|
||
{ field: "avg", title: "最优3圈平均时间" },
|
||
]
|
||
const cols3 = [
|
||
{ field: "no", title: "排名" },
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "完成圈数" },
|
||
{ field: "sum", title: "总时间" },
|
||
]
|
||
const cols4 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "圈数" },
|
||
{ field: "times", title: "时间" },
|
||
{ field: "operate", title: "操作", toolbar: "#operate", width: 140 },
|
||
]
|
||
const cols5 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "圈数" },
|
||
{ field: "times", title: "时间" },
|
||
// { field: "group_sort", title: "组内排名" },
|
||
{ field: "operate", title: "操作", toolbar: "#operate", width: 140 },
|
||
]
|
||
const cols6 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "圈数" },
|
||
{ field: "times", title: "时间" },
|
||
{ field: "custom_sorting", title: "自定义排名" },
|
||
{ field: "operate", title: "操作", toolbar: "#operate", width: 140 },
|
||
]
|
||
|
||
const cols7 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "fly_num", title: "圈数" },
|
||
{ field: "times", title: "时间" },
|
||
// { field: "integral", title: "积分" },
|
||
{ field: "operate", title: "操作", toolbar: "#operate", width: 140 },
|
||
]
|
||
|
||
const cols8 = [
|
||
{ field: "grouping", title: "组别" },
|
||
{ field: "player_id", title: "编号" },
|
||
{ field: "player_name", title: "姓名" },
|
||
{ field: "channel", title: "频道" },
|
||
{ field: "led_color", title: "LED颜色" },
|
||
{ field: "sum_integral", title: "积分" },
|
||
]
|
||
|
||
layui.use(() => {
|
||
const upload = layui.upload, layer = layui.layer, table = layui.table, form = layui.form, util = layui.util, element = layui.element, laypage = layui.laypage, laydate = layui.laydate
|
||
|
||
// 分组导出
|
||
$('#groupExport').attr('href', `https://www.fpvone.cn/inback.php/cms/Leaguexport/export_wash?match_id=${match_id}&course=103&other_round=${select_round}`)
|
||
$('#groupExport2').attr('href', `https://www.fpvone.cn/inback.php/cms/Leaguexport/export_wash?match_id=${match_id}&course=104&other_round=${select_round}`)
|
||
|
||
// 生成分组
|
||
const createGroup = () => {
|
||
$('#createGroup').click(async() => {
|
||
const res = await $.get('https://www.fpvone.cn/inback.php/cms/Leaguexport/click_group', {
|
||
match_id: match_id,
|
||
course: 103,
|
||
other_round: select_round,
|
||
})
|
||
resetData(3)
|
||
})
|
||
$('#createGroup2').click(async() => {
|
||
if(select_round == 1) {
|
||
// 公开组
|
||
await $.get('https://www.fpvone.cn/inback.php/cms/Leagueround/final_group', {
|
||
match_id: match_id,
|
||
})
|
||
resetData(4)
|
||
} else if(select_round == 2) {
|
||
// 青少年组
|
||
let selectedAge = layer.open({
|
||
type: 1,
|
||
shade: false,
|
||
title: "选择年龄",
|
||
area: ["400px", "200px"],
|
||
zIndex: 100,
|
||
content: `
|
||
<div class="qsn_content">
|
||
<div class="layui-inline">
|
||
<label class="layui-form-label" style="width: 120px;">出生日期选择</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" class="layui-input" id="qsn_date" placeholder="yyyy-MM-dd" autocomplete="off">
|
||
</div>
|
||
</div>
|
||
<div style="text-align: center; margin-top: 20px">
|
||
<a class="layui-btn layui-bg-blue" id="export_byAges">生成分组</a>
|
||
</div>
|
||
</div>
|
||
`,
|
||
success: function() {
|
||
let date = '1970-01-01'
|
||
laydate.render({
|
||
elem: '#qsn_date',
|
||
done: function(value, date, endDate) {
|
||
date = value
|
||
}
|
||
})
|
||
$('#export_byAges').click(() => {
|
||
$.get(`https://www.fpvone.cn/inback.php/cms/leaguemaster/final_young_group?match_id=${match_id}&birthday=${date}`).then(res => {
|
||
if(res.code != 200) {
|
||
layer.msg(res.msg)
|
||
} else {
|
||
layer.close(selectedAge)
|
||
resetData(4)
|
||
}
|
||
})
|
||
})
|
||
},
|
||
end: function() {
|
||
}
|
||
})
|
||
} else {
|
||
// 女子组
|
||
await $.get('https://www.fpvone.cn/inback.php/cms/Leaguemaster/final_young_group', {
|
||
match_id: match_id,
|
||
women: 1,
|
||
})
|
||
resetData(4)
|
||
}
|
||
})
|
||
}
|
||
createGroup()
|
||
|
||
// 根据索引获取赛程编号
|
||
const getCourseByIndex = (index) => {
|
||
let coures = 101
|
||
switch(index) {
|
||
case 1: coures = 101; break;
|
||
case 2: coures = 102; break;
|
||
case 3: coures = 103; break;
|
||
case 4: coures = 104; break;
|
||
default: coures = 101;
|
||
}
|
||
return coures
|
||
}
|
||
|
||
// 选择赛程
|
||
let timer3 = null
|
||
const tabFilter = () => {
|
||
element.on('tab(filter)', (data) => {
|
||
tabIndex = data.index - 0 + 1
|
||
course = getCourseByIndex(tabIndex)
|
||
if(document.getElementById('round' + tabIndex)) {
|
||
document.getElementById('round' + tabIndex).value = 1
|
||
select_round = 1
|
||
}
|
||
form.render()
|
||
if(tabIndex == 4) {
|
||
select_round = 1
|
||
}
|
||
if(tableStatus[tabIndex - 1]) {
|
||
resetData(tabIndex)
|
||
} else {
|
||
setTable(tabIndex)
|
||
tableStatus[tabIndex - 1] = true
|
||
}
|
||
// 如果是淘汰赛就定时更新数据
|
||
// if(course == 103) {
|
||
// clearInterval(timer3)
|
||
// timer3 = setInterval(() => {
|
||
// resetData(3, false)
|
||
// }, 5000)
|
||
// } else {
|
||
// clearInterval(timer3)
|
||
// }
|
||
if(course == 104) {
|
||
$('.extra input').attr('checked', is_extra)
|
||
form.render()
|
||
|
||
if(match_id == 606) {
|
||
$('.final-selected').hide()
|
||
}
|
||
}
|
||
})
|
||
}
|
||
tabFilter()
|
||
|
||
/**
|
||
* 上传分组表单
|
||
* @param {Number} index 索引
|
||
* @returns {Null}
|
||
*/
|
||
const uploadfile = (index) => {
|
||
upload.render({
|
||
elem: `#upload${index}`,
|
||
url: 'https://www.fpvone.cn/inback.php/cms/ranking/addPlayerList',
|
||
accept: 'file',
|
||
data: index == 3 ? {course: getCourseByIndex(index), match_id: match_id, other_round: select_round} : {course: getCourseByIndex(index), match_id: match_id},
|
||
done: async(res) => {
|
||
// layer.msg('上传成功')
|
||
if(res.code == 1) {
|
||
layer.msg('上传成功')
|
||
if(index == 1) {
|
||
all_round_first1 = true
|
||
}
|
||
await resetData(index)
|
||
} else {
|
||
if(res.data) {
|
||
layer.msg(`上传失败, 失败原因表格第${res.data}行`)
|
||
} else {
|
||
layer.msg('上传失败')
|
||
}
|
||
}
|
||
}
|
||
})
|
||
}
|
||
uploadfile(1)
|
||
uploadfile(2)
|
||
uploadfile(3)
|
||
const uploadSignal = () => {
|
||
upload.render({
|
||
elem: `#upload-signal`,
|
||
url: 'https://www.fpvone.cn/inback.php/cms/ranking/singleRoundMasterExport',
|
||
accept: 'file',
|
||
data: { course: 101, match_id: match_id, other_round: select_round },
|
||
done: async(res) => {
|
||
console.log(res)
|
||
}
|
||
})
|
||
|
||
}
|
||
uploadSignal()
|
||
|
||
// 排序
|
||
let sort1 = false, sort2 = false, sort3 = false, sort4 = false
|
||
let is_extra = false
|
||
// form.on('switch(switch1)', function(data) {
|
||
// sort1 = this.checked
|
||
// })
|
||
form.on('switch(switch2)', function(data) {
|
||
open_extra(this.checked)
|
||
})
|
||
const open_extra = async(open) => {
|
||
let is_open = 1
|
||
if(open) {
|
||
is_open = 1
|
||
} else {
|
||
is_open = 0
|
||
}
|
||
const res = await $.get(`https://www.fpvone.cn/inback.php/cms/leaguesort/is_extra?match_id=${match_id}&course=104&is_open=${is_open}`)
|
||
if(res.code == 0) {
|
||
if(is_open == 1) {
|
||
is_extra = false
|
||
$('#extra-popup').hide()
|
||
} else {
|
||
is_extra = true
|
||
$('#extra-popup').show()
|
||
}
|
||
$('.extra input').prop('checked', is_extra)
|
||
form.render()
|
||
layer.msg('失败')
|
||
} else {
|
||
// 开启加赛
|
||
resetData(4)
|
||
}
|
||
}
|
||
|
||
const setCols = (index) => {
|
||
let cols = []
|
||
if(index == 1) {
|
||
if(select_round == 'best') cols = cols2
|
||
else cols = cols1
|
||
} else if(index == 2) {
|
||
if(select_round == 'bestsen') cols = cols3
|
||
else cols = cols1
|
||
} else if(index == 3) {
|
||
cols = cols5
|
||
} else if(index == 4) {
|
||
if(match_id == 606) {
|
||
if(is_extra) {
|
||
cols = cols6
|
||
} else {
|
||
cols = cols4
|
||
}
|
||
} else {
|
||
if(select_round == '总积分') {
|
||
cols = cols8
|
||
} else {
|
||
cols = cols7
|
||
}
|
||
}
|
||
|
||
}
|
||
return cols
|
||
}
|
||
|
||
|
||
/**
|
||
* 重载数据
|
||
* @param {Number} index 列表索引
|
||
* @param {Boolean} flag 判断表格是否仅加载数据
|
||
* @returns {Null}
|
||
*/
|
||
const resetData = async(index, flag=true) => {
|
||
const data = await getData(index)
|
||
|
||
let cols = cols1
|
||
|
||
// 设置表头
|
||
// if(index == 1) {
|
||
// if(select_round == 'best') cols = cols2
|
||
// else cols = cols1
|
||
// } else if(index == 2) {
|
||
// if(select_round == 'bestsen') cols = cols3
|
||
// else cols = cols1
|
||
// } else if(index == 3) {
|
||
// cols = cols5
|
||
// } else if(index == 4) {
|
||
// if(is_extra) {
|
||
// cols = cols6
|
||
// } else {
|
||
// cols = cols4
|
||
// }
|
||
// }
|
||
cols = setCols(index)
|
||
|
||
// 重载数据
|
||
if(flag) {
|
||
if(index == 1 || index == 2) {
|
||
setPage(index, data, cols)
|
||
} else {
|
||
table.reload(index, { data: data, cols: [cols] })
|
||
}
|
||
} else {
|
||
if(index == 1 || index == 2) {
|
||
table.reloadData(index, { data: data.slice((currentPage-1)*limitPage, currentPage*limitPage), cols: [cols] })
|
||
} else {
|
||
table.reloadData(index, { data: data, cols: [cols] })
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 设置下拉框轮次
|
||
* @param {Number} index 列表索引
|
||
* @param {Number} all_round 轮次数量
|
||
* @returns {Null}
|
||
*/
|
||
const createSelected = (index, all_round) => {
|
||
let h = ''
|
||
for(let i=0; i<all_round; i++) {
|
||
h += `<option value="${i+1}" ${i==0?'selected':''}>${i+1}</option>`
|
||
}
|
||
h += `<option value="best">最优成绩</option>`
|
||
$(`#round${index}`).html(h)
|
||
form.render()
|
||
}
|
||
|
||
/**
|
||
* 获取列表数据
|
||
* @param {Number} index 列表索引
|
||
* @returns {Array[Object]} 列表数组
|
||
*/
|
||
let cur_arr = []
|
||
let pilot_list = []
|
||
const getData = async(index) => {
|
||
let d = []
|
||
// 处理最优成绩的数据
|
||
const setBest = (data) => {
|
||
let arr = []
|
||
data.map((item, index) => {
|
||
arr.push({
|
||
avg: item.avg,
|
||
fly_num: item.fly_num,
|
||
no: index + 1,
|
||
...item.info,
|
||
})
|
||
})
|
||
return arr
|
||
}
|
||
// 获取数据
|
||
let loading = layer.load(1, {shade: false})
|
||
try {
|
||
const res = await $.post('https://www.fpvone.cn/inback.php/cms/league/getrank_course', { match_id: match_id, course: getCourseByIndex(tabIndex), sorting: sort1, other_round: select_round })
|
||
layer.close(loading)
|
||
if(res.is_extra == 0) {
|
||
is_extra = false
|
||
} else {
|
||
is_extra = true
|
||
}
|
||
if(res.is_extra == undefined) {
|
||
is_extra = false
|
||
}
|
||
if(index == 4) {
|
||
$('.extra input').attr('checked', is_extra)
|
||
form.render()
|
||
if(is_extra) {
|
||
$('#extra-popup').show()
|
||
} else {
|
||
$('#extra-popup').hide()
|
||
}
|
||
}
|
||
if(select_round == 'best') {
|
||
d = setBest(res.data)
|
||
} else if(select_round == 'bestsen') {
|
||
let arr = []
|
||
res.data.map((item, index) => {
|
||
arr.push({
|
||
sum: item.sum,
|
||
fly_num: item.fly_num,
|
||
no: index + 1,
|
||
...item.info,
|
||
})
|
||
})
|
||
d = arr
|
||
} else {
|
||
d = res.data
|
||
cur_arr = res.data
|
||
}
|
||
|
||
// 判断生成选择轮次的下拉选择
|
||
if(index == 1 && all_round_first1) {
|
||
createSelected(index, res.round)
|
||
all_round_first1 = false
|
||
} else if(index == 2 && all_round_first2) {
|
||
createSelected(index, 2)
|
||
all_round_first2 = false
|
||
}
|
||
|
||
// 判断展示分组导入的按钮
|
||
// if(d.length > 0) $(`#upload${index}`).hide()
|
||
// else $(`#upload${index}`).show()
|
||
pilot_list = d
|
||
return d
|
||
} catch(err) {
|
||
layer.msg('服务器错误')
|
||
layer.close(loading)
|
||
return []
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 提交设置的数据
|
||
* @param {Number} index 列表索引
|
||
* @param {Object} 修改对象
|
||
* @returns {Null}
|
||
*/
|
||
const setRanking = async(index, data) => {
|
||
console.log(index, data)
|
||
let url = '', res = null
|
||
if(data.course == 103) {
|
||
url = 'https://jlbdata.fpvone.cn/api/matchRanking/update'
|
||
res = await $.ajax({
|
||
url: url,
|
||
contentType: 'application/json',
|
||
type: 'POST',
|
||
data: JSON.stringify(data),
|
||
})
|
||
} else {
|
||
url = 'https://www.fpvone.cn/inback.php/cms/league/setPlayerRanking'
|
||
res = await $.post({
|
||
url: url,
|
||
data: data,
|
||
})
|
||
}
|
||
|
||
if (!(res.code == 1 || res.code == 200)) {
|
||
return layer.msg(res.msg)
|
||
}
|
||
layer.close(update_windows)
|
||
update_windows = null
|
||
resetData(index, false)
|
||
return layer.msg(res.msg)
|
||
}
|
||
|
||
/**
|
||
* 设置表格的数据
|
||
* @param {Number} index 列表索引
|
||
* @returns {Null}
|
||
*/
|
||
const setTable = async(index) => {
|
||
// 获取数据
|
||
let data = await getData(index)
|
||
cols = setCols(index)
|
||
table.render({
|
||
elem: '#table' + index,
|
||
cols: [cols],
|
||
data: data,
|
||
id: index,
|
||
lineStyle: 'height: 50px;',
|
||
done: function(res, curr, count, origin) {
|
||
$('.layui-table').css('width', '100%')
|
||
$("th[data-field='delete']").css('border-right', 'none')
|
||
}
|
||
})
|
||
if(index == 1 || index == 2) {
|
||
setPage(index, data, index == 4 ? cols4 : index == 3 ? cols4 : cols1)
|
||
}
|
||
}
|
||
const setPage = (index, data, cols) => {
|
||
laypage.render({
|
||
elem: 'page' + index,
|
||
count: data.length,
|
||
limit: limitPage,
|
||
jump: function(obj) {
|
||
currentPage = obj.curr
|
||
table.reload(index, { data: data.slice((obj.curr-1)*obj.limit, obj.curr*obj.limit), cols: [cols] })
|
||
}
|
||
})
|
||
}
|
||
setTable(1)
|
||
// setTable(2)
|
||
// setTable(3)
|
||
// setTable(4)
|
||
|
||
// 下拉选择轮次
|
||
$('.downloadX1').attr('href', `javascript:void(0)`)
|
||
$('.downloadX1').click(function() {
|
||
if(!showExportByAge) {
|
||
exportByAge(101)
|
||
}
|
||
})
|
||
$('.downloadX3').attr('href', `javascript:void(0)`)
|
||
$('.downloadX3').click(function() {
|
||
if(!showExportByAge) {
|
||
exportByAge(103)
|
||
}
|
||
})
|
||
form.on('select(select_filter_round_1)', (data) => {
|
||
select_round = data.value
|
||
// if(select_round == 'best') {
|
||
// $('.downloadX1').attr('href', `javascript:void(0)`)
|
||
// $('.downloadX1').click(function() {
|
||
// if(!showExportByAge && select_round == 'best') {
|
||
// exportByAge()
|
||
// }
|
||
// })
|
||
// } else {
|
||
// $('.downloadX1').attr('href', `https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=101&sorting=false&other_round=${select_round}`)
|
||
// }
|
||
|
||
// $('.downloadX1').attr('href', `javascript:void(0)`)
|
||
// $('.downloadX1').click(function() {
|
||
// if(!showExportByAge) {
|
||
// exportByAge()
|
||
// }
|
||
// })
|
||
|
||
resetData(1)
|
||
// if(select_round == 'best') {
|
||
// $('.sort').show()
|
||
// } else {
|
||
// $('.sort').hide()
|
||
// }
|
||
})
|
||
form.on('select(select_filter_round_2)', (data) => {
|
||
select_round = data.value
|
||
if(select_round == 'best') {
|
||
select_round = 'bestsen'
|
||
}
|
||
resetData(2)
|
||
})
|
||
// 淘汰赛
|
||
form.on('select(select_filter_round_3)', (data) => {
|
||
select_round = data.value
|
||
$('#groupExport').attr('href', `https://www.fpvone.cn/inback.php/cms/Leaguexport/export_wash?match_id=${match_id}&course=103&other_round=${select_round}`)
|
||
// $('.downloadX3').attr('href', `https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=103&sorting=false&other_round=${select_round}`)
|
||
resetData(3)
|
||
if(select_round == 3) {
|
||
$('#createGroup').hide()
|
||
} else {
|
||
$('#createGroup').show()
|
||
}
|
||
})
|
||
|
||
// 决赛
|
||
form.on('select(select_filter_round_4)', (data) => {
|
||
select_round = data.value
|
||
$('#groupExport2').attr('href', `https://www.fpvone.cn/inback.php/cms/Leaguexport/export_wash?match_id=${match_id}&course=104&other_round=${select_round}`)
|
||
resetData(4)
|
||
})
|
||
|
||
var showExportByAge = false
|
||
const exportByAge = (course) => {
|
||
layer.open({
|
||
type: 1,
|
||
shade: false,
|
||
title: "成绩导出",
|
||
area: ["400px", "200px"],
|
||
zIndex: 100,
|
||
content: `
|
||
<div class="qsn_content">
|
||
${course == 'all' ? `<div style="margin-bottom: 10px;">成绩有变更时请重新生成积分再导出总排名</div>` : ``}
|
||
<div class="layui-inline">
|
||
<label class="layui-form-label" style="width: 120px;">出生日期选择</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" class="layui-input" id="qsn_date" placeholder="yyyy-MM-dd" autocomplete="off">
|
||
</div>
|
||
</div>
|
||
<div style="text-align: center; margin-top: 20px">
|
||
<a class="layui-btn layui-bg-blue" id="export_byAge">导出成绩</a>
|
||
</div>
|
||
</div>
|
||
`,
|
||
success: function() {
|
||
showExportByAge = true
|
||
$('#export_byAge').attr('href', `https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=${course}&sorting=false&other_round=${select_round}&birthday=1970-01-01`)
|
||
laydate.render({
|
||
elem: '#qsn_date',
|
||
done: function(value, date, endDate) {
|
||
$('#export_byAge').attr('href', `https://www.fpvone.cn/inback.php/cms/league/export?match_id=${match_id}&course=${course}&sorting=false&other_round=${select_round}&birthday=${value}`)
|
||
}
|
||
})
|
||
},
|
||
end: function() {
|
||
showExportByAge = false
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
// 添加成绩
|
||
const update = (d, type) => {
|
||
update_windows = layer.open({
|
||
type: 1,
|
||
shade: false,
|
||
title: '修改数据',
|
||
area: ['620px'],
|
||
zIndex: 100,
|
||
content: `
|
||
<div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px 30px 30px 20px;">
|
||
<form class="layui-form">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">组别</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_group" type="text" name="group" class="layui-input" autocomplete="off" disabled>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">编号</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_playerId" type="text" name="player_id" class="layui-input" autocomplete="off" disabled>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">姓名</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_name" type="text" name="player_name" class="layui-input" autocomplete="off" disabled>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">频道</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_channel" type="text" name="channel" class="layui-input" autocomplete="off"}>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">led颜色</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_led" type="text" name="led_color" class="layui-input" autocomplete="off"}>
|
||
</div>
|
||
</div>
|
||
${
|
||
(type == 1 || type == 2) ?
|
||
`<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">第1圈</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_flyNum1" type="text" name="first_fly_time" class="layui-input" autocomplete="off" placeholder="若未完成该圈,则输入DNF。格式0:00.000">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">第2圈</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_flyNum2" type="text" name="second_fly_time" class="layui-input" autocomplete="off" placeholder="若未完成该圈,则输入DNF。格式0:00.000">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">第3圈</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_flyNum3" type="text" name="third_fly_time" class="layui-input" autocomplete="off" placeholder="若未完成该圈,则输入DNF。格式0:00.000">
|
||
</div>
|
||
</div>`
|
||
:
|
||
`<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">圈数</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_flyNum" type="text" name="fly_num" class="layui-input" autocomplete="off" placeholder="若未完成,则输入DNF。">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">时间</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_times" type="text" name="times" class="layui-input" autocomplete="off" placeholder="若未完成,则输入DNF。格式0:00.000">
|
||
</div>
|
||
</div>`
|
||
}
|
||
${
|
||
type != 4 ? '' : match_id == 606 ? '' :
|
||
`
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label" style="width: 80px">积分</label>
|
||
<div class="layui-input-block" style="margin-left: 100px">
|
||
<input id="form_integral" type="text" name="integral" class="layui-input" autocomplete="off">
|
||
</div>
|
||
</div>
|
||
`
|
||
}
|
||
<div class="layui-form-item">
|
||
<div class="layui-input-block" style="margin-left: 220px; margin-top: 30px;">
|
||
<button style="width: 120px;" type="submit" class="layui-btn" lay-submit lay-filter="submit1">提交</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
`,
|
||
success: () => {
|
||
// 设置资格赛和排位赛类型的数据
|
||
if(type == 1 || type == 2) {
|
||
$('#form_playerId').val(d.player_id)
|
||
$('#form_group').val(d.grouping)
|
||
$('#form_name').val(d.player_name)
|
||
$('#form_channel').val(d.channel)
|
||
$('#form_led').val(d.led_color)
|
||
$('#form_flyNum1').val(d.first_fly_time)
|
||
$('#form_flyNum2').val(d.second_fly_time)
|
||
$('#form_flyNum3').val(d.third_fly_time)
|
||
} else {
|
||
$('#form_playerId').val(d.player_id)
|
||
$('#form_group').val(d.grouping)
|
||
$('#form_name').val(d.player_name)
|
||
$('#form_channel').val(d.channel)
|
||
$('#form_led').val(d.led_color)
|
||
$('#form_flyNum').val(d.fly_num)
|
||
$('#form_times').val(d.times)
|
||
if(type == 4 && match_id != 606) {
|
||
$('#form_integral').val(d.integral)
|
||
}
|
||
}
|
||
// 提交表单数据
|
||
form.on("submit(submit1)", function (data) {
|
||
const field = data.field
|
||
if(type == 1 || type == 2) {
|
||
if(!check_cj(field.first_fly_time) || !check_cj(field.second_fly_time) || !check_cj(field.third_fly_time)) {
|
||
layer.msg('成绩格式有误!')
|
||
return false
|
||
}
|
||
field.match_id = d.match_id
|
||
field.course = d.course
|
||
field.other_round = select_round
|
||
field.id = d.id
|
||
setRanking(type, field)
|
||
} else {
|
||
if(!check_cj(field.times)) {
|
||
layer.msg('成绩格式有误!')
|
||
return false
|
||
}
|
||
field.match_id = d.match_id
|
||
field.course = d.course
|
||
field.other_round = select_round
|
||
field.id = d.id
|
||
setRanking(type, field)
|
||
}
|
||
return false
|
||
})
|
||
form.render()
|
||
},
|
||
end: () => {
|
||
update_windows = null
|
||
}
|
||
})
|
||
}
|
||
|
||
// 打印
|
||
const printHtml = (data) => {
|
||
const { course, other_round, grouping } = data
|
||
let coures_name = '', round_name = '', match_name = ''
|
||
switch(course) {
|
||
case '101': coures_name = '资格赛'; break;
|
||
case '103': coures_name = '淘汰赛'; break;
|
||
case '104': coures_name = '决赛'; break;
|
||
}
|
||
switch(other_round) {
|
||
case '1': round_name = '第一轮'; break;
|
||
case '2': round_name = '第二轮'; break;
|
||
case '3': round_name = '第三轮'; break;
|
||
case '4': round_name = '第四轮'; break;
|
||
case '5': round_name = '第五轮'; break;
|
||
case '6': round_name = '第六轮'; break;
|
||
case '7': round_name = '第七轮'; break;
|
||
case '8': round_name = '第八轮'; break;
|
||
case '9': round_name = '第九轮'; break;
|
||
case '10': round_name = '第十轮'; break;
|
||
case '11': round_name = '第十一轮'; break;
|
||
case '12': round_name = '第十二轮'; break;
|
||
case '13': round_name = '第十三轮'; break;
|
||
}
|
||
switch(match_id) {
|
||
case '606': match_name = '黄山站'; break;
|
||
case '804': match_name = '广州站'; break;
|
||
case '1008': match_name = '临汾站'; break;
|
||
case '1095': match_name = '柯桥站'; break;
|
||
case '1520': match_name = '苏州站'; break;
|
||
case '1756': match_name = '南京站'; break;
|
||
default: match_name = '测试';
|
||
}
|
||
if(course == '104' && match_id == 606) {
|
||
round_name = ''
|
||
}
|
||
let title = ``
|
||
if(course == '103') {
|
||
if(other_round == '1' || other_round == '2' || other_round == '6' || other_round == '9' || other_round == '12') {
|
||
title = `2024年中国无人机竞速联赛(${match_name})${coures_name}${round_name}胜者组运动员签字表`
|
||
} else {
|
||
title = `2024年中国无人机竞速联赛(${match_name})${coures_name}${round_name}败者组运动员签字表`
|
||
}
|
||
} else {
|
||
title = `2024年中国无人机竞速联赛(${match_name})${coures_name}${round_name}运动员签字表`
|
||
}
|
||
let html = '', list = []
|
||
cur_arr.map(item => {
|
||
if(item.grouping == grouping) {
|
||
list.push(item)
|
||
}
|
||
})
|
||
list.map((item, index) => {
|
||
html += `
|
||
<tr>
|
||
${index == 0 ? `<td rowspan="${list.length}">${item.grouping}</td>` : ''}
|
||
<td>${item.player_id}</td>
|
||
<td>${item.player_name}</td>
|
||
<td>${item.name_short}</td>
|
||
<td>${index + 1}</td>
|
||
${coures_name == '资格赛' ?
|
||
`
|
||
<td>${item.first_fly_time == null ? '' : item.first_fly_time}</td>
|
||
<td>${item.second_fly_time == null ? '' : item.second_fly_time}</td>
|
||
<td>${item.third_fly_time == null ? '' : item.third_fly_time}</td>
|
||
` :
|
||
`
|
||
<td>${item.fly_num == null ? '' : item.fly_num}</td>
|
||
<td>${item.times == null ? '' : item.times}</td>
|
||
`
|
||
}
|
||
<td></td>
|
||
<td>${item.channel}</td>
|
||
<td>${item.led_color}</td>
|
||
</tr>
|
||
`
|
||
})
|
||
printAreaCount = 0
|
||
if(coures_name == '资格赛') {
|
||
$('.print-content .title').text(title)
|
||
$('.print-content tbody').html(html)
|
||
printArea($('.print-content'))
|
||
} else {
|
||
$('.print-content2 .title').text(title)
|
||
$('.print-content2 tbody').html(html)
|
||
printArea($('.print-content2'))
|
||
}
|
||
|
||
}
|
||
|
||
// 监听设置按钮事件
|
||
const setTableUpdate = (index) => {
|
||
table.on(`tool(table${index})`, (obj) => {
|
||
switch (obj.event) {
|
||
case 'update': {
|
||
if(update_windows == null) {
|
||
update(obj.data, index)
|
||
}
|
||
break
|
||
}
|
||
case 'print': {
|
||
printHtml(obj.data)
|
||
break
|
||
}
|
||
}
|
||
})
|
||
}
|
||
setTableUpdate(1)
|
||
setTableUpdate(2)
|
||
setTableUpdate(3)
|
||
setTableUpdate(4)
|
||
|
||
// 清空数据
|
||
$('.clearData').click(function() {
|
||
layer.confirm('是否清空数据?', {icon: 3}, () => {
|
||
clear_window = layer.open({
|
||
type: 1,
|
||
area: '350px',
|
||
shadeClose: true,
|
||
content: `
|
||
<div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px;">
|
||
<div class="demo-login-container">
|
||
<div class="layui-form-item">
|
||
<div class="layui-input-wrap">
|
||
<div class="layui-input-prefix">
|
||
<i class="layui-icon layui-icon-password"></i>
|
||
</div>
|
||
<input type="password" name="password" value="" lay-verify="required" placeholder="密 码" lay-reqtext="请填写密码" autocomplete="off" class="layui-input" lay-affix="eye">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="demo-check">确定</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`,
|
||
success: () => {
|
||
form.render()
|
||
form.on('submit(demo-check)', async(data) => {
|
||
const field = data.field
|
||
if(field.password != 'yanxiaomao1') {
|
||
layer.msg('密码错误')
|
||
} else {
|
||
const res = await $.post('https://www.fpvone.cn/inback.php/cms/ranking/clearRanking', {
|
||
course: getCourseByIndex(tabIndex),
|
||
match_id: match_id,
|
||
})
|
||
if (res.code != 1) {
|
||
return layer.msg('清空失败')
|
||
}
|
||
// layer.close(add_windows)
|
||
layer.close(clear_window)
|
||
// 重置表格数据
|
||
resetData(tabIndex)
|
||
return layer.msg('清空成功')
|
||
}
|
||
return false
|
||
})
|
||
}
|
||
})
|
||
})
|
||
})
|
||
|
||
/**
|
||
* 判断成绩格式
|
||
* @param {Number} cj 成绩
|
||
* @returns {Boolean} 格式是否正确
|
||
*/
|
||
const check_cj = (cj) => {
|
||
if(cj == 'DNF' || cj == '') {
|
||
return true
|
||
} else {
|
||
const pattern = /^(\d{1,2}):(\d|[0-5]\d)\.(\d{3})$/
|
||
return pattern.test(cj)
|
||
}
|
||
}
|
||
|
||
// 总排名导出
|
||
$('.exportRanking').click(function() {
|
||
exportByAge('all')
|
||
})
|
||
|
||
// 刷新成绩
|
||
$('.flush_btn').click(function() {
|
||
resetData(tabIndex, false)
|
||
})
|
||
|
||
const areNumbers1234 = (a, b, c, d) => {
|
||
const numbers = [a, b, c, d].sort((a, b) => a - b)
|
||
return numbers.join('') === '1234'
|
||
}
|
||
|
||
let extra_popup = null
|
||
$('#extra-popup').click(function() {
|
||
let html = ''
|
||
pilot_list.map((item, index) => {
|
||
html += `
|
||
<div class="layui-inline" style="margin-top: 10px;">
|
||
<label class="layui-form-label" style="width: 150px;">${item.player_name}(${item.player_id})</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" value="${item.custom_sorting}" class="layui-input extra${index}" autocomplete="off">
|
||
</div>
|
||
</div>
|
||
`
|
||
})
|
||
|
||
extra_popup = layer.open({
|
||
type: 1,
|
||
shade: false,
|
||
title: "自定义排名",
|
||
area: ["450px", "360px"],
|
||
zIndex: 100,
|
||
content: `
|
||
<div class="qsn_content">
|
||
${html}
|
||
<div style="text-align: center; margin-top: 20px">
|
||
<a class="layui-btn layui-bg-blue" id="export_rank">提交</a>
|
||
</div>
|
||
</div>
|
||
`,
|
||
success: function() {
|
||
$('#export_rank').click(function() {
|
||
let num0 = $('.extra0').val(), num1 = $('.extra1').val(), num2 = $('.extra2').val(), num3 = $('.extra3').val()
|
||
if(num0.trim() == '' || num1.trim() == '' || num2.trim() == '' || num3.trim() == '') {
|
||
return layer.msg('请填写排名')
|
||
}
|
||
if(!areNumbers1234(num0, num1, num2, num3)) {
|
||
return layer.msg('请填写正确的排名')
|
||
}
|
||
|
||
let arr = [
|
||
{
|
||
player_id: pilot_list[0].player_id,
|
||
custom_sorting: num0,
|
||
},
|
||
{
|
||
player_id: pilot_list[1].player_id,
|
||
custom_sorting: num1,
|
||
},
|
||
{
|
||
player_id: pilot_list[2].player_id,
|
||
custom_sorting: num2,
|
||
},
|
||
{
|
||
player_id: pilot_list[3].player_id,
|
||
custom_sorting: num3,
|
||
}
|
||
]
|
||
$.post('https://www.fpvone.cn/inback.php/cms/leaguesort/custom_rank', {
|
||
match_id: match_id,
|
||
data: arr,
|
||
}).then(res => {
|
||
if(res.code == 1) {
|
||
layer.close(extra_popup)
|
||
resetData(4)
|
||
}
|
||
layer.msg(res.message)
|
||
})
|
||
})
|
||
}
|
||
})
|
||
})
|
||
|
||
|
||
function printArea (ele) {
|
||
var idPrefix = "printArea_";
|
||
removePrintArea(idPrefix + printAreaCount);
|
||
printAreaCount++;
|
||
var iframeId = idPrefix + printAreaCount;
|
||
var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
|
||
iframe = document.createElement('IFRAME');
|
||
$(iframe).attr({
|
||
style: iframeStyle,
|
||
id: iframeId
|
||
});
|
||
document.body.appendChild(iframe);
|
||
var doc = iframe.contentWindow.document;
|
||
$(document).find("link").filter(function () {
|
||
return $(this).attr("rel").toLowerCase() == "stylesheet";
|
||
}).each(
|
||
function () {
|
||
doc.write('<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >');
|
||
})
|
||
doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html() + '</div>');
|
||
doc.close();
|
||
var frameWindow = iframe.contentWindow;
|
||
frameWindow.close();
|
||
frameWindow.focus();
|
||
setTimeout(() => {
|
||
frameWindow.print();
|
||
}, 500)
|
||
}
|
||
var removePrintArea = function (id) {
|
||
$("iframe#" + id).remove()
|
||
}
|
||
})
|
||
</script>
|
||
</body>
|
||
</html>
|