feat(qa): 问题流水表首列增加连续序号
build / build (push) Successful in 1m14s

序号按当前筛选范围的位置计算,不写业务记录或改变导出字段。
后台续载和虚拟滚动沿用绝对索引,空结果/占位行同步列数。
验证:序号首列/连续性/占位与aria行数红绿通过;完整本地门禁及原生备份恢复通过。
This commit is contained in:
姚章浩
2026-10-25 14:23:34 +08:00
parent 09b2c1dce5
commit 5d525ff592
4 changed files with 32 additions and 4 deletions
+6
View File
@@ -76,6 +76,12 @@
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
## 开发快照 snapshot/v0.1.58 - 2026-10-25
### Changed
- 问题流水表最左侧增加序号,按当前筛选结果从1连续编号,后台续载与虚拟滚动保持连续;不改变业务字段、原始数据或完整导出口径。
## 开发快照 snapshot/v0.1.57 - 2026-10-25
### Changed
+12
View File
@@ -64,6 +64,18 @@ describe('QA operations workbench', () => {
}
})
it('adds a leading serial column without changing business fields or virtual spacer geometry', () => {
const many = Array.from({ length: 200 }, (_, index) => ({ ...item, id: 'row-' + index }))
const html = renderToStaticMarkup(<QAOperationsView {...props} page={{ ...page, items: many, total: 200 }} />)
expect(html).toMatch(/<thead><tr><th[^>]*>序号<\/th><th>中文问题<\/th>/)
expect(html).toMatch(/data-qa-row="row-0"[^>]*><td[^>]*>1<\/td>/)
const rows = [...html.matchAll(/data-qa-row="row-(\d+)"[^>]*><td[^>]*>(\d+)<\/td>/g)]
expect(rows.length).toBeGreaterThan(1)
for (const row of rows) expect(Number(row[2])).toBe(Number(row[1]) + 1)
expect(html).toContain('colSpan="17"')
expect(html).toContain('aria-rowcount="201"')
})
it('keeps the first rows interactive while later batches load or fail', () => {
const prefix = { ...page, total: 2, has_more: true, next_cursor: 'next' }
const loading = renderToStaticMarkup(<QAOperationsView {...props} page={prefix} loading={true} />)
+9 -4
View File
@@ -97,6 +97,7 @@ const QARow = memo(
if (!(event.target as HTMLElement).closest('button,a,input,select,textarea,summary')) onSelect(item.id)
}}
>
<td className="qa-ops-index">{rowIndex - 1}</td>
{qaColumns.map(({ key }) => (
<td
key={key}
@@ -237,9 +238,10 @@ export function QAOperationsView(props: ViewProps) {
<table
className="qa-ops-table"
aria-rowcount={items.length + 1}
style={{ width: qaColumns.reduce((sum, c) => sum + ledgerColumnWidth(c.key), 160) }}
style={{ width: qaColumns.reduce((sum, c) => sum + ledgerColumnWidth(c.key), 224) }}
>
<colgroup>
<col style={{ width: 64 }} />
{qaColumns.map((c) => (
<col key={c.key} style={{ width: ledgerColumnWidth(c.key) }} />
))}
@@ -247,6 +249,9 @@ export function QAOperationsView(props: ViewProps) {
</colgroup>
<thead>
<tr>
<th scope="col" className="qa-ops-index">
序号
</th>
{columns.map(({ key, label }) => (
<th key={key}>
{props.onFiltersChange && editableFieldKeys.includes(key as EditableField) ? (
@@ -267,14 +272,14 @@ export function QAOperationsView(props: ViewProps) {
<tbody>
{!items.length && page && !props.loading && !props.error ? (
<tr>
<td colSpan={columns.length + 1} className="qa-ops-empty">
<td colSpan={columns.length + 2} className="qa-ops-empty">
没有符合条件的问答,请调整表头筛选、时间范围或关键词。
</td>
</tr>
) : null}
{visible.padTop > 0 ? (
<tr aria-hidden="true" className="qa-ledger-spacer">
<td colSpan={columns.length + 1} style={{ height: visible.padTop }} />
<td colSpan={columns.length + 2} style={{ height: visible.padTop }} />
</tr>
) : null}
{items.slice(visible.start, visible.end).map((item, index) => {
@@ -292,7 +297,7 @@ export function QAOperationsView(props: ViewProps) {
})}
{visible.padBottom > 0 ? (
<tr aria-hidden="true" className="qa-ledger-spacer">
<td colSpan={columns.length + 1} style={{ height: visible.padBottom }} />
<td colSpan={columns.length + 2} style={{ height: visible.padBottom }} />
</tr>
) : null}
</tbody>
+5
View File
@@ -294,6 +294,11 @@
table-layout: fixed;
font-size: 13px;
}
.qa-ops-table .qa-ops-index {
text-align: right;
color: var(--ink-mute);
font-variant-numeric: tabular-nums;
}
.qa-ops-table th {
position: sticky;
top: 0;