diff --git a/admin-frontend-vue/src/layout/CompanyTabs.vue b/admin-frontend-vue/src/layout/CompanyTabs.vue index 903af7ee5..3116ec41f 100644 --- a/admin-frontend-vue/src/layout/CompanyTabs.vue +++ b/admin-frontend-vue/src/layout/CompanyTabs.vue @@ -12,7 +12,16 @@ const session = useAdminSessionStore() const tabs = computed(() => tab.companies.filter((c) => c.status === COMPANY_STATUS_ACTIVE)) const show = computed(() => tab.visibleForOperator) -watch(() => session.isSuperAdmin, (v) => { if (v) void tab.initialize() }, { immediate: true }) +watch(() => session.isSuperAdmin, (v) => { + if (!v) return + // 2026-10-05 修复轮 1:改前这里是 `void tab.initialize()`,store 里也只有 try/finally ⇒ + // GET /companies 抛错时异常变成 unhandled rejection(全仓 src 无 errorHandler/unhandledrejection 兜底), + // 现场只剩"tab 条没画出来",Task 13 人工清单第一项无从判断是权限问题还是接口挂了。 + // 取不到目录 ⇒ fail-closed 不画 tab 条:store 不翻转 loaded,visibleForOperator 仍为 false,观感与改前一致。 + // store 照 admin-session.ts:37-39 的口径 catch 出 error 之后仍然 rethrow,所以这一侧必须 .catch 接住。 + // 只写 console.warn:不许在模板里长出任何新的用户可见文字/提示条/图标(§12 第 5 条未批的暴露)。 + tab.initialize().catch((error: unknown) => console.warn('[company-tab] 公司目录没取到,tab 条不渲染', error)) +}, { immediate: true })