9 changed files with 59 additions and 5 deletions
@ -0,0 +1,39 @@ |
|||||||
|
<template> |
||||||
|
<Select v-model:value="state.value" |
||||||
|
:options="state.options" |
||||||
|
:filterOption="filterOption" |
||||||
|
mode="multiple" |
||||||
|
placeholder="请选择多租户" |
||||||
|
style="width:100%" |
||||||
|
@blur="handleBlur" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
<script lang="ts" setup> |
||||||
|
import { reactive, onMounted } from 'vue'; |
||||||
|
import { listTenant } from '/@/api/platform/system/controller/tenant'; |
||||||
|
import { useUserStore } from '/@/store/modules/user'; |
||||||
|
import { Select } from 'ant-design-vue'; |
||||||
|
|
||||||
|
const state = reactive<any>({ |
||||||
|
value: [], |
||||||
|
options: [] |
||||||
|
}); |
||||||
|
onMounted(async () => { |
||||||
|
const result = await listTenant(); |
||||||
|
const userStore = useUserStore(); |
||||||
|
state.value = userStore.getUserInfo.tenantIds; |
||||||
|
state.options = result.data.map(tenant => ({ |
||||||
|
value: tenant.code, |
||||||
|
label: tenant.name |
||||||
|
})); |
||||||
|
}); |
||||||
|
|
||||||
|
function filterOption(input: string, option: any) { |
||||||
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; |
||||||
|
} |
||||||
|
|
||||||
|
function handleBlur() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
</script> |
Loading…
Reference in new issue