Commit 6c7bc274 authored by Data Governance Dev's avatar Data Governance Dev

fix(web): 冗余字段 tab 永远停在「分析中」— TAB_STEP_MAP.sectionKey 用错了

症状:分析完成后所有 tab 都显示「分析完成」徽章,但「冗余字段」
tab 一直停在「分析中」,即使 sections.merge_candidates.redundancy_fields
实际有 21 条数据。

根因:移除 Step 3「数据验证」前,Step 3 返回 section_key='redundancy_fields',
所以 sections.redundancy_fields 直接有数据。移除后没人再写这个顶层 key,
数据落在 sections.merge_candidates.redundancy_fields(Step 2 输出
嵌套在 merge_candidates 里)。

修复:TAB_STEP_MAP 支持 field 字段处理嵌套场景:
  redundancy: { step: 2, sectionKey: 'merge_candidates', field: 'redundancy_fields' }

tabStatus computed 检查改为先取顶层 section、再按 field 取子字段:
  const section = sections[sectionKey];
  const hasData = field ? (section && section[field]) : !!section;

行为:
- merge tab 还是查 sections.merge_candidates 整体
- redundancy tab 现在查 sections.merge_candidates.redundancy_fields
- 其他 tab 逻辑不变
parent cc494bca
...@@ -770,10 +770,11 @@ ...@@ -770,10 +770,11 @@
const jobResult = ref(null); const jobResult = ref(null);
const activeTab = ref('merge'); const activeTab = ref('merge');
// tab → (所属 step, 对应 sections 里的 key) // tab → (所属 step, 对应 sections 里的 key,可选 field 处理嵌套场景)
// 例如 redundancy 实际数据在 sections.merge_candidates.redundancy_fields 里
const TAB_STEP_MAP = { const TAB_STEP_MAP = {
merge: { step: 2, sectionKey: 'merge_candidates' }, merge: { step: 2, sectionKey: 'merge_candidates' },
redundancy: { step: 2, sectionKey: 'redundancy_fields' }, // 冗余字段与合并候选同步骤(都来自 Step 2) redundancy: { step: 2, sectionKey: 'merge_candidates', field: 'redundancy_fields' },
empty: { step: 3, sectionKey: 'empty_fields' }, empty: { step: 3, sectionKey: 'empty_fields' },
missing: { step: 4, sectionKey: 'missing_comments' }, missing: { step: 4, sectionKey: 'missing_comments' },
length: { step: 5, sectionKey: 'length_issues' }, length: { step: 5, sectionKey: 'length_issues' },
...@@ -785,14 +786,15 @@ ...@@ -785,14 +786,15 @@
const sections = jobResult.value?.sections || {}; const sections = jobResult.value?.sections || {};
const out = {}; const out = {};
for (const tab of Object.keys(TAB_STEP_MAP)) { for (const tab of Object.keys(TAB_STEP_MAP)) {
const { step, sectionKey } = TAB_STEP_MAP[tab]; const { step, sectionKey, field } = TAB_STEP_MAP[tab];
if (!planned.has(step)) { if (!planned.has(step)) {
out[tab] = 'idle'; out[tab] = 'idle';
} else if (sections[sectionKey]) { continue;
out[tab] = 'done';
} else {
out[tab] = 'running';
} }
// 兼容嵌套:先取顶层 section,再按 field 取子字段
const section = sections[sectionKey];
const hasData = field ? (section && section[field]) : !!section;
out[tab] = hasData ? 'done' : 'running';
} }
return out; return out;
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment