feat:【ele】【crm】customer 的部分(import-form)
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { UploadRawFile } from 'element-plus';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
@@ -49,10 +47,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 上传前 */
|
/** 文件改变时 */
|
||||||
function beforeUpload(file: UploadRawFile) {
|
function handleChange(file: any) {
|
||||||
formApi.setFieldValue('file', file);
|
if (file.raw) {
|
||||||
return false;
|
formApi.setFieldValue('file', file.raw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 下载模版 */
|
/** 下载模版 */
|
||||||
@@ -70,7 +69,7 @@ async function handleDownload() {
|
|||||||
<ElUpload
|
<ElUpload
|
||||||
:limit="1"
|
:limit="1"
|
||||||
accept=".xls,.xlsx"
|
accept=".xls,.xlsx"
|
||||||
:before-upload="beforeUpload"
|
:on-change="handleChange"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
>
|
>
|
||||||
<ElButton type="primary"> 选择 Excel 文件 </ElButton>
|
<ElButton type="primary"> 选择 Excel 文件 </ElButton>
|
||||||
|
|||||||
@@ -45,10 +45,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 上传前 */
|
/** 文件改变时 */
|
||||||
function beforeUpload(file: UploadRawFile) {
|
function handleChange(file: any) {
|
||||||
formApi.setFieldValue('file', file);
|
if (file.raw) {
|
||||||
return false;
|
formApi.setFieldValue('file', file.raw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 下载模版 */
|
/** 下载模版 */
|
||||||
@@ -64,10 +65,10 @@ async function handleDownload() {
|
|||||||
<template #file>
|
<template #file>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<ElUpload
|
<ElUpload
|
||||||
:max-count="1"
|
:limit="1"
|
||||||
accept=".xls,.xlsx"
|
accept=".xls,.xlsx"
|
||||||
|
:on-change="handleChange"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:before-upload="beforeUpload"
|
|
||||||
>
|
>
|
||||||
<ElButton type="primary"> 选择 Excel 文件 </ElButton>
|
<ElButton type="primary"> 选择 Excel 文件 </ElButton>
|
||||||
</ElUpload>
|
</ElUpload>
|
||||||
|
|||||||
Reference in New Issue
Block a user