feat: 抽取页分组均衡5:5 / 重置清累计 / 历史记录 / 排除管理 / 登陆账号字段 / side等高
随机抽取页: - 分组均衡抽取:有组别(≥2个)时默认按名额均分到组(12/8抽10→5/5), 其次按班级均分,否则整池随机;可勾选关闭 - 名额均分算法 allocQuotas:floor 均分 + 余数小组优先补齐 + 超容量退回 + 差额给剩余容量大者 - 重置结果:同时清零累计已抽取数(历史记录仍保留) - 历史记录:每批次入 localStorage ny_draw_log(上限50), 重置不清,支持查看详情/恢复结果/删除/清空 - 抽取排除:排除管理弹窗(搜索/清空),结果行可"移出并加入排除" - 白名单列表下载:登陆账号优先,缺失回退学号 名单登陆账号: - 模板解析识别"登陆/登录账号/账号/手机号"列,手机号去 .0 尾巴 - Db ny_roster 增 login 列 + 旧表自动升级(三方言) - roster_save 透传 login;draw_export 使用 login - 登陆账号仅用于白名单列表下载,其余界面不展示 布局:side 模式下成绩明细/缺考名单 panel 改 flex 撑满, .table-scroll 取消 320px 限高,两侧等高不再留白 测试:tools/test-draw-alloc.js 18/18 通过(含 1000 组随机 fuzz)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* NY 问卷考试系统数据平台 - 随机抽取
|
||||
* 从名单 / 已提交人员中随机抽取,导出为卷王白名单(两列:姓名 / 登陆账号)
|
||||
* 从名单 / 已提交人员中随机抽取(支持分组均衡 5:5、排除名单、历史记录),
|
||||
* 导出为卷王白名单(两列:姓名 / 登陆账号)
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
require __DIR__ . '/bootstrap.php';
|
||||
@@ -37,7 +38,7 @@ $rosterCount = Roster::count();
|
||||
</div>
|
||||
<div class="top-right">
|
||||
<a class="btn" href="index.php#roster" title="前往主系统管理学号名单">名单管理 <b id="rosterBadge"><?= (int)$rosterCount ?></b></a>
|
||||
<button class="btn" id="btnClearHistory" title="清空已抽取记录,重新开始">清空记录</button>
|
||||
<button class="btn" id="btnClearLog" title="清空全部历史记录(重置结果不影响历史记录)">清空历史</button>
|
||||
<a class="btn" href="index.php">← 返回主系统</a>
|
||||
<a class="btn" href="logout.php" title="退出登录">退出</a>
|
||||
</div>
|
||||
@@ -76,9 +77,11 @@ $rosterCount = Roster::count();
|
||||
</div>
|
||||
</div>
|
||||
<div class="field btns">
|
||||
<label class="chk"><input type="checkbox" id="excludePicked" checked> 排除已抽中</label>
|
||||
<label class="chk" title="有多个组别时按组别均衡抽取(如 A:B = 5:5),无组别时按班级均衡"><input type="checkbox" id="balanceChk" checked> 分组均衡</label>
|
||||
<label class="chk" title="再次抽取时不与本次会话已抽中的人重复;「重置结果」后清零"><input type="checkbox" id="excludePicked" checked> 排除已抽中</label>
|
||||
<button class="btn" id="btnExclude" title="勾选不参与抽取的人">🚫 排除管理</button>
|
||||
<button class="btn btn-primary" id="btnDraw">🎲 开始抽取</button>
|
||||
<button class="btn" id="btnReset">重置结果</button>
|
||||
<button class="btn" id="btnReset" title="清空本次结果与累计已抽取(历史记录保留)">重置结果</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -88,6 +91,7 @@ $rosterCount = Roster::count();
|
||||
<div class="card accent-blue"><span>候选人数</span><b id="dPool">-</b></div>
|
||||
<div class="card accent-green"><span>本次抽取</span><b id="dPicked">-</b></div>
|
||||
<div class="card warn accent-orange"><span>累计已抽取</span><b id="dHistory">-</b></div>
|
||||
<div class="card accent-red"><span>已排除</span><b id="dExcluded">-</b></div>
|
||||
<div class="card accent-gray"><span>抽取来源</span><b id="dSource">学号名单</b></div>
|
||||
</section>
|
||||
|
||||
@@ -95,6 +99,7 @@ $rosterCount = Roster::count();
|
||||
<div class="panel-head">
|
||||
<h2>抽取结果 <small id="drawHint"></small></h2>
|
||||
<div class="actions">
|
||||
<button class="btn" id="btnLog" title="查看历史抽取批次(重置结果后仍保留)">📜 历史 <b id="logBadge">0</b></button>
|
||||
<button class="btn" id="btnDlImport" title="导出为「白名单导入模板.xlsx」">⬇ 白名单导入模板</button>
|
||||
<button class="btn btn-primary" id="btnDlList" title="导出为「白名单列表.xlsx」">⬇ 白名单列表</button>
|
||||
</div>
|
||||
@@ -107,19 +112,58 @@ $rosterCount = Roster::count();
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:70px">序号</th>
|
||||
<th style="width:30%">学号</th>
|
||||
<th style="width:24%">姓名</th>
|
||||
<th style="width:26%">学号</th>
|
||||
<th style="width:22%">姓名</th>
|
||||
<th>班级</th>
|
||||
<th>组别</th>
|
||||
<th style="width:90px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="drawBody"><tr><td colspan="5" class="empty">尚未抽取</td></tr></tbody>
|
||||
<tbody id="drawBody"><tr><td colspan="6" class="empty">尚未抽取</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="hint">两个下载均为两列「<b>姓名</b> / <b>登陆账号</b>」(登陆账号取名单中的学号,按文本格式保存,长学号不会变成科学计数法),可直接导入卷王白名单。</p>
|
||||
<p class="hint">两个下载均为两列「<b>姓名</b> / <b>登陆账号</b>」,登陆账号取名单中导入的「登陆账号」列(缺失时回退学号),按文本格式保存,可直接导入卷王白名单。</p>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- ================= 排除管理 ================= -->
|
||||
<div class="modal" id="exclModal">
|
||||
<div class="modal-box wide">
|
||||
<div class="modal-head"><h3>抽取排除管理</h3><button class="x" data-close>×</button></div>
|
||||
<div class="modal-body">
|
||||
<div class="roster-bar">
|
||||
<input type="text" id="exclSearch" placeholder="搜索学号 / 姓名 / 班级">
|
||||
<span class="spacer"></span>
|
||||
<span class="hint" id="exclCount">已排除 0 人</span>
|
||||
<button class="btn sm danger" id="btnClearExcl">清空排除</button>
|
||||
</div>
|
||||
<div class="table-scroll mid">
|
||||
<table class="grid compact">
|
||||
<thead><tr><th style="width:64px">排除</th><th style="width:24%">学号</th><th style="width:22%">姓名</th><th>班级</th><th>组别</th></tr></thead>
|
||||
<tbody id="exclBody"><tr><td colspan="5" class="empty">加载中…</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="hint">勾选后这些人不再参与抽取(勾选即时生效);仅影响随机抽取,不影响其他功能。</p>
|
||||
</div>
|
||||
<div class="modal-foot"><span class="spacer"></span><button class="btn btn-primary" data-close>完成</button></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ================= 历史记录 ================= -->
|
||||
<div class="modal" id="logModal">
|
||||
<div class="modal-box wide">
|
||||
<div class="modal-head"><h3>抽取历史记录</h3><button class="x" data-close>×</button></div>
|
||||
<div class="modal-body">
|
||||
<div id="logList" class="log-list"><p class="empty" style="text-align:center;padding:30px 0">暂无历史记录</p></div>
|
||||
<p class="hint">每次抽取自动记一笔;「重置结果」不会清除历史记录,可随时恢复某一批次重新下载。</p>
|
||||
</div>
|
||||
<div class="modal-foot">
|
||||
<span class="spacer"></span>
|
||||
<button class="btn btn-primary" data-close>关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="assets/draw.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user