fix:修复打包报错: top level await 的问题

This commit is contained in:
YunaiV
2025-04-22 18:49:31 +08:00
parent 5eee27218c
commit e9f2b5701c
8 changed files with 67 additions and 22 deletions

View File

@@ -4,6 +4,9 @@ import type {
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemTenantApi } from '#/api/system/tenant';
import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons';
@@ -12,6 +15,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant';
import { getTenantPackageList } from '#/api/system/tenant-package';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
@@ -19,6 +23,16 @@ import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const tenantPackageList = ref<SystemTenantPackageApi.SystemTenantPackage[]>([]);
/** 获取套餐名称 */
const getPackageName = (packageId: number) => {
if (packageId === 0) {
return '系统租户';
}
return tenantPackageList.value.find((pkg) => pkg.id === packageId)?.name;
};
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
@@ -86,7 +100,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(onActionClick),
columns: useGridColumns(onActionClick, getPackageName),
height: 'auto',
keepSource: true,
proxyConfig: {
@@ -109,6 +123,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<SystemTenantApi.SystemTenant>,
});
/** 初始化 */
onMounted(async () => {
tenantPackageList.value = await getTenantPackageList();
});
</script>
<template>
<Page auto-content-height>