fix: bug#16430
This commit is contained in:
parent
e2170d8f50
commit
635fd513fc
|
@ -19,11 +19,7 @@
|
||||||
:maxCount="1"
|
:maxCount="1"
|
||||||
:showUploadList="false"
|
:showUploadList="false"
|
||||||
@change="uploadChange"
|
@change="uploadChange"
|
||||||
:accept="
|
:accept="'.xlsx,.csv'"
|
||||||
modelRef?.file?.fileType
|
|
||||||
? `.${modelRef?.file?.fileType}`
|
|
||||||
: '.xlsx'
|
|
||||||
"
|
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@drop="handleDrop"
|
@drop="handleDrop"
|
||||||
|
@ -117,18 +113,19 @@ const downFile = async (type: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const beforeUpload = (_file: any) => {
|
const beforeUpload = (_file: any) => {
|
||||||
const fileType = modelRef.file?.fileType === 'csv' ? 'csv' : 'xlsx';
|
// const fileType = modelRef.file?.fileType === 'csv' ? 'csv' : 'xlsx';
|
||||||
const isCsv = _file.type === 'text/csv';
|
const isCsv = _file.type === 'text/csv';
|
||||||
const isXlsx =
|
const isXlsx =
|
||||||
_file.type ===
|
_file.type ===
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||||
if (!isCsv && fileType !== 'xlsx') {
|
if (!isCsv) {
|
||||||
onlyMessage('请上传.csv格式文件', 'warning');
|
onlyMessage('请上传.csv格式文件', 'warning');
|
||||||
}
|
}
|
||||||
if (!isXlsx && fileType !== 'csv') {
|
if (!isXlsx) {
|
||||||
onlyMessage('请上传.xlsx格式文件', 'warning');
|
onlyMessage('请上传.xlsx格式文件', 'warning');
|
||||||
}
|
}
|
||||||
return (isCsv && fileType !== 'xlsx') || (isXlsx && fileType !== 'csv');
|
// return (isCsv && fileType !== 'xlsx') || (isXlsx && fileType !== 'csv');
|
||||||
|
return isCsv || isXlsx;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDrop = () => {};
|
const handleDrop = () => {};
|
||||||
|
|
Loading…
Reference in New Issue