fix:修复打包报错: top level await 的问题
parent
5eee27218c
commit
e9f2b5701c
|
@ -4,7 +4,7 @@ import type { AxiosProgressEvent, InfraFileApi } from '#/api/infra/file';
|
||||||
import { computed, unref } from 'vue';
|
import { computed, unref } from 'vue';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import CryptoJS from 'crypto-js'
|
import CryptoJS from 'crypto-js'
|
||||||
import axios from 'axios'
|
import { baseRequestClient } from '#/api/request';
|
||||||
import { uploadFile, getFilePresignedUrl, createFile } from '#/api/infra/file';
|
import { uploadFile, getFilePresignedUrl, createFile } from '#/api/infra/file';
|
||||||
|
|
||||||
export function useUploadType({
|
export function useUploadType({
|
||||||
|
@ -78,7 +78,7 @@ export const useUpload = () => {
|
||||||
// 1.2 获取文件预签名地址
|
// 1.2 获取文件预签名地址
|
||||||
const presignedInfo = await getFilePresignedUrl(fileName)
|
const presignedInfo = await getFilePresignedUrl(fileName)
|
||||||
// 1.3 上传文件
|
// 1.3 上传文件
|
||||||
return axios
|
return baseRequestClient
|
||||||
.put(presignedInfo.uploadUrl, file, {
|
.put(presignedInfo.uploadUrl, file, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': file.type
|
'Content-Type': file.type
|
||||||
|
|
|
@ -3,6 +3,7 @@ import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { OnActionClickFn } from '#/adapter/vxe-table';
|
import type { OnActionClickFn } from '#/adapter/vxe-table';
|
||||||
import type { SystemDeptApi } from '#/api/system/dept';
|
import type { SystemDeptApi } from '#/api/system/dept';
|
||||||
|
import type { SystemUserApi } from '#/api/system/user';
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
|
|
||||||
|
@ -122,9 +123,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
const userList = await getSimpleUserList();
|
|
||||||
export function useGridColumns(
|
export function useGridColumns(
|
||||||
onActionClick?: OnActionClickFn<SystemDeptApi.SystemDept>,
|
onActionClick?: OnActionClickFn<SystemDeptApi.SystemDept>,
|
||||||
|
getLeaderName?: (userId: number) => string | undefined,
|
||||||
): VxeTableGridOptions<SystemDeptApi.SystemDept>['columns'] {
|
): VxeTableGridOptions<SystemDeptApi.SystemDept>['columns'] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -140,9 +141,7 @@ export function useGridColumns(
|
||||||
title: '负责人',
|
title: '负责人',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
formatter: (row) => {
|
formatter: (row) => {
|
||||||
return (
|
return getLeaderName?.(row.cellValue) || '-';
|
||||||
userList.find((user) => user.id === row.cellValue)?.nickname || '-'
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,9 @@ import type {
|
||||||
VxeTableGridOptions,
|
VxeTableGridOptions,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
import type { SystemDeptApi } from '#/api/system/dept';
|
import type { SystemDeptApi } from '#/api/system/dept';
|
||||||
|
import type { SystemUserApi } from '#/api/system/user';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { Plus } from '@vben/icons';
|
import { Plus } from '@vben/icons';
|
||||||
|
@ -14,6 +15,7 @@ import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteDept, getDeptList } from '#/api/system/dept';
|
import { deleteDept, getDeptList } from '#/api/system/dept';
|
||||||
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns } from './data';
|
import { useGridColumns } from './data';
|
||||||
|
@ -24,6 +26,13 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const userList = ref<SystemUserApi.SystemUser[]>([]);
|
||||||
|
|
||||||
|
/** 获取负责人名称 */
|
||||||
|
const getLeaderName = (userId: number) => {
|
||||||
|
return userList.value.find((user) => user.id === userId)?.nickname;
|
||||||
|
};
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function onRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
|
@ -93,7 +102,7 @@ function onActionClick({
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(onActionClick),
|
columns: useGridColumns(onActionClick, getLeaderName),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
|
@ -121,6 +130,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions,
|
} as VxeTableGridOptions,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(async () => {
|
||||||
|
userList.value = await getSimpleUserList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||||
import type { SystemMailTemplateApi } from '#/api/system/mail/template';
|
import type { SystemMailTemplateApi } from '#/api/system/mail/template';
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
|
@ -191,9 +192,9 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
const accountList = await getSimpleMailAccountList();
|
|
||||||
export function useGridColumns<T = SystemMailTemplateApi.SystemMailTemplate>(
|
export function useGridColumns<T = SystemMailTemplateApi.SystemMailTemplate>(
|
||||||
onActionClick: OnActionClickFn<T>,
|
onActionClick: OnActionClickFn<T>,
|
||||||
|
getAccountMail?: (accountId: number) => string | undefined,
|
||||||
): VxeTableGridOptions['columns'] {
|
): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -220,8 +221,7 @@ export function useGridColumns<T = SystemMailTemplateApi.SystemMailTemplate>(
|
||||||
field: 'accountId',
|
field: 'accountId',
|
||||||
title: '邮箱账号',
|
title: '邮箱账号',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
formatter: ({ cellValue }) =>
|
formatter: (row) => getAccountMail?.(row.cellValue) || '-',
|
||||||
accountList.find((account) => account.id === cellValue)?.mail || '-',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'nickname',
|
field: 'nickname',
|
||||||
|
|
|
@ -3,14 +3,18 @@ import type {
|
||||||
OnActionClickParams,
|
OnActionClickParams,
|
||||||
VxeTableGridOptions,
|
VxeTableGridOptions,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
|
import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||||
import type { SystemMailTemplateApi } from '#/api/system/mail/template';
|
import type { SystemMailTemplateApi } from '#/api/system/mail/template';
|
||||||
|
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { Plus } from '@vben/icons';
|
import { Plus } from '@vben/icons';
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import { getSimpleMailAccountList } from '#/api/system/mail/account';
|
||||||
import {
|
import {
|
||||||
deleteMailTemplate,
|
deleteMailTemplate,
|
||||||
getMailTemplatePage,
|
getMailTemplatePage,
|
||||||
|
@ -22,6 +26,13 @@ import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
import SendForm from './modules/send-form.vue';
|
import SendForm from './modules/send-form.vue';
|
||||||
|
|
||||||
|
const accountList = ref<SystemMailAccountApi.SystemMailAccount[]>([]);
|
||||||
|
|
||||||
|
/** 获取邮箱账号 */
|
||||||
|
const getAccountMail = (accountId: number) => {
|
||||||
|
return accountList.value.find((account) => account.id === accountId)?.mail;
|
||||||
|
};
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: Form,
|
connectedComponent: Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
|
@ -97,7 +108,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
},
|
},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(onActionClick),
|
columns: useGridColumns(onActionClick, getAccountMail),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
|
@ -120,6 +131,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<SystemMailTemplateApi.SystemMailTemplate>,
|
} as VxeTableGridOptions<SystemMailTemplateApi.SystemMailTemplate>,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(async () => {
|
||||||
|
accountList.value = await getSimpleMailAccountList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
|
|
|
@ -182,9 +182,9 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
const tenantPackageList = await getTenantPackageList();
|
|
||||||
export function useGridColumns<T = SystemTenantApi.SystemTenant>(
|
export function useGridColumns<T = SystemTenantApi.SystemTenant>(
|
||||||
onActionClick: OnActionClickFn<T>,
|
onActionClick: OnActionClickFn<T>,
|
||||||
|
getPackageName?: (packageId: number) => string | undefined,
|
||||||
): VxeTableGridOptions['columns'] {
|
): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -201,13 +201,8 @@ export function useGridColumns<T = SystemTenantApi.SystemTenant>(
|
||||||
field: 'packageId',
|
field: 'packageId',
|
||||||
title: '租户套餐',
|
title: '租户套餐',
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
formatter: (row) => {
|
formatter: (row: { cellValue: number }) => {
|
||||||
const packageId = row.cellValue;
|
return getPackageName?.(row.cellValue) || '-';
|
||||||
return packageId === 0
|
|
||||||
? '系统租户'
|
|
||||||
: tenantPackageList.find(
|
|
||||||
(tenantPackage) => tenantPackage.id === packageId,
|
|
||||||
)?.name || '-';
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,9 @@ import type {
|
||||||
VxeTableGridOptions,
|
VxeTableGridOptions,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
import type { SystemTenantApi } from '#/api/system/tenant';
|
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 { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { Download, Plus } from '@vben/icons';
|
import { Download, Plus } from '@vben/icons';
|
||||||
|
@ -12,6 +15,7 @@ import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant';
|
import { deleteTenant, exportTenant, getTenantPage } from '#/api/system/tenant';
|
||||||
|
import { getTenantPackageList } from '#/api/system/tenant-package';
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
import { DocAlert } from '#/components/doc-alert';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { downloadByData } from '#/utils/download';
|
import { downloadByData } from '#/utils/download';
|
||||||
|
@ -19,6 +23,16 @@ import { downloadByData } from '#/utils/download';
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import Form from './modules/form.vue';
|
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({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: Form,
|
connectedComponent: Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
|
@ -86,7 +100,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
},
|
},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(onActionClick),
|
columns: useGridColumns(onActionClick, getPackageName),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
|
@ -109,6 +123,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<SystemTenantApi.SystemTenant>,
|
} as VxeTableGridOptions<SystemTenantApi.SystemTenant>,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(async () => {
|
||||||
|
tenantPackageList.value = await getTenantPackageList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
|
|
|
@ -8,9 +8,11 @@ export const MdiWechat = createIconifyIcon('mdi:wechat');
|
||||||
|
|
||||||
export const MdiGithub = createIconifyIcon('mdi:github');
|
export const MdiGithub = createIconifyIcon('mdi:github');
|
||||||
|
|
||||||
|
export const MdiGoogle = createIconifyIcon('mdi:google');
|
||||||
|
|
||||||
export const MdiQqchat = createIconifyIcon('mdi:qqchat');
|
export const MdiQqchat = createIconifyIcon('mdi:qqchat');
|
||||||
|
|
||||||
export const AntdDingTalk = createIconifyIcon('ant-design:dingtalk')
|
export const AntdDingTalk = createIconifyIcon('ant-design:dingtalk');
|
||||||
|
|
||||||
export const MdiCheckboxMarkedCircleOutline = createIconifyIcon(
|
export const MdiCheckboxMarkedCircleOutline = createIconifyIcon(
|
||||||
'mdi:checkbox-marked-circle-outline',
|
'mdi:checkbox-marked-circle-outline',
|
||||||
|
|
Loading…
Reference in New Issue