|
|
@ -40,11 +40,12 @@ function beforeUpload(file) { |
|
|
|
|
|
|
|
// 判断上传文件格式 |
|
|
|
|
|
|
|
const extension = file.name.split('.')[1] === 'xls' |
|
|
|
const extension = file.name.split('.')[1] === 'csv' |
|
|
|
|
|
|
|
const extension2 = file.name.split('.')[1] === 'xlsx' |
|
|
|
// const extension2 = file.name.split('.')[1] === 'csv' |
|
|
|
|
|
|
|
if (!extension && !extension2) { |
|
|
|
// if (!extension && !extension2) { |
|
|
|
if (!extension) { |
|
|
|
createMessage.warning('导入文件只能是 xls、xlsx格式!') |
|
|
|
fileList.value = [] |
|
|
|
console.log(fileList) |
|
|
@ -74,7 +75,7 @@ function handleDrop(e: DragEvent) { |
|
|
|
|
|
|
|
async function importPointTemplate() { |
|
|
|
const data = await importTemplate() |
|
|
|
downloadByData(data, 'EXA测点导入模板.xlsx') |
|
|
|
downloadByData(data, 'EXA测点导入模板.csv') |
|
|
|
} |
|
|
|
|
|
|
|
async function handleSubmit() { |
|
|
@ -138,7 +139,7 @@ async function handleSubmit() { |
|
|
|
@register="registerCreateBatchModal" @ok="handleSubmit" |
|
|
|
> |
|
|
|
<UploadDragger |
|
|
|
v-model:fileList="fileList" :max-count="1" accept=".xlsx,.xls" :multiple="false" :before-upload="beforeUpload" |
|
|
|
v-model:fileList="fileList" :max-count="1" accept=".csv" :multiple="false" :before-upload="beforeUpload" |
|
|
|
@change="handleChange" @drop="handleDrop" |
|
|
|
> |
|
|
|
<p class="ant-upload-drag-icon"> |
|
|
@ -148,7 +149,7 @@ async function handleSubmit() { |
|
|
|
点击或拖拽到此区域实现上传 |
|
|
|
</p> |
|
|
|
<p class="ant-upload-hint"> |
|
|
|
只支持上传单个excel文件,请尽量根据模板上传 |
|
|
|
只支持上传单个csv文件,请尽量根据模板上传 |
|
|
|
</p> |
|
|
|
</UploadDragger> |
|
|
|
<Divider><span style="color: #0B55A4;cursor: pointer" @click="importPointTemplate">下载模板</span></Divider> |
|
|
|