This commit is contained in:
zlwu committed 2026-07-06 16:59:53 +08:00
1 parent 973176d508
commit cdaa0ac273
327 files changed
+32861 -25627

No files matched your search

@@ -0,0 +1,65 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>01 · 现网基线 · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">01 现网基线</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>筛选栅格内下拉框 · 与关键词、工单状态并列 · 需点击「搜索」或 debounce 触发</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="compare-all.html">并排对比</a>
<a href="02-chip-strip.html">02 Chip 条 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>现网对照:</strong>样本类型作为 filter-grid 第四列,选项来自
<code>fetchCellSampleTypeList</code>,切换 Tab 时清空。
<div class="pros-cons">
<div class="pro">✓ 与现有筛选表单一致,开发改动最小</div>
<div class="con">✗ 类型选项藏在下拉里,无法一眼看到可选范围与数量</div>
<div class="con">✗ 占用筛选栅格一列,与其他条件竞争横向空间</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: true })
document.getElementById('card-list').innerHTML = buildCardListHtml().replace(
/^<div class="list-body">|<\/div>$/g,
''
)
const selectEl = document.querySelector('#filter-sample-type-select')
const listEl = document.getElementById('card-list')
function applyFilter(typeId) {
listEl.innerHTML = buildCardListHtml(typeId || '').replace(/^<div class="list-body">|<\/div>$/g, '')
}
selectEl.addEventListener('change', () => applyFilter(selectEl.value))
applyFilter('')
</script>
</body>
</html>
@@ -0,0 +1,62 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>02 · Chip 条 · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">02 Chip 条</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>筛选区下方独立一行 · 胶囊 Chip + 数量 · 点击即筛 · 筛选栅格不再占「样本类型」列</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="01-baseline-dropdown.html">← 01</a>
<a href="03-segmented-track.html">03 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="sample-type-zone sample-type-zone--bordered">
<div class="sample-type-zone__label">样本类型</div>
<div class="type-chips" id="type-chips"></div>
<p class="sample-type-zone__hint" id="filter-hint"></p>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>推荐:</strong>把样本类型从「表单字段」提升为「快捷筛选条」,所有选项平铺可见;数量角标帮助判断工作量分布。
<div class="pros-cons">
<div class="pro">✓ 选项与数量一目了然,单击即筛,符合高频切换场景</div>
<div class="pro">✓ 释放 filter-grid 一列,关键词/状态/时间布局更宽松</div>
<div class="con">✗ 类型超过 6~8 个时需换行或横向滚动</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: false })
document.getElementById('type-chips').innerHTML = buildTypeChipsHtml()
initSampleTypeFilter('#panel-root', { listContainerSelector: '#card-list' })
</script>
</body>
</html>
@@ -0,0 +1,65 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>03 · Segmented · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">03 Segmented</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>主 Tab 与筛选区之间 · 灰底轨道 + 白底激活块 · 与 panel-pill-tabs 视觉语言一致</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="02-chip-strip.html">← 02</a>
<a href="04-sub-tab-bar.html">04 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="sample-type-zone" style="padding-top: 12px; padding-bottom: 4px">
<div class="sample-type-zone__label">按样本类型</div>
<div class="type-segmented" id="type-segmented"></div>
<p class="sample-type-zone__hint" id="filter-hint"></p>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>推荐:</strong>与质检主 Tab 的 <code>panel-pill-tabs</code> 形成「双层分段」——上层业务类型、下层样本类型,层级清晰。
<div class="pros-cons">
<div class="pro">✓ 视觉与现网 Tab 栏统一,用户学习成本低</div>
<div class="pro">✓ 位置在筛选区之上,表达「先定类型、再细筛」的信息架构</div>
<div class="con">✗ 选项名较长时轨道需横向滚动</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: false })
document.getElementById('type-segmented').innerHTML = buildTypeSegmentedHtml()
initSampleTypeFilter('#panel-root', {
btnSelector: '.type-segmented__btn',
listContainerSelector: '#card-list'
})
</script>
</body>
</html>
@@ -0,0 +1,68 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>04 · 二级 Tab · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">04 二级 Tab</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>主 Tab 下方全宽下划线 Tab · 带数量 · 语义上等同「子 Tab」而非表单字段</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="03-segmented-track.html">← 03</a>
<a href="05-toolbar-chips.html">05 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="sample-type-zone" style="padding-top: 8px; padding-bottom: 0">
<nav class="type-sub-tabs" role="tablist" aria-label="样本类型" id="type-sub-tabs"></nav>
</div>
<div id="filter-after-tabs"></div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>适用:</strong>样本类型在业务上接近「子视图」而非「附加条件」时;与 Element Plus 下划线 Tab 一致。
<div class="pros-cons">
<div class="pro">✓ 层级语义最强:质检类型 → 样本类型 → 列表</div>
<div class="pro">✓ 切换时可直接 debounce 拉数,不必点搜索</div>
<div class="con">✗ 与主 Tab 形态相似,两层 Tab 可能略拥挤</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML = buildMainTabsHtml()
document.getElementById('filter-after-tabs').innerHTML = buildFilterHtml({
includeSampleTypeDropdown: false
})
document.getElementById('type-sub-tabs').innerHTML = buildTypeSubTabsHtml()
initSampleTypeFilter('#panel-root', {
btnSelector: '.type-sub-tabs__btn',
listContainerSelector: '#card-list',
hintSelector: null
})
</script>
</body>
</html>
@@ -0,0 +1,53 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>05 · 工具栏 Chip · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">05 工具栏 Chip</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>列表工具栏内联 · 与批量操作同排 · 最省纵向空间</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="04-sub-tab-bar.html">← 04</a>
<a href="06-left-rail.html">06 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div id="toolbar-slot"></div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>适用:</strong>样本类型数量少(≤4)、且用户更关注列表操作时;把过滤做成「列表上下文快捷项」。
<div class="pros-cons">
<div class="pro">✓ 零额外纵向区块,页面最紧凑</div>
<div class="con">✗ 工具栏已含「已选 / 导出 / 批量」,再加 Chip 易拥挤</div>
<div class="con">✗ 过滤与操作混排,语义弱于独立筛选条</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: false })
document.getElementById('toolbar-slot').innerHTML = buildToolbarHtml({
includeTypeChips: true
})
initSampleTypeFilter('#panel-root', { listContainerSelector: '#card-list' })
</script>
</body>
</html>
@@ -0,0 +1,68 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>06 · 左栏导航 · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">06 左栏导航</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>列表区左侧固定类型导航 · 右侧协议卡片 · 适合类型较多、需纵向扫视</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="05-toolbar-chips.html">← 05</a>
<a href="07-icon-cards.html">07 →</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="panel-with-rail">
<aside class="type-rail">
<div class="type-rail__title">样本类型</div>
<div id="type-rail"></div>
</aside>
<div class="panel-rail-main">
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</div>
</div>
</section>
<p class="style-note">
<strong>适用:</strong>未来样本类型继续增加(>6)时;左栏可扩展滚动,右侧列表宽度仍充足(1280 容器下约 200px 侧栏)。
<div class="pros-cons">
<div class="pro">✓ 类型再多也不挤占主内容区头部</div>
<div class="pro">✓ 与邮件/文档类「文件夹导航」心智一致</div>
<div class="con">✗ 改动布局较大,窄屏需折叠为 Chip(CSS 已做响应式)</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: false })
document.getElementById('type-rail').innerHTML = buildTypeRailHtml()
initSampleTypeFilter('#panel-root', {
btnSelector: '.type-rail__btn',
listContainerSelector: '#card-list'
})
</script>
</body>
</html>
@@ -0,0 +1,65 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>07 · 图标卡片 · 样本类型过滤 Demo</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<header class="demo-banner">
<div>
<h1><span class="demo-badge">07 图标卡片</span> 质检工单 · 样本类型过滤 Demo</h1>
<p>利用样本类型 Logo / 首字做卡片宫格 · 视觉识别强 · 可对接 <code>type_logo</code> 字段</p>
</div>
<div class="demo-banner__actions">
<a href="index.html">← 选型索引</a>
<a href="06-left-rail.html">← 06</a>
<a href="compare-all.html">并排对比</a>
</div>
</header>
<div class="page-wrap">
<section class="panel" id="panel-root">
<div id="page-shell"></div>
<div class="sample-type-zone sample-type-zone--bordered">
<div class="sample-type-zone__label">选择样本类型</div>
<div class="type-icon-grid" id="type-icon-grid"></div>
<p class="sample-type-zone__hint" id="filter-hint"></p>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
</div>
<div class="list-body" id="card-list"></div>
</section>
<p class="style-note">
<strong>适用:</strong>样本类型有明确品牌 Logo(<code>biz_cell_sample_type.type_logo</code>),且业务人员按图标记忆类型。
<div class="pros-cons">
<div class="pro">✓ 识别度最高,「全部」与具体类型权重对等</div>
<div class="pro">✓ 后续可展示存储年限、单价等摘要(卡片扩展位)</div>
<div class="con">✗ 纵向占用约 120px+,列表首屏可见卡片变少</div>
</div>
</p>
</div>
<script src="_demo-shell.js"></script>
<script>
document.getElementById('page-shell').innerHTML =
buildMainTabsHtml() + buildFilterHtml({ includeSampleTypeDropdown: false })
document.getElementById('type-icon-grid').innerHTML = buildTypeIconGridHtml()
initSampleTypeFilter('#panel-root', {
btnSelector: '.type-icon-card',
listContainerSelector: '#card-list'
})
</script>
</body>
</html>
@@ -0,0 +1,314 @@
/** 质检工单 · 样本类型过滤 Demo 通用数据与交互 */
const SAMPLE_TYPES = [
{ id: '', name: '全部', short: '全', count: 18, icon: '∑' },
{
id: '562040C071C44473AD3BCD7C84A70354',
name: '围产期造血干细胞',
short: '造',
count: 7,
icon: '造'
},
{
id: '7BA21E5B7B0D4E5F9FE8076C8FC76959',
name: '脐带间充质干细胞',
short: '脐',
count: 6,
icon: '脐'
},
{
id: '2B3E7EC8EFFC4D9A904BBC34D55668DA',
name: '胎盘亚全能干细胞',
short: '胎',
count: 5,
icon: '胎'
}
]
const MOCK_PROTOCOLS = [
{
id: 'p1',
code: 'ZKZX-20260701-001',
typeId: '562040C071C44473AD3BCD7C84A70354',
typeName: '围产期造血干细胞',
mother: '张女士',
status: '进行中',
statusType: 'warning',
woNo: 'QC-IN-20260701-003',
sub: '2 个样本 · 1/2 已配置'
},
{
id: 'p2',
code: 'ZKQD-20260702-008',
typeId: '7BA21E5B7B0D4E5F9FE8076C8FC76959',
typeName: '脐带间充质干细胞',
mother: '李女士',
status: '待配置',
statusType: 'success',
woNo: 'QC-IN-20260702-001',
sub: '1 个样本 · 0/1 已配置'
},
{
id: 'p3',
code: 'ZKTP-20260628-012',
typeId: '2B3E7EC8EFFC4D9A904BBC34D55668DA',
typeName: '胎盘亚全能干细胞',
mother: '王女士',
status: '已完成',
statusType: 'success',
woNo: 'QC-IN-20260628-009',
sub: '1 个样本 · 全部完成'
},
{
id: 'p4',
code: 'ZKZX-20260703-015',
typeId: '562040C071C44473AD3BCD7C84A70354',
typeName: '围产期造血干细胞',
mother: '赵女士',
status: '进行中',
statusType: 'warning',
woNo: 'QC-IN-20260703-002',
sub: '3 个样本 · 2/3 已配置'
}
]
function buildMainTabsHtml() {
const tabs = [
{ label: '细胞存储质检', active: true, count: 12 },
{ label: '科研捐赠质检', active: false, count: 3 },
{ label: '中试服务质检', active: false, count: 5 },
{ label: '基础实验质检', active: false, count: 2 },
{ label: '临时质检', active: false, count: 1 }
]
return `
<div class="qc-main-tabs">
<div class="qc-main-tabs__track" role="tablist">
${tabs
.map(
(t) => `
<button type="button" class="qc-main-tabs__btn${t.active ? ' is-active' : ''}" role="tab">
${t.label}
<span class="qc-main-tabs__badge${t.count === 0 ? ' qc-main-tabs__badge--zero' : ''}">${t.count}</span>
</button>`
)
.join('')}
</div>
</div>`
}
function buildFilterHtml(options = {}) {
const { includeSampleTypeDropdown = false, selectedTypeName = '全部' } = options
const sampleTypeField = includeSampleTypeDropdown
? `
<div class="filter-item">
<label>样本类型</label>
<select id="filter-sample-type-select">
${SAMPLE_TYPES.map(
(t) =>
`<option value="${t.id}"${t.name === selectedTypeName ? ' selected' : ''}>${t.name === '全部' ? '全部' : t.name}</option>`
).join('')}
</select>
</div>`
: ''
return `
<div class="filter-block">
<div class="filter-grid">
<div class="filter-item">
<label>关键词</label>
<div class="fake-input is-placeholder">协议号 / 样本编号 / 工单号</div>
</div>
<div class="filter-item">
<label>工单状态</label>
<div class="fake-input is-placeholder">全部</div>
</div>
${sampleTypeField}
<div class="filter-item">
<label>工单来源</label>
<div class="fake-input is-placeholder">全部</div>
</div>
<div class="filter-item">
<label>创建时间</label>
<div class="fake-input is-placeholder">开始日期 — 结束日期</div>
</div>
</div>
<div class="filter-actions-row">
<button type="button" class="btn">重置</button>
<button type="button" class="btn btn-primary">搜索</button>
</div>
</div>`
}
function buildToolbarHtml(options = {}) {
const { includeTypeChips = false, activeTypeId = '' } = options
const chips = includeTypeChips
? `
<span class="toolbar-type-divider" aria-hidden="true"></span>
${SAMPLE_TYPES.map(
(t) => `
<button type="button" class="type-chip sample-type-btn" data-type-id="${t.id}">
${t.name}
<span class="type-chip__count">${t.count}</span>
</button>`
).join('')}`
: ''
return `
<div class="list-toolbar">
<div class="list-toolbar__left">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出附件</button>
<button type="button" class="btn">批量操作</button>
${chips}
</div>
<div class="list-toolbar__right">
<button type="button" class="btn">刷新</button>
</div>
</div>`
}
function buildCardListHtml(activeTypeId = '') {
const visible = MOCK_PROTOCOLS.filter(
(p) => !activeTypeId || p.typeId === activeTypeId
)
if (!visible.length) {
return `<div class="list-body"><div class="empty-hint">当前样本类型下暂无工单</div></div>`
}
return `
<div class="list-body">
${visible
.map(
(p) => `
<article class="qc-protocol-row" data-type-id="${p.typeId}">
<div class="qc-protocol-row__ctx">
<span class="qc-protocol-row__code">${p.code}</span>
<span class="qc-protocol-row__type">${p.typeName}</span>
<span class="qc-protocol-row__sub">母亲 ${p.mother}</span>
<span class="tag tag--${p.statusType}">${p.status}</span>
<span class="qc-protocol-row__sub">${p.sub}</span>
</div>
<div class="qc-card-placeholder">
<div class="qc-card-placeholder__no">${p.woNo}</div>
<div class="qc-card-placeholder__meta">样本接收质检 · 点击查看详情与任务</div>
</div>
</article>`
)
.join('')}
</div>`
}
function buildTypeChipsHtml(className = 'type-chip sample-type-btn') {
return SAMPLE_TYPES.map(
(t) => `
<button type="button" class="${className}" data-type-id="${t.id}">
${t.name}
<span class="type-chip__count">${t.count}</span>
</button>`
).join('')
}
function buildTypeSegmentedHtml() {
return SAMPLE_TYPES.map(
(t) => `
<button type="button" class="type-segmented__btn sample-type-btn" data-type-id="${t.id}">
${t.name}${t.id ? ` (${t.count})` : ''}
</button>`
).join('')
}
function buildTypeSubTabsHtml() {
return SAMPLE_TYPES.map(
(t) => `
<button type="button" class="type-sub-tabs__btn sample-type-btn" data-type-id="${t.id}">
${t.name}
<span class="type-sub-tabs__count">${t.count}</span>
</button>`
).join('')
}
function buildTypeRailHtml() {
return SAMPLE_TYPES.map(
(t) => `
<button type="button" class="type-rail__btn sample-type-btn" data-type-id="${t.id}">
<span>${t.name}</span>
<span class="type-rail__count">${t.count}</span>
</button>`
).join('')
}
function buildTypeIconGridHtml() {
return SAMPLE_TYPES.map(
(t) => `
<button type="button" class="type-icon-card sample-type-btn" data-type-id="${t.id}">
<span class="type-icon-card__avatar">${t.icon}</span>
<span class="type-icon-card__name">${t.name}</span>
<span class="type-icon-card__count">${t.count} 条工单</span>
</button>`
).join('')
}
function initSampleTypeFilter(root, options = {}) {
const {
btnSelector = '.sample-type-btn',
listContainerSelector = '#card-list',
hintSelector = '#filter-hint',
onChange
} = options
const rootEl = typeof root === 'string' ? document.querySelector(root) : root
if (!rootEl) return
const listEl = rootEl.querySelector(listContainerSelector)
const hintEl = rootEl.querySelector(hintSelector)
const selectEl = rootEl.querySelector('#filter-sample-type-select')
let activeTypeId = ''
function setActive(typeId) {
activeTypeId = typeId || ''
rootEl.querySelectorAll(btnSelector).forEach((btn) => {
btn.classList.toggle('is-active', btn.dataset.typeId === activeTypeId)
})
if (selectEl) {
selectEl.value = activeTypeId
}
if (listEl) {
listEl.innerHTML = buildCardListHtml(activeTypeId).replace(
/^<div class="list-body">|<\/div>$/g,
''
)
if (!listEl.querySelector('.qc-protocol-row') && !listEl.querySelector('.empty-hint')) {
listEl.innerHTML = '<div class="empty-hint">当前样本类型下暂无工单</div>'
}
}
const label =
SAMPLE_TYPES.find((t) => t.id === activeTypeId)?.name || '全部'
if (hintEl) {
hintEl.innerHTML = `当前筛选:<strong>${label}</strong> · 共 ${
activeTypeId
? MOCK_PROTOCOLS.filter((p) => p.typeId === activeTypeId).length
: MOCK_PROTOCOLS.length
} 条协议组`
}
if (typeof onChange === 'function') onChange(activeTypeId, label)
}
rootEl.querySelectorAll(btnSelector).forEach((btn) => {
btn.addEventListener('click', () => setActive(btn.dataset.typeId || ''))
})
if (selectEl) {
selectEl.addEventListener('change', () => setActive(selectEl.value))
}
setActive('')
return { setActive }
}
function mockPageShell(contentHtml) {
return `
${buildMainTabsHtml()}
${contentHtml}
`
}
@@ -0,0 +1,918 @@
/* 质检工单 · 样本类型过滤选型 Demo(Fresh Mint Token) */
:root {
--primary: #10b981;
--primary-dark: #059669;
--primary-bg: #ecfdf5;
--text: #1e293b;
--text-muted: #64748b;
--border: #e2e8f0;
--border-soft: #d9e8e2;
--bg-page: #f8fafc;
--surface: #fff;
--radius: 10px;
--radius-sm: 8px;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
font-size: 14px;
line-height: 1.5;
color: var(--text);
background: var(--bg-page);
}
.demo-banner {
position: sticky;
top: 0;
z-index: 200;
padding: 12px 24px;
background: var(--surface);
border-bottom: 1px solid var(--border);
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.demo-banner h1 {
margin: 0;
font-size: 15px;
font-weight: 600;
}
.demo-banner p {
margin: 4px 0 0;
font-size: 12px;
color: var(--text-muted);
max-width: 760px;
line-height: 1.55;
}
.demo-banner__actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
flex-shrink: 0;
}
.demo-banner a,
.demo-link {
display: inline-flex;
align-items: center;
height: 32px;
padding: 0 12px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: var(--surface);
font-size: 12px;
font-weight: 500;
color: var(--text-muted);
text-decoration: none;
transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.demo-banner a:hover,
.demo-link:hover {
border-color: #a7f3d0;
background: var(--primary-bg);
color: var(--primary-dark);
}
.demo-banner a.is-current {
background: var(--primary-bg);
border-color: var(--primary);
color: var(--primary-dark);
}
.demo-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
background: var(--primary-bg);
color: var(--primary-dark);
margin-right: 6px;
}
.page-wrap {
padding: 24px;
max-width: 1280px;
margin: 0 auto;
}
.panel {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
/* ── 主 Tab(质检类型) ── */
.qc-main-tabs {
padding: 16px 24px 0;
}
.qc-main-tabs__track {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 4px;
background: #f1f5f9;
border-radius: 12px;
}
.qc-main-tabs__btn {
display: inline-flex;
align-items: center;
gap: 8px;
height: 40px;
padding: 0 16px;
border: none;
border-radius: 10px;
background: transparent;
font-family: inherit;
font-size: 14px;
font-weight: 500;
color: var(--text-muted);
cursor: pointer;
transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.qc-main-tabs__btn:hover {
color: var(--primary-dark);
}
.qc-main-tabs__btn.is-active {
background: var(--surface);
color: var(--primary-dark);
font-weight: 600;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.qc-main-tabs__badge {
min-width: 22px;
height: 20px;
padding: 0 6px;
border-radius: 999px;
background: #fee2e2;
color: #b91c1c;
font-size: 11px;
font-weight: 700;
display: inline-flex;
align-items: center;
justify-content: center;
}
.qc-main-tabs__badge--zero {
background: #e2e8f0;
color: #94a3b8;
}
/* ── 筛选区 ── */
.filter-block {
padding: 16px 24px;
border-top: 1px solid var(--border);
}
.filter-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px 16px;
}
.filter-item label {
display: block;
font-size: 11px;
font-weight: 500;
color: var(--text-muted);
margin-bottom: 6px;
}
.filter-item .fake-input,
.filter-item select {
width: 100%;
height: 36px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 0 12px;
background: var(--surface);
color: var(--text);
font-size: 13px;
font-family: inherit;
}
.filter-item .fake-input.is-placeholder {
color: var(--text-muted);
}
.filter-actions-row {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 12px;
}
.btn {
height: 36px;
padding: 0 14px;
border-radius: var(--radius-sm);
font-size: 13px;
font-weight: 500;
border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
cursor: pointer;
font-family: inherit;
display: inline-flex;
align-items: center;
gap: 6px;
}
.btn-primary {
background: var(--primary);
border-color: var(--primary);
color: #fff;
}
.btn-primary:hover {
background: var(--primary-dark);
}
/* ── 样本类型过滤区通用 ── */
.sample-type-zone {
padding: 0 24px;
}
.sample-type-zone--bordered {
border-top: 1px solid var(--border);
padding-top: 14px;
padding-bottom: 14px;
}
.sample-type-zone__label {
font-size: 11px;
font-weight: 500;
color: var(--text-muted);
margin-bottom: 8px;
}
.sample-type-zone__hint {
margin-top: 8px;
font-size: 12px;
color: var(--text-muted);
}
.sample-type-zone__hint strong {
color: var(--primary-dark);
}
/* 02 · 横向 Chip 条 */
.type-chips {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.type-chip {
display: inline-flex;
align-items: center;
gap: 6px;
height: 32px;
padding: 0 12px;
border-radius: 999px;
border: 1px solid var(--border);
background: var(--surface);
font-family: inherit;
font-size: 13px;
font-weight: 500;
color: var(--text-muted);
cursor: pointer;
transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.type-chip:hover {
border-color: #a7f3d0;
color: var(--primary-dark);
}
.type-chip.is-active {
background: var(--primary-bg);
border-color: #a7f3d0;
color: var(--primary-dark);
font-weight: 600;
}
.type-chip__count {
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 999px;
background: #e2e8f0;
font-size: 11px;
font-weight: 700;
color: #64748b;
display: inline-flex;
align-items: center;
justify-content: center;
}
.type-chip.is-active .type-chip__count {
background: var(--primary);
color: #fff;
}
/* 03 · Segmented 轨道 */
.type-segmented {
display: inline-flex;
max-width: 100%;
padding: 4px;
background: #f1f5f9;
border-radius: 12px;
overflow-x: auto;
scrollbar-width: thin;
}
.type-segmented__btn {
flex-shrink: 0;
height: 36px;
padding: 0 14px;
border: none;
border-radius: 10px;
background: transparent;
font-family: inherit;
font-size: 13px;
font-weight: 500;
color: var(--text-muted);
cursor: pointer;
white-space: nowrap;
transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.type-segmented__btn:hover {
color: var(--primary-dark);
}
.type-segmented__btn.is-active {
background: var(--surface);
color: var(--primary-dark);
font-weight: 600;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
/* 04 · 二级 Tab 条 */
.type-sub-tabs {
display: flex;
flex-wrap: wrap;
gap: 0;
border-bottom: 1px solid var(--border);
margin: 0 -24px;
padding: 0 24px;
}
.type-sub-tabs__btn {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
height: 44px;
padding: 0 18px;
border: none;
background: transparent;
font-family: inherit;
font-size: 14px;
font-weight: 500;
color: var(--text-muted);
cursor: pointer;
margin-bottom: -1px;
border-bottom: 2px solid transparent;
transition: color 0.15s, border-color 0.15s;
}
.type-sub-tabs__btn:hover {
color: var(--primary-dark);
}
.type-sub-tabs__btn.is-active {
color: var(--primary-dark);
font-weight: 600;
border-bottom-color: var(--primary);
}
.type-sub-tabs__count {
font-size: 12px;
font-weight: 600;
color: #94a3b8;
}
.type-sub-tabs__btn.is-active .type-sub-tabs__count {
color: var(--primary);
}
/* 05 · 工具栏 Chip */
.list-toolbar {
padding: 12px 24px;
border-top: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.list-toolbar__left {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
flex: 1;
min-width: 0;
}
.list-toolbar__right {
display: flex;
gap: 8px;
flex-shrink: 0;
}
.sel-hint {
font-size: 13px;
color: var(--text-muted);
margin-right: 4px;
}
.sel-hint strong {
color: var(--primary-dark);
}
.toolbar-type-divider {
width: 1px;
height: 24px;
background: var(--border);
margin: 0 4px;
}
/* 06 · 左栏过滤 */
.panel-with-rail {
display: grid;
grid-template-columns: 200px minmax(0, 1fr);
}
.type-rail {
border-right: 1px solid var(--border);
padding: 16px 0;
background: #fafafa;
}
.type-rail__title {
padding: 0 16px 10px;
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
}
.type-rail__btn {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 40px;
padding: 8px 16px;
border: none;
background: transparent;
font-family: inherit;
font-size: 13px;
font-weight: 500;
color: var(--text);
text-align: left;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.type-rail__btn:hover {
background: var(--primary-bg);
color: var(--primary-dark);
}
.type-rail__btn.is-active {
background: var(--primary-bg);
color: var(--primary-dark);
font-weight: 600;
box-shadow: inset 3px 0 0 var(--primary);
}
.type-rail__count {
font-size: 12px;
color: #94a3b8;
}
.type-rail__btn.is-active .type-rail__count {
color: var(--primary);
}
/* 07 · 图标卡片 */
.type-icon-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 10px;
}
.type-icon-card {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 14px 10px;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
font-family: inherit;
cursor: pointer;
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.type-icon-card:hover {
border-color: #a7f3d0;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}
.type-icon-card.is-active {
border-color: var(--primary);
background: var(--primary-bg);
box-shadow: 0 0 0 1px var(--primary);
}
.type-icon-card__avatar {
width: 44px;
height: 44px;
border-radius: 12px;
background: linear-gradient(135deg, #d1fae5, #ecfdf5);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-weight: 700;
color: var(--primary-dark);
}
.type-icon-card__name {
font-size: 12px;
font-weight: 600;
color: var(--text);
text-align: center;
line-height: 1.35;
}
.type-icon-card__count {
font-size: 11px;
color: var(--text-muted);
}
.type-icon-card.is-active .type-icon-card__count {
color: var(--primary-dark);
font-weight: 600;
}
/* ── 列表卡片骨架 ── */
.list-body {
padding: 0 24px 24px;
}
.qc-protocol-row {
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
margin-bottom: 12px;
transition: opacity 0.2s;
}
.qc-protocol-row.is-hidden {
display: none;
}
.qc-protocol-row__ctx {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
padding: 12px 16px;
background: linear-gradient(180deg, var(--primary-bg) 0%, #fff 100%);
border-bottom: 1px solid #d1fae5;
}
.qc-protocol-row__code {
font-size: 14px;
font-weight: 600;
font-family: ui-monospace, Menlo, monospace;
}
.qc-protocol-row__type {
font-size: 11px;
font-weight: 600;
padding: 2px 10px;
border-radius: 999px;
background: var(--primary-bg);
color: #047857;
border: 1px solid #d1fae5;
}
.qc-protocol-row__sub {
flex: 1;
min-width: 0;
font-size: 12px;
color: var(--text-muted);
}
.tag {
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 8px;
border-radius: 6px;
font-size: 11px;
font-weight: 600;
}
.tag--success {
background: var(--primary-bg);
color: #047857;
}
.tag--warning {
background: #fffbeb;
color: #b45309;
}
.qc-card-placeholder {
padding: 14px 16px;
background: #fafafa;
}
.qc-card-placeholder__no {
font-size: 14px;
font-weight: 600;
font-family: ui-monospace, Menlo, monospace;
margin-bottom: 6px;
}
.qc-card-placeholder__meta {
font-size: 12px;
color: var(--text-muted);
}
.empty-hint {
padding: 32px 24px;
text-align: center;
color: var(--text-muted);
font-size: 13px;
}
/* ── 说明区 ── */
.style-note {
margin-top: 16px;
padding: 14px 16px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 13px;
color: var(--text-muted);
line-height: 1.6;
}
.style-note strong {
color: var(--text);
}
.pros-cons {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 4px;
font-size: 12px;
}
.pro {
color: #047857;
}
.con {
color: #94a3b8;
}
/* ── 对比页 ── */
.index-hero {
max-width: 960px;
margin: 0 auto;
padding: 32px 24px 12px;
}
.index-hero h1 {
margin: 0 0 8px;
font-size: 22px;
}
.index-hero p {
margin: 0;
color: var(--text-muted);
max-width: 720px;
line-height: 1.6;
}
.context-box {
max-width: 960px;
margin: 0 auto 8px;
padding: 0 24px;
}
.context-box-inner {
padding: 14px 16px;
background: #fffbeb;
border: 1px solid #fcd34d;
border-radius: 10px;
font-size: 13px;
color: #92400e;
line-height: 1.55;
}
.index-cta {
max-width: 960px;
margin: 0 auto;
padding: 8px 24px 12px;
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.index-cta a.primary {
background: var(--primary);
color: #fff;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
height: 44px;
padding: 0 20px;
border-radius: 10px;
font-size: 14px;
font-weight: 600;
border: none;
}
.index-cta a.primary:hover {
background: var(--primary-dark);
}
.index-grid {
max-width: 960px;
margin: 0 auto;
padding: 16px 24px 48px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 16px;
}
.index-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 18px;
text-decoration: none;
color: inherit;
transition: border-color 0.2s, box-shadow 0.2s;
}
.index-card:hover {
border-color: #a7f3d0;
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}
.index-card h2 {
margin: 0 0 6px;
font-size: 15px;
font-weight: 600;
color: var(--primary-dark);
}
.index-card p {
margin: 0;
font-size: 13px;
color: var(--text-muted);
line-height: 1.5;
}
.index-card .tag {
margin-top: 12px;
}
.index-card .tag--rec {
background: var(--primary-bg);
color: var(--primary-dark);
border: 1px solid #a7f3d0;
}
.compare-stack {
display: flex;
flex-direction: column;
gap: 28px;
padding: 0 24px 48px;
max-width: 1280px;
margin: 0 auto;
}
.compare-block {
background: var(--surface);
border: 1px solid var(--border-soft);
border-radius: var(--radius);
overflow: hidden;
}
.compare-block__label {
padding: 14px 18px;
background: #fafafa;
border-bottom: 1px solid var(--border);
}
.compare-block__label h2 {
margin: 0;
font-size: 14px;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.compare-block__label p {
margin: 6px 0 0;
font-size: 12px;
color: var(--text-muted);
line-height: 1.55;
}
.variant-tag {
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 8px;
border-radius: 6px;
font-size: 11px;
font-weight: 700;
}
.variant-tag--baseline {
background: #f1f5f9;
color: #475569;
}
.variant-tag--rec {
background: var(--primary-bg);
color: var(--primary-dark);
border: 1px solid #a7f3d0;
}
.compare-block__body {
padding: 16px;
background: #f1f5f9;
}
.compare-block__body .panel {
max-width: 100%;
}
@media (max-width: 900px) {
.filter-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.panel-with-rail {
grid-template-columns: 1fr;
}
.type-rail {
border-right: none;
border-bottom: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
padding: 12px;
gap: 4px;
}
.type-rail__title {
width: 100%;
}
.type-rail__btn {
width: auto;
border-radius: 999px;
border: 1px solid var(--border);
padding: 6px 12px;
min-height: 32px;
box-shadow: none !important;
}
}
@@ -0,0 +1,280 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>质检工单 · 样本类型过滤 · 并排对比</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
<style>
.compare-all-banner {
padding: 20px 24px;
background: var(--surface);
border-bottom: 1px solid var(--border);
}
.compare-all-banner h1 {
margin: 0 0 6px;
font-size: 18px;
}
.compare-all-banner p {
margin: 0;
font-size: 13px;
color: var(--text-muted);
}
.compare-all-banner a {
display: inline-flex;
margin-top: 12px;
}
.compare-block__body .panel-with-rail {
min-height: 280px;
}
.compare-block__body .filter-block {
padding: 12px 16px;
}
.compare-block__body .filter-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.compare-block__body .qc-main-tabs {
padding: 12px 16px 0;
}
.compare-block__body .sample-type-zone {
padding-left: 16px;
padding-right: 16px;
}
.compare-block__body .list-toolbar,
.compare-block__body .list-body {
padding-left: 16px;
padding-right: 16px;
}
.compare-block__body .type-sub-tabs {
margin: 0 -16px;
padding: 0 16px;
}
</style>
</head>
<body>
<div class="compare-all-banner">
<h1>质检工单 · 样本类型过滤 · 并排对比</h1>
<p>点击各方案内的样本类型控件可筛选下方模拟卡片。推荐优先看 02 Chip 条 与 03 Segmented。</p>
<a class="demo-link" href="index.html">← 返回选型索引</a>
</div>
<div class="compare-stack">
<!-- 01 -->
<section class="compare-block">
<div class="compare-block__label">
<h2>
<span class="variant-tag variant-tag--baseline">01 基线</span>
筛选栅格内下拉框(现网)
</h2>
<p>样本类型与关键词、状态并列;选项隐藏在下拉内。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-01">
<div class="cmp-shell"></div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
<!-- 02 -->
<section class="compare-block">
<div class="compare-block__label">
<h2>
<span class="variant-tag variant-tag--rec">02 推荐</span>
筛选下方 Chip 条
</h2>
<p>平铺可见 + 数量角标;单击即筛;释放 filter-grid 一列。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-02">
<div class="cmp-shell"></div>
<div class="sample-type-zone sample-type-zone--bordered">
<div class="sample-type-zone__label">样本类型</div>
<div class="type-chips cmp-chips"></div>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
<!-- 03 -->
<section class="compare-block">
<div class="compare-block__label">
<h2>
<span class="variant-tag variant-tag--rec">03 推荐</span>
Segmented 分段控件
</h2>
<p>主 Tab 与筛选之间;与 panel-pill-tabs 视觉统一。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-03">
<div class="cmp-shell"></div>
<div class="sample-type-zone" style="padding-top: 10px">
<div class="type-segmented cmp-segmented"></div>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
<!-- 04 -->
<section class="compare-block">
<div class="compare-block__label">
<h2><span class="variant-tag">04</span> 二级 Tab 条</h2>
<p>样本类型作为子 Tab,带下划线与数量。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-04">
<div class="cmp-shell-main"></div>
<div class="sample-type-zone" style="padding-bottom: 0">
<nav class="type-sub-tabs cmp-sub-tabs"></nav>
</div>
<div class="cmp-shell-filter"></div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
<!-- 05 -->
<section class="compare-block">
<div class="compare-block__label">
<h2><span class="variant-tag">05</span> 工具栏内联 Chip</h2>
<p>最紧凑;与批量操作同排。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-05">
<div class="cmp-shell"></div>
<div class="cmp-toolbar"></div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
<!-- 06 -->
<section class="compare-block">
<div class="compare-block__label">
<h2><span class="variant-tag">06</span> 左侧类型导航</h2>
<p>左栏固定类型列表,右侧卡片流。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-06">
<div class="cmp-shell"></div>
<div class="panel-with-rail">
<aside class="type-rail">
<div class="type-rail__title">样本类型</div>
<div class="cmp-rail"></div>
</aside>
<div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</div>
</div>
</section>
<!-- 07 -->
<section class="compare-block">
<div class="compare-block__label">
<h2><span class="variant-tag">07</span> 图标卡片宫格</h2>
<p>对接 type_logo;视觉识别最强。</p>
</div>
<div class="compare-block__body">
<div class="panel" id="cmp-07">
<div class="cmp-shell"></div>
<div class="sample-type-zone sample-type-zone--bordered">
<div class="type-icon-grid cmp-icon-grid"></div>
</div>
<div class="list-toolbar">
<span class="sel-hint">已选 <strong>0</strong> 项</span>
<button type="button" class="btn btn-primary">导出</button>
</div>
<div class="list-body cmp-list"></div>
</div>
</div>
</section>
</div>
<script src="_demo-shell.js"></script>
<script>
function setupCompare(id, options) {
const root = document.getElementById(id)
const shell = root.querySelector('.cmp-shell')
const shellMain = root.querySelector('.cmp-shell-main')
const shellFilter = root.querySelector('.cmp-shell-filter')
if (shell) {
shell.innerHTML =
buildMainTabsHtml() +
buildFilterHtml({ includeSampleTypeDropdown: id === 'cmp-01' })
}
if (shellMain) shellMain.innerHTML = buildMainTabsHtml()
if (shellFilter) shellFilter.innerHTML = buildFilterHtml({ includeSampleTypeDropdown: false })
const chips = root.querySelector('.cmp-chips')
if (chips) chips.innerHTML = buildTypeChipsHtml()
const seg = root.querySelector('.cmp-segmented')
if (seg) seg.innerHTML = buildTypeSegmentedHtml()
const sub = root.querySelector('.cmp-sub-tabs')
if (sub) sub.innerHTML = buildTypeSubTabsHtml()
const toolbar = root.querySelector('.cmp-toolbar')
if (toolbar) toolbar.innerHTML = buildToolbarHtml({ includeTypeChips: true })
const rail = root.querySelector('.cmp-rail')
if (rail) rail.innerHTML = buildTypeRailHtml()
const icons = root.querySelector('.cmp-icon-grid')
if (icons) icons.innerHTML = buildTypeIconGridHtml()
initSampleTypeFilter(root, {
btnSelector: options.btnSelector || '.sample-type-btn',
listContainerSelector: '.cmp-list'
})
}
setupCompare('cmp-01', {})
setupCompare('cmp-02', {})
setupCompare('cmp-03', { btnSelector: '.type-segmented__btn' })
setupCompare('cmp-04', { btnSelector: '.type-sub-tabs__btn' })
setupCompare('cmp-05', {})
setupCompare('cmp-06', { btnSelector: '.type-rail__btn' })
setupCompare('cmp-07', { btnSelector: '.type-icon-card' })
</script>
</body>
</html>
@@ -0,0 +1,76 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>质检工单 · 样本类型过滤选型 · 索引</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="_shared.css" />
</head>
<body>
<div class="index-hero">
<h1>质检工单 · 样本类型过滤选型</h1>
<p>
针对「细胞存储质检 / 科研捐赠质检」Tab 下的<strong>样本类型</strong>过滤条件。现网为筛选区
<code>el-select</code> 下拉框;本目录提供 6 种替代方案 HTML 原型,均可点击交互。
</p>
</div>
<div class="context-box">
<div class="context-box-inner">
<strong>现状:</strong
><code>QcWorkOrderTabPanel.vue</code> 在 <code>isInboundSampleTab</code> 时于 filter-grid
增加「样本类型」下拉,与关键词、工单状态等并列。<br />
<strong>目标:</strong>探索更直观、少占筛选栅格、或便于「一眼扫类型」的交互方式。
</div>
</div>
<div class="index-cta">
<a class="primary demo-link" href="compare-all.html">并排对比全部方案 →</a>
<a class="demo-link" href="01-baseline-dropdown.html">01 现网基线</a>
</div>
<div class="index-grid">
<a class="index-card" href="01-baseline-dropdown.html">
<h2>01 · 现网基线(下拉框)</h2>
<p>筛选栅格内 el-select,需展开下拉选择。作为对照组。</p>
<span class="tag">对照</span>
</a>
<a class="index-card" href="02-chip-strip.html">
<h2>02 · 筛选下方 Chip 条</h2>
<p>从 filter-grid 移出,横向胶囊 + 数量角标;点击即筛,无需搜索按钮。</p>
<span class="tag tag--rec">推荐</span>
</a>
<a class="index-card" href="03-segmented-track.html">
<h2>03 · Segmented 分段控件</h2>
<p>主 Tab 下方、筛选区上方;灰底轨道 + 白底激活块,B 端 Segmented 风格。</p>
<span class="tag tag--rec">推荐</span>
</a>
<a class="index-card" href="04-sub-tab-bar.html">
<h2>04 · 二级 Tab 条</h2>
<p>样本类型作为次级 Tab,带下划线与数量;与主 Tab 层级关系清晰。</p>
</a>
<a class="index-card" href="05-toolbar-chips.html">
<h2>05 · 工具栏内联 Chip</h2>
<p>与「已选 N 项 / 导出」同排,节省纵向空间;适合类型较少场景。</p>
</a>
<a class="index-card" href="06-left-rail.html">
<h2>06 · 左侧类型导航</h2>
<p>列表区左栏固定样本类型,右侧卡片流;类型多时可扫视全量。</p>
</a>
<a class="index-card" href="07-icon-cards.html">
<h2>07 · 图标卡片宫格</h2>
<p>利用样本类型 Logo/首字做卡片选择,视觉识别强;占用略多纵向空间。</p>
</a>
</div>
</body>
</html>
@@ -0,0 +1,55 @@
# 生產工單計劃開始時間篩選 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 將【生產工單】【我的生產任務】檢索區時間條件統一為工藝步驟計劃開始時間區間篩選。
**Architecture:** 後端新增共用 `apply_planned_start_time_step_filter`(EXISTS 子查詢);生產工單列表與我的任務 API 支援 `plannedStartTimeStart/End`;前端固定 label「計劃開始時間」並停止傳遞舊時間參數。
**Tech Stack:** FastAPI + SQLAlchemy(backend)、Vue 3 + TypeScript(web-admin)
---
### Task 1: 後端 Schema + 共用過濾函數
**Files:**
- Modify: `backend/app/schemas/production_work_order.py`
- Modify: `backend/app/crud/production_work_order.py`
- [ ] Schema 新增 `planned_start_time_start` / `planned_start_time_end`
- [ ] 實現 `apply_planned_start_time_step_filter(query, tenant_no, start, end, mine_user_id=None)`
- [ ] `list_production_work_orders` 在新參數有值時調用過濾函數
### Task 2: 我的任務 API 後端過濾
**Files:**
- Modify: `backend/app/crud/production_task.py`
- Modify: `backend/app/api/production.py`
- [ ] `list_production_tasks` / `list_mine_production_tasks` 支援計劃開始時間參數
- [ ] mine 場景傳入 `mine_user_id` 僅統計本人相關步驟
### Task 3: 前端 API 類型與頁面邏輯
**Files:**
- Modify: `web-admin/src/api/production-work-order.ts`
- Modify: `web-admin/src/api/production-task.ts`
- Modify: `web-admin/src/utils/production-mine-task-groups.ts`
- Modify: `web-admin/src/views/production/production-work-order/composables/useProductionWorkOrderTabPage.ts`
- Modify: `web-admin/src/views/production/production-work-order/tabs/ProductionWorkOrderTabPanel.vue`
- [ ] 傳遞 `plannedStartTimeStart/End`;重命名 `plannedStartTimeRange`
- [ ] 移除工單級 createTime/infusionTime 前端過濾
### Task 4: 清理廢棄工具函數
**Files:**
- Modify: `web-admin/src/utils/production-work-order-tabs.ts`
- [ ] 刪除 `tabUsesInfusionTimeFilter`、`filterTimeLabelForTab`(僅生產模組引用)
### Task 5: 驗證
- [ ] `python -m py_compile` 後端改動檔案
- [ ] `pnpm exec vue-tsc --noEmit` 或 lint 檢查前端
- [ ] `./scripts/update-graph.sh web-admin`(若 import 有變)
@@ -0,0 +1,37 @@
# 生产工单隐藏无效协议关联工单
## 背景
【生产工单】【我的生产任务】中,细胞存储 / 科研捐赠类入库生产工单在关联采集协议或捐赠协议进入无效态后,默认不应干扰日常列表;用户可通过检索区勾选框查看历史单据。
## 无效协议状态
与样本接收模块一致:`yzf`(已作废)、`sdfq`(属地废弃)。
常量:`INACTIVE_PROTOCOL_STATUSES = ("yzf", "sdfq")`,置于 `app/core/protocol_status_display.py`。
## 过滤规则
| 条件 | 默认勾选(隐藏) | 取消勾选 |
|------|------------------|----------|
| 入库 + 细胞存储 + 协议状态 ∈ 无效集 | 不展示 | 展示 |
| 入库 + 科研捐赠 + 协议状态 ∈ 无效集 | 不展示 | 展示 |
| 出库 / 临时 / 其他状态 | 始终展示 | 始终展示 |
| 协议缺失或状态为空 | 展示 | 展示 |
## 影响范围
- Tab:细胞存储生产、科研捐赠生产、「所有」(仅过滤列表中入库两类条目)
- 页面:生产工单(manage)、我的生产任务(mine)
- Tab 角标 / 侧栏待办:始终按默认(隐藏无效协议关联工单)统计
## 实现
- 后端 `excludeVoidProtocol` 查询参数,默认 `true`
- `list_production_work_orders`、`list_production_tasks`、`_base_active_step_count_query` 共用 SQL 过滤
- 前端检索区 `el-checkbox`,文案「不展示协议已作废或属地废弃的工单」,默认勾选
## 非目标
- 不改变工单自身 `workOrderStatus=yzf` 的筛选逻辑
- 不隐藏 `zky` / `zckc` / `ygq` 等状态
@@ -0,0 +1,180 @@
# 生產工單 / 我的生產任務:統一按工藝步驟計劃開始時間篩選
## 背景
【生產工單】與【我的生產任務】檢索區目前依 Tab 展示不同時間條件:
| Tab 類型 | 現有篩選欄位 | 資料來源 |
|----------|-------------|----------|
| 所有 / 入庫 / 臨時 | 創建時間 | `biz_production_work_order.create_time` |
| 出庫(中試服務、臨床應用) | 輸注時間 | `biz_pilot_infusion_schedule.infusion_time` |
| 出庫(基礎實驗) | 交付時間 | 同上(`infusion_time`) |
用戶希望**移除上述時間篩選**,兩個頁面、所有 Tab **統一**改為按「生產任務 → 工藝步驟 → 計劃開始時間」區間過濾。
## 目標
1. 檢索區僅保留一個日期區間控件,標籤固定為 **計劃開始時間**。
2. 列表仍按**工單卡片**展示;篩選語義為「工單下存在符合日期區間的工藝步驟」。
3. 【我的生產任務】僅統計**本人相關**步驟(見下文「本人相關步驟」定義)。
4. 卡片上的創建時間、輸注時間、交付時間等**展示欄位不變**,僅改篩選維度。
## 非目標
- 不修改卡片 meta 展示欄位(`production-work-order-card-meta.ts`)。
- 不修改 Tab 角標 / 側欄待辦統計邏輯(`tab-step-counts`)。
- 不影響質檢工單等同構模組。
- 不移除列表 API 的舊時間參數(可保留但前端不再傳遞;後端可選擇標記廢棄,本次不強制刪除以避免外部調用方報錯)。
## 資料模型
- 表:`biz_production_task_step.planned_start_time`(`DateTime`,可空)
- 前端字段:`plannedStartTime`(日期字串 `YYYY-MM-DD`)
- 比較粒度:**日期**(與現有角標 `isStepOverdueIncomplete`、派工展示一致)
## 篩選語義
### 共同規則
當用戶**未填寫**日期區間時:不施加計劃開始時間過濾(與現有「時間為空則不過濾」行為一致)。
當用戶**填寫**日期區間 `[start, end]` 時,工單命中條件為:其下存在至少一個**符合條件的工藝步驟**,且該步驟滿足:
| 條件 | 說明 |
|------|------|
| `planned_start_time IS NOT NULL` | 未排計劃的步驟不參與匹配 |
| `planned_start_time` 落在 `[start 00:00:00, end 23:59:59]` | 含起止日 |
| 所屬任務 `task_status IN ('dpz', 'jxz')` | 活躍任務 |
| 所屬工單 `work_order_status IN ('dpz', 'jxz')` | 活躍工單 |
| 步驟 `step_status != 'ywc'` | 未完成步驟 |
| `del_flag = 0` | 未刪除 |
### 【生產工單】(manage)
- 範圍:工單下**所有**符合上述共同規則的步驟(不限負責人)。
- 分頁:後端過濾 + 後端分頁(`list_production_work_orders`)。
### 【我的生產任務】(mine)— 用戶確認方案 B
僅統計**本人相關**的步驟。步驟命中需同時滿足「共同規則」與下列任一:
1. 步驟負責人列表(`biz_production_task_step_assignee`)包含當前用戶;或
2. 所屬任務的 `current_assignee_user_id` 為當前用戶。
與現有 `isMineQualifyingTask` / `_base_active_step_count_query(mine_user_id=...)` 語義對齊。
工單展示:若工單下存在至少一個「本人相關且日期命中」的步驟,則展示該工單卡片(卡片內任務子列表仍展示該用戶相關任務,不因日期篩選隱藏單個任務行)。
## API 變更
### 新增查詢參數
| 參數 | 類型 | 說明 |
|------|------|------|
| `plannedStartTimeStart` | `string?` | 計劃開始日期下限 `YYYY-MM-DD` |
| `plannedStartTimeEnd` | `string?` | 計劃開始日期上限 `YYYY-MM-DD` |
### 涉及端點
| 端點 | 變更 |
|------|------|
| `GET /web/admin/production-work-orders` | 支援新參數;前端改傳新參數,不再傳 `createTimeStart/End`、`infusionTimeStart/End` |
| `GET /web/admin/production-tasks/mine` | 支援新參數;後端在任務列表查詢階段過濾(減少全量拉取) |
### Schema
- `ProductionWorkOrderListQuery` 新增 `planned_start_time_start` / `planned_start_time_end`。
- `list_production_tasks` / `list_mine_production_tasks` 新增同名參數。
## 後端實現
### 共用過濾函數
新增 `apply_planned_start_time_step_filter(query, *, start, end, mine_user_id=None)`:
- 輸入:已 join 或可 join `BizProductionWorkOrder` 的查詢。
- 實現:`EXISTS` 子查詢,關聯 `BizProductionTask` → `BizProductionTaskStep`(及 `mine` 時的 `BizProductionTaskStepAssignee`)。
- `mine_user_id` 非空時追加本人相關 OR 條件。
### 生產工單列表
在 `list_production_work_orders` 的 `_filtered()` 中:
- **移除**對 `create_time` / `infusion_time` 的篩選分支(當新參數存在時以新參數為準;舊參數前端不再傳遞)。
- 當 `planned_start_time_start` 或 `planned_start_time_end` 有值時,調用共用過濾函數。
### 我的任務列表
在 `list_production_tasks` / `list_mine_production_tasks` 的 `_filtered()` 中:
- 當新參數有值時,僅保留任務所屬工單下存在「本人相關且日期命中」步驟的任務。
- 保持 `include_step_summary=true` 行為不變。
## 前端實現
### UI
- `ProductionWorkOrderTabPanel.vue`:日期控件 label 固定為「計劃開始時間」;移除 `:label="filterTimeLabel"` 動態綁定。
- 內部狀態:`createTimeRange` 重命名為 `plannedStartTimeRange`(語義清晰)。
### 邏輯
- `useProductionWorkOrderTabPage.ts`:
- manage:組裝 `plannedStartTimeStart/End` 調用 `fetchProductionWorkOrderList`。
- mine:組裝同名參數傳入 `fetchAllMineProductionTasks` → `fetchMyProductionTasks`。
- `production-mine-task-groups.ts`:
- `MineWorkOrderSearchFilters` 移除 `createTimeStart/End`、`infusionTimeStart/End`。
- `filterMineEntriesByWorkOrderSearch` 移除工單級 createTime/infusionTime 過濾(改由 API 或統一 helper 按步驟過濾)。
- 若 API 已過濾,前端工單級二次過濾可簡化為 no-op(保留防禦性步驟級校驗可選)。
### 清理
- `production-work-order-tabs.ts`:刪除或廢棄 `filterTimeLabelForTab`、`tabUsesInfusionTimeFilter`(無引用後移除)。
- `production-work-order.ts` API 類型:新增 `plannedStartTimeStart/End`。
## 邊界情況
| 場景 | 行為 |
|------|------|
| 未填日期 | 不過濾,列表與現狀一致(除已移除的舊時間條件) |
| 步驟無計劃開始時間 | 設了日期區間時不命中 |
| 工單已完成(`ywc`) | 不參與計劃開始時間匹配(活躍工單條件排除) |
| 我的任務:本人無相關步驟 | 工單不展示 |
| 我的任務:本人有相關步驟但計劃時間不在區間 | 工單不展示 |
## 測試要點
### 生產工單
1. 各 Tab(所有、入庫、出庫、臨時)檢索區均顯示「計劃開始時間」,無創建/輸注/交付時間標籤。
2. 設日期區間後,僅展示存在活躍未完成步驟且 `planned_start_time` 落在區間內的工單。
3. 分頁 total 與列表一致(後端過濾)。
4. 重置清空日期並恢復全量(在其他條件不變前提下)。
### 我的生產任務
1. 僅當**本人負責**(步驟負責人或任務當前負責人)的步驟計劃開始時間命中時,工單才出現。
2. 他人負責步驟的計劃時間在區間內、本人步驟不在區間內 → 工單不出現。
3. 與任務狀態、工單狀態、關鍵詞等篩選可組合使用。
## 影響檔案清單
| 層級 | 檔案 |
|------|------|
| 文檔 | 本文件 |
| 後端 Schema | `backend/app/schemas/production_work_order.py` |
| 後端 CRUD | `backend/app/crud/production_work_order.py`、`backend/app/crud/production_task.py` |
| 後端 API | `backend/app/api/production.py` |
| 前端 API | `web-admin/src/api/production-work-order.ts`、`web-admin/src/api/production-task.ts` |
| 前端工具 | `web-admin/src/utils/production-work-order-tabs.ts`、`web-admin/src/utils/production-mine-task-groups.ts` |
| 前端頁面 | `web-admin/src/views/production/production-work-order/composables/useProductionWorkOrderTabPage.ts`、`web-admin/src/views/production/production-work-order/tabs/ProductionWorkOrderTabPanel.vue` |
## 決策記錄
| 議題 | 決策 |
|------|------|
| 我的任務篩選範圍 | **B**:僅本人相關步驟(步驟負責人或任務當前負責人) |
| 列表展示粒度 | 工單級卡片,不按步驟拆行 |
| 納入步驟範圍 | 活躍工單 + 活躍任務 + 未完成步驟 + 有計劃開始時間 |
| 實作路徑 | 後端統一過濾(生產工單必須;我的任務 API 同步支援) |
| 舊時間參數 | 前端停止傳遞;後端保留相容,本次不刪除 |