feat(dashboard): 筛号器新增单双筛选
点击单/双按钮置灰,匹配单双的号码被屏蔽,支持同时选中和重置。
This commit is contained in:
@@ -780,6 +780,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
' </div>' +
|
||||
'</div>' +
|
||||
'<div style="margin-bottom:15px;">' +
|
||||
' <label style="margin-right:10px;">单双:</label>' +
|
||||
' <button class="btn btn-default btn-xs nf-parity" data-parity="单">单</button>' +
|
||||
' <button class="btn btn-default btn-xs nf-parity" data-parity="双">双</button>' +
|
||||
'</div>' +
|
||||
'<div style="margin-bottom:15px;">' +
|
||||
' <label style="margin-right:10px;">区间:</label>' +
|
||||
' <button class="btn btn-xs btn-primary btn-nf-add-range"><i class="fa fa-plus"></i> 新增</button>' +
|
||||
'</div>' +
|
||||
@@ -826,6 +831,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
Controller.api.applyNumberFilters(layero);
|
||||
});
|
||||
|
||||
// 单双按钮点击
|
||||
$('.nf-parity', layero).on('click', function () {
|
||||
var $btn = $(this);
|
||||
$btn.toggleClass('btn-default').toggleClass('btn-gray');
|
||||
Controller.api.applyNumberFilters(layero);
|
||||
});
|
||||
|
||||
// 新增区间
|
||||
$('.btn-nf-add-range', layero).on('click', function () {
|
||||
Controller.api.addRangeRow(layero, 1, 49, 'include');
|
||||
@@ -855,6 +867,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
$('#nf-tail-list', layero).html('');
|
||||
$('.nf-zodiac', layero).removeClass('btn-gray').addClass('btn-default');
|
||||
$('.nf-color-btn', layero).removeClass('btn-gray').addClass('btn-default');
|
||||
$('.nf-parity', layero).removeClass('btn-gray').addClass('btn-default');
|
||||
$('#nf-range-list', layero).html('');
|
||||
Controller.api.applyNumberFilters(layero);
|
||||
});
|
||||
@@ -909,7 +922,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
if (colorRaw.indexOf('红') !== -1) colorLabel = '红';
|
||||
else if (colorRaw.indexOf('蓝') !== -1) colorLabel = '蓝';
|
||||
else if (colorRaw.indexOf('绿') !== -1) colorLabel = '绿';
|
||||
html += '<div class="nf-number" data-num="' + num + '" data-color="' + colorLabel + '" data-animal="' + animal + '" data-tail="' + (num % 10) + '" style="text-align:center;background:#f9f9f9;padding:6px 4px;border-radius:6px;min-width:60px;transition:opacity 0.2s;">' +
|
||||
html += '<div class="nf-number" data-num="' + num + '" data-color="' + colorLabel + '" data-animal="' + animal + '" data-tail="' + (num % 10) + '" data-parity="' + (num % 2 === 1 ? '单' : '双') + '" style="text-align:center;background:#f9f9f9;padding:6px 4px;border-radius:6px;min-width:60px;transition:opacity 0.2s;">' +
|
||||
'<span style="display:inline-block;width:36px;height:36px;line-height:36px;text-align:center;border-radius:50%;color:#fff;background-color:' + colorHex + ';font-weight:bold;">' + num + '</span>' +
|
||||
'<div style="font-size:10px;color:#666;line-height:1.2;">' + animal + '</div>' +
|
||||
'</div>';
|
||||
@@ -939,6 +952,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
$('.nf-color-btn.btn-gray', layero).each(function () {
|
||||
excludedColors.push($(this).data('color'));
|
||||
});
|
||||
// 收集被点击(置灰)的单双
|
||||
var excludedParities = [];
|
||||
$('.nf-parity.btn-gray', layero).each(function () {
|
||||
excludedParities.push($(this).data('parity'));
|
||||
});
|
||||
// 收集所有区间
|
||||
var ranges = [];
|
||||
$('.nf-range-row', layero).each(function () {
|
||||
@@ -956,12 +974,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
var animal = $num.data('animal');
|
||||
var color = $num.data('color');
|
||||
|
||||
var parity = $num.data('parity');
|
||||
|
||||
var hidden = false;
|
||||
|
||||
// 尾号筛选:选中多个尾号,任一命中即屏蔽
|
||||
if (excludedTails.length > 0 && excludedTails.indexOf(tail) !== -1) {
|
||||
hidden = true;
|
||||
}
|
||||
// 单双筛选:选中单或双,匹配则屏蔽
|
||||
if (excludedParities.indexOf(parity) !== -1) {
|
||||
hidden = true;
|
||||
}
|
||||
// 区间筛选:在区间=白名单(OR)、排除区间=黑名单(OR)
|
||||
if (!hidden) {
|
||||
var includeRanges = [];
|
||||
|
||||
Reference in New Issue
Block a user