From 5af9be381427aed1fadb64a517bc401f3aa0681d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 5 Jun 2025 19:19:08 +0800 Subject: [PATCH] feat: customer import --- apps/web-antd/src/api/crm/customer/index.ts | 9 +- .../web-antd/src/views/crm/customer/index.vue | 19 +++ .../crm/customer/modules/import-form.vue | 118 ++++++++++++++++++ 3 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 apps/web-antd/src/views/crm/customer/modules/import-form.vue diff --git a/apps/web-antd/src/api/crm/customer/index.ts b/apps/web-antd/src/api/crm/customer/index.ts index 3f7faaab5..611d56bc2 100644 --- a/apps/web-antd/src/api/crm/customer/index.ts +++ b/apps/web-antd/src/api/crm/customer/index.ts @@ -35,6 +35,11 @@ export namespace CrmCustomerApi { createTime: Date; // 创建时间 updateTime: Date; // 更新时间 } + export interface CustomerImport { + ownerUserId: number; + file: File; + updateSupport: boolean; + } } /** 查询客户列表 */ @@ -78,8 +83,8 @@ export function importCustomerTemplate() { } /** 导入客户 */ -export function importCustomer(file: File) { - return requestClient.upload('/crm/customer/import', { file }); +export function importCustomer(data: CrmCustomerApi.CustomerImport) { + return requestClient.upload('/crm/customer/import', data); } /** 获取客户精简信息列表 */ diff --git a/apps/web-antd/src/views/crm/customer/index.vue b/apps/web-antd/src/views/crm/customer/index.vue index 5795fdb0c..1e4f6b3bb 100644 --- a/apps/web-antd/src/views/crm/customer/index.vue +++ b/apps/web-antd/src/views/crm/customer/index.vue @@ -21,6 +21,7 @@ import { $t } from '#/locales'; import { useGridColumns, useGridFormSchema } from './data'; import Form from './modules/form.vue'; +import ImportForm from './modules/import-form.vue'; const { push } = useRouter(); const sceneType = ref('1'); @@ -35,6 +36,16 @@ function onRefresh() { gridApi.query(); } +const [ImportModal, importModalApi] = useVbenModal({ + connectedComponent: ImportForm, + destroyOnClose: true, +}); + +/** 导入客户 */ +function handleImport() { + importModalApi.open(); +} + /** 导出表格 */ async function handleExport() { const data = await exportCustomer(await gridApi.formApi.getValues()); @@ -124,6 +135,7 @@ function onChangeSceneType(key: number | string) { +