feat: 移除租户选择功能

- 删除登录页面的租户选择下拉框
- 移除租户切换组件及其相关逻辑
This commit is contained in:
fhysy 2025-09-29 09:05:12 +08:00
parent 019029f3ce
commit df397ba648
2 changed files with 29 additions and 31 deletions

View File

@ -16,7 +16,6 @@ import { useAccessStore, useUserStore } from '@vben/stores';
import { message } from 'ant-design-vue';
import { TenantToggle } from '#/components/tenant-toggle';
import { $t } from '#/locales';
import { resetRoutes } from '#/router';
import { useAuthStore, useNotifyStore } from '#/store';
@ -127,9 +126,9 @@ watch(
<template>
<BasicLayout @clear-preferences-and-logout="handleLogout">
<template #header-right-1>
<!-- <template #header-right-1>
<TenantToggle />
</template>
</template> -->
<template #user-dropdown>
<UserDropdown
:avatar

View File

@ -7,7 +7,6 @@ import type { CaptchaResponse } from '#/api/core/captcha';
import { computed, onMounted, ref, useTemplateRef } from 'vue';
import { AuthenticationLogin, z } from '@vben/common-ui';
import { DEFAULT_TENANT_ID } from '@vben/constants';
import { $t } from '@vben/locales';
import { omit } from 'lodash-es';
@ -16,7 +15,7 @@ import { tenantList } from '#/api';
import { captchaImage } from '#/api/core/captcha';
import { useAuthStore } from '#/store';
import { useLoginTenantId } from '../oauth-common';
// import { useLoginTenantId } from '../oauth-common';
import OAuthLogin from './oauth-login.vue';
defineOptions({ name: 'Login' });
@ -68,35 +67,35 @@ onMounted(async () => {
await Promise.all([loadCaptcha(), loadTenant()]);
});
const { loginTenantId } = useLoginTenantId();
// const { loginTenantId } = useLoginTenantId();
const formSchema = computed((): VbenFormSchema[] => {
return [
{
component: 'VbenSelect',
componentProps: {
class: 'bg-background h-[40px] focus:border-primary',
contentClass: 'max-h-[256px] overflow-y-auto',
options: tenantInfo.value.voList?.map((item) => ({
label: item.companyName,
value: item.tenantId,
})),
placeholder: $t('authentication.selectAccount'),
},
defaultValue: DEFAULT_TENANT_ID,
dependencies: {
if: () => tenantInfo.value.tenantEnabled,
// watch
trigger: (model) => {
// oauth使
loginTenantId.value = model?.tenantId ?? DEFAULT_TENANT_ID;
},
triggerFields: ['', 'tenantId'],
},
fieldName: 'tenantId',
label: $t('authentication.selectAccount'),
rules: z.string().min(1, { message: $t('authentication.selectAccount') }),
},
// {
// component: 'VbenSelect',
// componentProps: {
// class: 'bg-background h-[40px] focus:border-primary',
// contentClass: 'max-h-[256px] overflow-y-auto',
// options: tenantInfo.value.voList?.map((item) => ({
// label: item.companyName,
// value: item.tenantId,
// })),
// placeholder: $t('authentication.selectAccount'),
// },
// defaultValue: DEFAULT_TENANT_ID,
// dependencies: {
// if: () => tenantInfo.value.tenantEnabled,
// // watch
// trigger: (model) => {
// // oauth使
// loginTenantId.value = model?.tenantId ?? DEFAULT_TENANT_ID;
// },
// triggerFields: ['', 'tenantId'],
// },
// fieldName: 'tenantId',
// label: $t('authentication.selectAccount'),
// rules: z.string().min(1, { message: $t('authentication.selectAccount') }),
// },
{
component: 'VbenInput',
componentProps: {