feat(qa-ops): 默认本周快捷查询并全量展示固定字段
build / build (push) Successful in 1m1s

新增本周直接查询按钮,所选范围自动分批读取并校验总数、重复与游标完整性;删除手动加载更多,固定展示完整字段,空列不隐藏,不伪造译文或评估。

验证:全量、固定列及本周入口回归先红后绿;完整make verify通过,前端273通过;真实只读源浏览器默认及快捷查询均639条全部唯一展示,14必需字段按序,右侧字段可达、手机无外溢、JS异常0。无新增迁移或源库写入。
This commit is contained in:
姚章浩
2026-10-18 16:32:16 +08:00
parent 3566f208e0
commit 90901a4458
8 changed files with 193 additions and 44 deletions
+34 -1
View File
@@ -259,6 +259,35 @@ export async function fetchQARecords(query: QAQuery, signal?: AbortSignal): Prom
})
return parseQARecordPage(await getPayload(`/api/v1/qa-ops/records?${parameters}`, signal))
}
export async function fetchAllQARecords(
query: QAQuery,
signal?: AbortSignal,
onProgress?: (loaded: number, total: number) => void
): Promise<QARecordPage> {
if (signal?.aborted) throw new DOMException('读取已取消', 'AbortError')
let page = await fetchQARecords({ ...query, cursor: '', limit: 100 }, signal)
const total = page.total
const ids = new Set(page.items.map((item) => item.id))
const cursors = new Set<string>()
onProgress?.(ids.size, total)
while (page.has_more) {
if (signal?.aborted) throw new DOMException('读取已取消', 'AbortError')
const cursor = page.next_cursor
if (cursors.has(cursor) || ids.size >= total) throw new Error('全量读取游标异常,请重新查询')
cursors.add(cursor)
const next = await fetchQARecords({ ...query, cursor, limit: 100 }, signal)
if (next.total !== total) throw new Error('查询总数已变化,请重新查询,未将部分记录当作全部结果')
for (const item of next.items) {
if (ids.has(item.id)) throw new Error('全量读取出现重复记录,请重新查询')
ids.add(item.id)
}
page = mergeQAPages(page, next)
onProgress?.(ids.size, total)
}
if (ids.size !== total) throw new Error('全量读取数量不完整,请重试,未将部分记录当作全部结果')
return page
}
export async function fetchQARecord(id: string, signal?: AbortSignal): Promise<QARecord> {
return parseQARecord(await getPayload(`/api/v1/qa-ops/records/${encodeURIComponent(id)}`, signal))
}
@@ -283,6 +312,9 @@ export async function fetchQAStatus(signal?: AbortSignal): Promise<QAStatus> {
}
export function qaCellValue(item: QARecord, column: QAColumn): string | null {
if (column === 'question_chinese')
return item.question_chinese || (/\p{Script=Han}/u.test(item.question) ? item.question : '待翻译')
if (column === 'language') return item.language || '未识别'
const f = item.quality?.effective
if (f) {
if (column === 'coverage')
@@ -309,6 +341,7 @@ export function qaCellValue(item: QARecord, column: QAColumn): string | null {
if (item.feedback.up || item.feedback.down) return `其他人:赞 ${item.feedback.up} / 踩 ${item.feedback.down}`
return null
}
if (column === 'asked_at') return new Date(item.asked_at).toLocaleString('zh-CN', { hour12: false })
if (column === 'asked_at')
return new Date(item.asked_at).toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai', hour12: false })
return item[column] || null
}