fix(data-process): 补齐原文参照与详情统计

This commit is contained in:
caoxiaozhu
2026-07-24 16:30:29 +08:00
parent 994ec6644a
commit b2c570f607
8 changed files with 249 additions and 28 deletions

View File

@@ -86,15 +86,17 @@ for (const component of expectedComponents) {
const typesPath = path.join(createDir, 'types.ts')
const modelPath = path.join(createDir, 'previewModel.ts')
const pdfViewerPath = path.join(createDir, 'PdfSourceViewer.vue')
const resultEditorPath = path.join(createDir, 'ResultEditorStep.vue')
assert.ok(existsSync(typesPath), '缺少向导类型定义')
assert.ok(existsSync(modelPath), '缺少来源映射模型')
assert.ok(existsSync(pdfViewerPath), '缺少 PDF 原文件预览组件')
const [typesSource, modelSource, previewSource, pdfViewerSource] = await Promise.all([
const [typesSource, modelSource, previewSource, pdfViewerSource, resultEditorSource] = await Promise.all([
readFile(typesPath, 'utf8'),
readFile(modelPath, 'utf8'),
readFile(path.join(createDir, 'PreviewCompareStep.vue'), 'utf8'),
readFile(pdfViewerPath, 'utf8'),
readFile(resultEditorPath, 'utf8'),
])
for (const field of ['sourceStart', 'sourceEnd', 'originalContent', 'editedContent']) {
@@ -307,6 +309,14 @@ assert.match(viewSource, /function goToStep\(stepId: StepId\)[\s\S]*?WIZARD_STEP
assert.match(viewSource, /currentStepId\.value === 'preview'[\s\S]*?goToStep\('generate'\)/, '数据预览步骤没有进入开始生成')
assert.match(viewSource, /generation\.status === 'success'[\s\S]*?goToStep\('results'\)/, '生成成功后没有进入结果编辑与保存')
assert.match(viewSource, /<ResultEditorStep\s+[\s\S]*?v-else-if="currentStepId === 'results'"/, '结果编辑器必须只在结果步骤渲染')
assert.match(viewSource, /<ResultEditorStep[\s\S]*?:preview-items="previewItems"/, '结果编辑器没有接收已有预览原文')
assert.match(typesSource, /previewItemId: string \| null/, '结果项缺少预览原文关联 ID')
assert.match(generationSource, /previewItemId:\s*item\.preview_item_id == null \? null : String\(item\.preview_item_id\)/, '结果映射丢失 preview_item_id')
assert.match(resultEditorSource, /previewItems: PreviewItem\[\]/, '结果编辑器缺少原文列表契约')
assert.match(resultEditorSource, /props\.previewItems\.find\(\(item\) => item\.id === previewItemId\)/, '结果编辑器没有按 preview_item_id 关联原文')
assert.match(resultEditorSource, /editedContent\.trim\(\)[\s\S]*?originalContent\.trim\(\)/, '原文参照没有优先展示实际用于生成的预处理内容')
assert.match(resultEditorSource, /原文参照/, '结果编辑器缺少原文参照区域')
assert.match(resultEditorSource, /实际送入模型的预处理后原文/, '结果编辑器没有说明原文参照口径')
assert.match(viewSource, /watch\(processType,[\s\S]*?resetSourceDataForProcessTypeChange\(\)/, '切换处理类型后没有失效旧源数据')
assert.match(viewSource, /function resetSourceDataForProcessTypeChange\(\)[\s\S]*?uploadedFiles\.value = \[\][\s\S]*?selectedPreviewFileId\.value = null/, '旧源数据失效没有同步清理文件与预览选择')