feat:【ele】【crm】customer 的部分(import-form)

This commit is contained in:
YunaiV
2025-11-19 08:47:17 +08:00
parent c1b55dccf3
commit 63a4e1e901
2 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,4 @@
<script lang="ts" setup>
import type { UploadRawFile } from 'element-plus';
import { useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
@@ -49,10 +47,11 @@ const [Modal, modalApi] = useVbenModal({
},
});
/** 上传前 */
function beforeUpload(file: UploadRawFile) {
formApi.setFieldValue('file', file);
return false;
/** 文件改变时 */
function handleChange(file: any) {
if (file.raw) {
formApi.setFieldValue('file', file.raw);
}
}
/** 下载模版 */
@@ -70,7 +69,7 @@ async function handleDownload() {
<ElUpload
:limit="1"
accept=".xls,.xlsx"
:before-upload="beforeUpload"
:on-change="handleChange"
:auto-upload="false"
>
<ElButton type="primary"> 选择 Excel 文件 </ElButton>

View File

@@ -45,10 +45,11 @@ const [Modal, modalApi] = useVbenModal({
},
});
/** 上传前 */
function beforeUpload(file: UploadRawFile) {
formApi.setFieldValue('file', file);
return false;
/** 文件改变时 */
function handleChange(file: any) {
if (file.raw) {
formApi.setFieldValue('file', file.raw);
}
}
/** 下载模版 */
@@ -64,10 +65,10 @@ async function handleDownload() {
<template #file>
<div class="w-full">
<ElUpload
:max-count="1"
:limit="1"
accept=".xls,.xlsx"
:on-change="handleChange"
:auto-upload="false"
:before-upload="beforeUpload"
>
<ElButton type="primary"> 选择 Excel 文件 </ElButton>
</ElUpload>