|
@@ -22,14 +22,16 @@
|
|
<el-button> <SvgIcon name="ele-Upload" /> {{ props.name }} </el-button>
|
|
<el-button> <SvgIcon name="ele-Upload" /> {{ props.name }} </el-button>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <el-button v-if="fileList && fileList.length" disabled :loading="uploadLoading"> {{ uploadLoading ? '上传中,请稍等...' : props.name }} </el-button>
|
|
|
|
|
|
+ <el-button v-if="fileList && fileList.length" disabled :loading="uploadLoading">
|
|
|
|
+ {{ uploadLoading ? '上传中,请稍等...' : props.name }}
|
|
|
|
+ </el-button>
|
|
<el-button v-else disabled> 暂无附件 </el-button>
|
|
<el-button v-else disabled> 暂无附件 </el-button>
|
|
</template>
|
|
</template>
|
|
<slot> </slot>
|
|
<slot> </slot>
|
|
<template #file="{ file }">
|
|
<template #file="{ file }">
|
|
<el-skeleton :loading="uploadLoading" animated>
|
|
<el-skeleton :loading="uploadLoading" animated>
|
|
<template #template>
|
|
<template #template>
|
|
- <el-skeleton-item variant="image"/>
|
|
|
|
|
|
+ <el-skeleton-item variant="image" />
|
|
</template>
|
|
</template>
|
|
<template #default>
|
|
<template #default>
|
|
<div class="el-upload-list__item-info" v-loading="uploadLoading">
|
|
<div class="el-upload-list__item-info" v-loading="uploadLoading">
|
|
@@ -172,6 +174,10 @@ const formatData = (data: any) => {
|
|
//文件限制
|
|
//文件限制
|
|
const handleExceed = (files: any, uploadFiles: UploadUserFile[]) => {
|
|
const handleExceed = (files: any, uploadFiles: UploadUserFile[]) => {
|
|
ElMessage.warning(`当前限制最多上传 ${props.fileLimit} 个文件,已经上传了${uploadFiles.length}个文件,本次选择了 ${files.length} 个文件。`);
|
|
ElMessage.warning(`当前限制最多上传 ${props.fileLimit} 个文件,已经上传了${uploadFiles.length}个文件,本次选择了 ${files.length} 个文件。`);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uploadLoading.value = false; // 模拟上传过程
|
|
|
|
+ uploadingDisabled.value = false;
|
|
|
|
+ }, 100);
|
|
};
|
|
};
|
|
//限制文件大小
|
|
//限制文件大小
|
|
const handleChangeFile = (file: any, fileList: any) => {
|
|
const handleChangeFile = (file: any, fileList: any) => {
|
|
@@ -185,6 +191,10 @@ const handleChangeFile = (file: any, fileList: any) => {
|
|
const currIdx = fileList.indexOf(file);
|
|
const currIdx = fileList.indexOf(file);
|
|
fileList.splice(currIdx, 1);
|
|
fileList.splice(currIdx, 1);
|
|
ElMessage.warning(`文件超过了最大限度 ${props.fileSize} MB!`);
|
|
ElMessage.warning(`文件超过了最大限度 ${props.fileSize} MB!`);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uploadLoading.value = false; // 模拟上传过程
|
|
|
|
+ uploadingDisabled.value = false;
|
|
|
|
+ }, 100);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -198,6 +208,8 @@ const handRemove = () => {
|
|
const onUploadError = (error: Error) => {
|
|
const onUploadError = (error: Error) => {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
updateData();
|
|
updateData();
|
|
|
|
+ uploadLoading.value = false; // 模拟上传过程
|
|
|
|
+ uploadingDisabled.value = false;
|
|
}, 100);
|
|
}, 100);
|
|
try {
|
|
try {
|
|
const errMessage = JSON.parse(error.message)?.message ?? '上传失败';
|
|
const errMessage = JSON.parse(error.message)?.message ?? '上传失败';
|