添加排除功能

This commit is contained in:
ali
2026-07-29 16:56:48 +08:00
parent b827b7615d
commit 3118b3096f
+20 -16
View File
@@ -152,7 +152,7 @@
display: 'none', position: 'absolute', bottom: '60px', right: '0', display: 'none', position: 'absolute', bottom: '60px', right: '0',
backgroundColor: '#fff', padding: '20px', borderRadius: '8px', backgroundColor: '#fff', padding: '20px', borderRadius: '8px',
boxShadow: '0 4px 24px rgba(0,0,0,0.2)', width: '360px', boxShadow: '0 4px 24px rgba(0,0,0,0.2)', width: '360px',
color: '#333', border: '1px solid #eee' color: '#333', border: '1px solid #eee', maxHeight: '80vh', overflowY: 'auto'
}); });
// 动态生成带有缓存状态的 Checkbox HTML // 动态生成带有缓存状态的 Checkbox HTML
@@ -184,10 +184,13 @@
.ms-selectall-slider:before { position: absolute; content: ""; height: 10px; width: 10px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2); } .ms-selectall-slider:before { position: absolute; content: ""; height: 10px; width: 10px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.ms-selectall-switch input:checked + .ms-selectall-slider { background-color: #fa541c; } .ms-selectall-switch input:checked + .ms-selectall-slider { background-color: #fa541c; }
.ms-selectall-switch input:checked + .ms-selectall-slider:before { transform: translateX(12px); } .ms-selectall-switch input:checked + .ms-selectall-slider:before { transform: translateX(12px); }
#mysteel-filter-panel::-webkit-scrollbar { width: 6px; }
#mysteel-filter-panel::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }
#mysteel-filter-panel::-webkit-scrollbar-track { background: transparent; }
</style> </style>
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; display:flex; justify-content:space-between; align-items:center;"> <div style="font-size:14px; font-weight:bold; margin-bottom:15px; background:#f5f5f5; color:#333; padding:8px 12px; border-radius:4px; border-left:4px solid #1890ff; display:flex; justify-content:space-between; align-items:center;">
<div style="display:flex; align-items:center; gap:8px;"> <div style="display:flex; align-items:center; gap:8px;">
<span>筛选配置</span> <span>⚙️ 筛选配置</span>
<button id="ms-extract-options-btn" class="ms-tooltip-btn" data-tooltip="从当前页面获取筛选项目并更新到脚本配置中" style="background:none; border:none; cursor:pointer; color:#1890ff; padding:2px; display:flex; align-items:center; justify-content:center; border-radius:4px; outline:none;"> <button id="ms-extract-options-btn" class="ms-tooltip-btn" data-tooltip="从当前页面获取筛选项目并更新到脚本配置中" style="background:none; border:none; cursor:pointer; color:#1890ff; padding:2px; display:flex; align-items:center; justify-content:center; border-radius:4px; outline:none;">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"> <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
<polyline points="23 4 23 10 17 10"></polyline> <polyline points="23 4 23 10 17 10"></polyline>
@@ -206,45 +209,46 @@
</div> </div>
<div style="margin-bottom:12px;"> <div style="margin-bottom:12px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;"> <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<div style="font-size:13px; color:#333; font-weight:bold;">类别:</div> <div style="font-size:13px; color:#333; font-weight:bold;">类别</div>
<label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-names"><span class="ms-selectall-slider"></span></label> <label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-names"><span class="ms-selectall-slider"></span></label>
</div> </div>
<div id="ms-names-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('names', FILTER_OPTIONS.names)}</div> <div id="ms-names-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('names', FILTER_OPTIONS.names)}</div>
</div> </div>
<div style="margin-bottom:12px;"> <div style="margin-bottom:12px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;"> <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<div style="font-size:13px; color:#333; font-weight:bold;">线径:</div> <div style="font-size:13px; color:#333; font-weight:bold;">线径</div>
<label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-specs"><span class="ms-selectall-slider"></span></label> <label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-specs"><span class="ms-selectall-slider"></span></label>
</div> </div>
<div id="ms-specs-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('specs', FILTER_OPTIONS.specs)}</div> <div id="ms-specs-container" style="display:grid; grid-template-columns:repeat(5, 1fr); gap:8px 4px;">${buildCheckboxes('specs', FILTER_OPTIONS.specs)}</div>
</div> </div>
<div style="margin-bottom:15px;"> <div style="margin-bottom:15px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;"> <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<div style="font-size:13px; color:#333; font-weight:bold;">材质:</div> <div style="font-size:13px; color:#333; font-weight:bold;">材质</div>
<label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-materials"><span class="ms-selectall-slider"></span></label> <label class="ms-selectall-switch" title="全选/全不选"><input type="checkbox" id="ms-selectall-materials"><span class="ms-selectall-slider"></span></label>
</div> </div>
<div id="ms-materials-container" style="display:grid; grid-template-columns:repeat(4, 1fr); gap:8px 4px;">${buildCheckboxes('materials', FILTER_OPTIONS.materials)}</div> <div id="ms-materials-container" style="display:grid; grid-template-columns:repeat(4, 1fr); gap:8px 4px;">${buildCheckboxes('materials', FILTER_OPTIONS.materials)}</div>
</div> </div>
<div style="margin-bottom:15px; background:#f9f9f9; padding:10px; border-radius:6px; border:1px dashed #d9d9d9;">
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:8px;">排除特定组合 (黑名单):</div> <div style="font-size:14px; font-weight:bold; margin-bottom:15px; margin-top:15px; background:#f5f5f5; color:#333; padding:8px 12px; border-radius:4px; border-left:4px solid #1890ff;">🛡️ 排除配置</div>
<textarea id="ms-filter-excludes" placeholder="在此输入不要的数据组合,空格分隔,一行一条。\n例如输入:盘螺 Φ8\n则会精确排除所有线径为Φ8的盘螺,而保留Φ8-10。" style="width:100%; height:60px; padding:6px 8px; font-size:12px; border:1px solid #ccc; border-radius:4px; outline:none; resize:vertical; box-sizing:border-box; line-height:1.4;">${savedFilters.excludes || ''}</textarea> <div style="margin-bottom:15px;">
<textarea id="ms-filter-excludes" placeholder="在此输入不要的数据组合,空格分隔,一行一条。\n例如输入:盘螺 Φ8\n则会精确排除所有线径为Φ8的盘螺,而保留Φ8-10。" style="width:100%; height:72px; padding:6px 8px; font-size:12px; border:1px solid #ccc; border-radius:4px; outline:none; resize:vertical; box-sizing:border-box; line-height:1.5;">${savedFilters.excludes || ''}</textarea>
</div> </div>
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px;">导出配置</div> <div style="font-size:14px; font-weight:bold; margin-bottom:15px; margin-top:15px; background:#f5f5f5; color:#333; padding:8px 12px; border-radius:4px; border-left:4px solid #1890ff;">📤 导出配置</div>
<div style="margin-bottom:12px; display:flex; gap:10px; align-items:flex-end;"> <div style="margin-bottom:12px; display:flex; gap:10px; align-items:flex-end;">
<div style="flex:1;"> <div style="flex:1;">
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:6px;">导出格式:</div> <div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:6px;">格式</div>
<select id="ms-filter-format" style="width:100%; padding:4px 8px; font-size:13px; height:28px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px; outline:none;"> <select id="ms-filter-format" style="width:100%; padding:4px 8px; font-size:13px; height:28px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px; outline:none;">
<option value="csv" ${savedFilters.exportFormat === 'csv' ? 'selected' : ''}>CSV</option> <option value="xlsx" ${savedFilters.exportFormat === 'xlsx' ? 'selected' : ''}>XLSX</option>
<option value="xlsx" ${savedFilters.exportFormat === 'xlsx' ? 'selected' : ''}>XLSX</option> <option value="csv" ${savedFilters.exportFormat === 'csv' ? 'selected' : ''}>CSV</option>
</select> </select>
</div> </div>
<div style="flex:2;"> <div style="flex:2;">
<div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:6px;">自定义文件名称:</div> <div style="font-size:13px; color:#333; font-weight:bold; margin-bottom:6px;">文件名</div>
<input type="text" id="ms-filter-filename" value="${savedFilters.exportFilename || '钢材透视价格表'}" style="width:100%; padding:4px 8px; font-size:13px; height:28px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px; outline:none;"> <input type="text" id="ms-filter-filename" value="${savedFilters.exportFilename || '钢材透视价格表'}" style="width:100%; padding:4px 8px; font-size:13px; height:28px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px; outline:none;">
</div> </div>
</div> </div>
<div style="font-size:16px; font-weight:bold; margin-bottom:15px; border-bottom:1px solid #eee; padding-bottom:8px; margin-top:15px; display:flex; justify-content:space-between; align-items:center;"> <div style="font-size:14px; font-weight:bold; margin-bottom:15px; margin-top:15px; background:#f5f5f5; color:#333; padding:8px 12px; border-radius:4px; border-left:4px solid #1890ff; display:flex; justify-content:space-between; align-items:center;">
<span>开发者选项</span> <span>🛠️ 开发者选项</span>
<label class="ms-switch"> <label class="ms-switch">
<input type="checkbox" id="ms-dev-mode-switch" ${savedFilters.devMode ? 'checked' : ''}> <input type="checkbox" id="ms-dev-mode-switch" ${savedFilters.devMode ? 'checked' : ''}>
<span class="ms-slider"></span> <span class="ms-slider"></span>