feat: 新增租户切换组件和css目录优化
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ComponentSize } from "@/enums/settings/layout-enum";
|
||||
import { ComponentSize } from "@/enums/settings";
|
||||
import { useAppStore } from "@/store/modules/app-store";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
35
src/components/TenantSwitcher/index.vue
Normal file
35
src/components/TenantSwitcher/index.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<el-select
|
||||
v-if="tenantList.length > 0"
|
||||
v-model="currentTenantIdRef"
|
||||
placeholder="选择租户"
|
||||
style="width: 180px"
|
||||
@change="onChange"
|
||||
>
|
||||
<el-option v-for="item in tenantList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { useTenantStoreHook } from "@/store/modules/tenant-store";
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "change", tenantId: number): void;
|
||||
}>();
|
||||
|
||||
const tenantStore = useTenantStoreHook();
|
||||
|
||||
const tenantList = computed(() => tenantStore.tenantList);
|
||||
|
||||
const currentTenantIdRef = computed<number | null>({
|
||||
get: () => tenantStore.currentTenantId,
|
||||
set: (val) => {
|
||||
tenantStore.currentTenantId = val;
|
||||
},
|
||||
});
|
||||
|
||||
function onChange(tenantId: number) {
|
||||
emit("change", tenantId);
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user