+ {(() => {
+ /* 找到 DWD 表过滤应插入的位置:ODS 之后、DWS/INDEX 之前 */
+ const hasDwdLayer = group.layerTasks.some((lt) => lt.layer === "DWD");
+ const shouldInsertDwd = !hasDwdLayer && group.dwdTables.length > 0 && showDwdFilter;
+ /* 插入点:第一个 DWS/INDEX/UTILITY 层之前,若全是 ODS 则在末尾 */
+ const insertIdx = shouldInsertDwd
+ ? group.layerTasks.findIndex((lt) => (LAYER_ORDER[lt.layer] ?? 99) >= (LAYER_ORDER["DWS"] ?? 2))
+ : -1;
+ const effectiveInsertIdx = shouldInsertDwd && insertIdx === -1 ? group.layerTasks.length : insertIdx;
+
+ const elements: React.ReactNode[] = [];
+ group.layerTasks.forEach((lt, idx) => {
+ /* 在此位置插入 DWD 表过滤 */
+ if (shouldInsertDwd && idx === effectiveInsertIdx) {
+ elements.push(
+
+ {elements.length > 0 &&
}
+
+ DWD 装载
+
+ {renderDwdTableFilter(group.dwdTables)}
+
,
+ );
+ }
+ elements.push(
+
+ {elements.length > 0 &&
}
+
+
+ {LAYER_LABELS[lt.layer] ?? lt.layer}
+
+
+
+ {lt.tasks.map((t) => (
+
+ handleTaskToggle(t.code, e.target.checked)}
+ >
+ {t.code}
+ {t.name}
+ {!t.is_common && 不常用}
+
+
+ ))}
+
+ {/* DWD 表过滤紧跟 DWD 层任务 */}
+ {lt.layer === "DWD" && renderDwdTableFilter(group.dwdTables)}
+
,
+ );
+ });
+ /* 所有层遍历完后,若插入点在末尾 */
+ if (shouldInsertDwd && effectiveInsertIdx >= group.layerTasks.length) {
+ elements.push(
+
+ {elements.length > 0 &&
}
+
+ DWD 装载
+
+ {renderDwdTableFilter(group.dwdTables)}
+
,
+ );
+ }
+ return elements;
+ })()}
+
),
};
})}
/>
- {/* DWD 表过滤:仅在 DWD 层且 DWD_LOAD_FROM_ODS 被选中时显示 */}
- {showDwdFilter && dwdLoadSelected && allDwdTableNames.length > 0 && (
- <>
-