From 5b41d2b23dec2fcaae60e3bbaa8448bbcdb828dd Mon Sep 17 00:00:00 2001 From: tangweijie <877588133@qq.com> Date: Wed, 28 Jan 2026 10:46:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=9A=84ElMessage=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 EvaluationTemplateForm.vue 中 message 未定义的问题 --- src/config/axios/service.ts | 7 +++---- src/views/Login/components/LoginForm.vue | 4 ++++ .../evaluation-mgmt/template/EvaluationTemplateForm.vue | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/config/axios/service.ts b/src/config/axios/service.ts index bea2d0fc..6229012f 100644 --- a/src/config/axios/service.ts +++ b/src/config/axios/service.ts @@ -70,10 +70,9 @@ service.interceptors.request.use( } } // 监狱系统:即使 tenantEnable 为 false,也尝试获取并设置租户 ID - const tenantId = getTenantId() - if (tenantId) { - config.headers['tenant-id'] = tenantId - } + // 如果缓存中没有租户 ID,使用默认值 1 + const tenantId = getTenantId() || 1 + config.headers['tenant-id'] = tenantId const method = config.method?.toUpperCase() // 防止 GET 请求缓存 if (method === 'GET') { diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index ba70b422..20444ac4 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -351,6 +351,10 @@ watch( onMounted(() => { getLoginFormCache() getTenantByWebsite() + // 初始化租户 ID - 确保登录前缓存中有租户 ID + if (!authUtil.getTenantId()) { + authUtil.setTenantId(Number(loginData.loginForm.tenantName) || 1) + } }) diff --git a/src/views/prison/evaluation-mgmt/template/EvaluationTemplateForm.vue b/src/views/prison/evaluation-mgmt/template/EvaluationTemplateForm.vue index c1dabd55..8fff5a9f 100644 --- a/src/views/prison/evaluation-mgmt/template/EvaluationTemplateForm.vue +++ b/src/views/prison/evaluation-mgmt/template/EvaluationTemplateForm.vue @@ -77,6 +77,7 @@