|
|
@@ -246,6 +246,14 @@ const stageMeta = computed<StageMeta[]>(() => {
|
|
|
|
|
|
const effectiveCategoryDefs = computed(() => pageConfig.effectiveCategoryDefs(CATEGORY_DEFS_FALLBACK));
|
|
|
|
|
|
+// page-config 派生的 moduleCode → sort 索引;driver 已按 sort_no 升序返回,索引即为顺序。
|
|
|
+// 未在 page-config 中出现的 moduleCode 由 compareModuleCode 排到最后并按字符串稳定兜底。
|
|
|
+const overviewModuleOrderMap = computed<Map<string, number>>(() => {
|
|
|
+ const map = new Map<string, number>();
|
|
|
+ stageMeta.value.forEach((m, idx) => map.set(m.code, idx));
|
|
|
+ return map;
|
|
|
+});
|
|
|
+
|
|
|
async function loadPageConfig() {
|
|
|
await pageConfig.load();
|
|
|
}
|
|
|
@@ -672,12 +680,12 @@ function onBlockOrderUpdate(code: string, order: string[]) {
|
|
|
}
|
|
|
|
|
|
function compareModuleCode(a: { moduleCode: string }, b: { moduleCode: string }) {
|
|
|
- return extractCodeOrder(a.moduleCode) - extractCodeOrder(b.moduleCode);
|
|
|
-}
|
|
|
-
|
|
|
-function extractCodeOrder(code: string) {
|
|
|
- const matched = code.match(/\d+/);
|
|
|
- return matched ? Number(matched[0]) : Number.MAX_SAFE_INTEGER;
|
|
|
+ const map = overviewModuleOrderMap.value;
|
|
|
+ const ai = map.has(a.moduleCode) ? (map.get(a.moduleCode) as number) : Number.MAX_SAFE_INTEGER;
|
|
|
+ const bi = map.has(b.moduleCode) ? (map.get(b.moduleCode) as number) : Number.MAX_SAFE_INTEGER;
|
|
|
+ if (ai !== bi) return ai - bi;
|
|
|
+ // 两侧均未命中(或并列)时按字符串字典序兜底,保证排序稳定。
|
|
|
+ return a.moduleCode.localeCompare(b.moduleCode);
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|