数据目录闭环(前端)复查修正:导入预览里跳过的项写界面上的说法(「列 gate_code 的中文名」),关联关系照编号写;check-catalog-loop 切视图的那一条等清单真的换回来再断言

This commit is contained in:
ThearchyHelios
2026-10-14 08:54:04 +08:00
parent bc4ea277e9
commit 41012b1b83
2 changed files with 10 additions and 4 deletions
@@ -8,7 +8,7 @@ import { Modal, Notice, Spinner } from '../../components/ui'
import { errorMessage } from '../../lib/errors'
import { formatDateTime, formatNumber } from '../../lib/format'
import { CATALOG_TRANSFER_TEXT as T } from '../../lib/terms'
import { patchValueText } from '../../run/catalogPatch'
import { patchTarget, patchValueText, patchWhere } from '../../run/catalogPatch'
// ===========================================================================
// 导入数据目录(数据目录页的「导入目录」):选文件 → 预览(只读:对上了哪些表,各有几项新增、更新、保留、冲突、跳过,
@@ -30,6 +30,12 @@ interface Chosen {
const COUNT_KEYS = ['add', 'update', 'keep', 'conflicts', 'skipped'] as const
/** 跳过的那一项写成界面上的说法(「列 gate_code 的中文名」);关联关系只有编号,照原样写 */
const pathText = (path: string) => {
const t = patchTarget(path)
return t && t.kind !== 'relation' ? patchWhere({ path, before: null, after: null }) : path
}
export function ImportDialog({ sourceId, onClose, onImported }: {
sourceId: string
onClose: () => void
@@ -245,7 +251,7 @@ function ReportView({ report, done = false }: { report: CatalogImportReport; don
<ul className="divide-y divide-[var(--hairline)] rounded-md border">
{skipped.map(({ t, s }) => (
<li key={`${t.table_name}:${s.path}`} className="px-2.5 py-1.5 text-2xs leading-relaxed text-dim" data-import-skipped={`${t.table_name}:${s.path}`}>
<span className="mono text-faint">{t.table_name} · {s.path}</span>:{s.why}
<span className="text-faint"><span className="mono">{t.table_name}</span> · {pathText(s.path)}</span>:{s.why}
</li>
))}
</ul>
+2 -2
View File
@@ -941,7 +941,7 @@ await section('审阅队列 · 视图、顺序与原因、筛选、进度', asyn
check('表清单的概览里也有「打开审阅队列」', queueText === '打开审阅队列' && await until(async () => new URL(page.url()).searchParams.get('view') === 'review'
&& (await page.locator('[data-catalog-view-tab="review"]').getAttribute('aria-selected')) === 'true'), `${queueText} · ${page.url()}`)
await page.locator('[data-catalog-view-tab="review"]').press('ArrowLeft')
check('视图标签可以用方向键切换', await until(async () => !new URL(page.url()).searchParams.get('view'))
check('视图标签可以用方向键切换', await until(async () => !new URL(page.url()).searchParams.get('view') && page.locator('[data-catalog-list]').isVisible())
&& await page.evaluate(() => document.activeElement?.getAttribute('data-catalog-view-tab') === 'list'))
await shot(page, 'catalog-review')
await cleanCopy(page, '审阅队列')
@@ -1072,7 +1072,7 @@ await section('导出导入 · 导出文件、导入先预览再写入', async (
const conflict = await textOf(dlg.locator('[data-import-conflict]'))
check('……冲突逐条列出:位置、文件中的值、这里的值、原因', conflict.includes('表的中文名') && conflict.includes('入园流水') && conflict.includes('入园记录')
&& conflict.includes('这里已确认,以这里为准'), conflict)
check('……跳过的写原因,对不上的表列出来', (await textOf(dlg.locator('[data-import-skipped]'))).includes('表结构里没有列 gate_code')
check('……跳过的写界面上的说法和原因,对不上的表列出来', (await textOf(dlg.locator('[data-import-skipped]'))).includes('列 gate_code 的中文名:表结构里没有列 gate_code')
&& (await textOf(dlg.locator('[data-import-unmatched]'))).includes('legacy_tickets'))
check('……起草要求:这里已有,保留不覆盖', (await textOf(dlg.locator('[data-import-guidance-action]'))).includes('保留这个数据源现有的'))
check('……预览不写库', count(sent, /catalog\/import$/) === 0)