style: 字典

This commit is contained in:
dap 2024-09-06 08:21:09 +08:00
parent 6e6f5cb096
commit aa13d8c909

View File

@ -1,4 +1,6 @@
<script setup lang="ts">
import type { SelectHandler } from 'ant-design-vue/es/vc-select/Select';
import type { TenantOption } from '#/api';
import { computed, onMounted, ref, unref } from 'vue';
@ -51,19 +53,22 @@ function close(checked: boolean) {
const dictStore = useDictStore();
/**
* 为什么要用any ide报错😅 实际类型为string
* 选中租户的处理
* @param tenantId tenantId
* @param option 当前option
*/
async function onSelected(tenantId: any, option: any) {
const onSelected: SelectHandler = async (tenantId: string, option: any) => {
if (unref(lastSelected) === tenantId) {
// createMessage.info('');
return;
}
await tenantDynamicToggle(tenantId);
lastSelected.value = tenantId;
dictStore.resetCache();
message.success(`切换当前租户为: ${option.companyName}`);
close(true);
}
// (unknown)
setTimeout(() => dictStore.resetCache());
};
async function onDeselect() {
await tenantDynamicClear();
@ -71,6 +76,8 @@ async function onDeselect() {
message.success('还原为默认租户');
lastSelected.value = '';
close(false);
// (unknown)
setTimeout(() => dictStore.resetCache());
}
/**