上伎数量

This commit is contained in:
陈红丽 2024-12-23 14:36:28 +08:00
parent e33c1fb937
commit 66b8ad0ca6
3 changed files with 62 additions and 33 deletions

View File

@ -29,7 +29,6 @@
:file-list="fileList"
:show-upload-list="false"
v-if="!self_disabled"
:on-exceed="onExceed"
:accept="props.fileType"
>
<PlusOutlined v-if="!loading" />
@ -120,8 +119,6 @@
const handleHttpUpload = async (options) => {
loading.value = true;
try {
//
onExceed();
//
const formData = new FormData();
formData.append('file', options.file);
@ -138,12 +135,19 @@
});
editIndex = '';
} else {
list.push({
url: res.fileUrl,
name: res.originalName,
filePath: res.fileUrl,
fileName: res.originalName,
});
if(props.fileList.length<props.limit) {
list.push({
url: res.fileUrl,
name: res.originalName,
filePath: res.fileUrl,
fileName: res.originalName,
});
} else {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
}
}
emit('upload', list, props.zIndex);
} else {
@ -191,8 +195,6 @@
let filePath = props.name + '/' + year + '/' + month + '/' + day + '/' + fileName;
loading.value = true;
try {
//
onExceed();
//
const headers = {
'Access-Control-Allow-Origin': '*',
@ -236,12 +238,19 @@
});
editIndex = '';
} else {
list.push({
url: fileUrl,
name: options.file.name,
filePath: fileUrl,
fileName: options.file.name,
});
if(props.fileList.length<props.limit) {
list.push({
url: fileUrl,
name: options.file.name,
filePath: fileUrl,
fileName: options.file.name,
});
} else {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
}
}
emit('upload', list, props.zIndex);
} else {

View File

@ -152,12 +152,19 @@
const res = await upload(formData);
if (props.multiple) {
let list = JSON.parse(JSON.stringify(props.fileList));
list.push({
url: res.fileUrl,
name: res.originalName,
filePath: res.fileUrl,
fileName: res.originalName,
});
if(props.fileList.length<props.limit) {
list.push({
url: res.fileUrl,
name: res.originalName,
filePath: res.fileUrl,
fileName: res.originalName,
});
} else {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
}
emit('upload', list, props.zIndex);
} else {
emit('upload', res.fileUrl, res.originalName, props.zIndex);
@ -235,12 +242,20 @@
});
if (props.multiple) {
let list = JSON.parse(JSON.stringify(props.fileList));
list.push({
url: configData.oss_domain + res.name,
name: options.file.name,
filePath: configData.oss_domain + res.name,
fileName: options.file.name,
});
if(props.fileList.length<props.limit) {
list.push({
url: configData.oss_domain + res.name,
name: options.file.name,
filePath: configData.oss_domain + res.name,
fileName: options.file.name,
});
}
else {
notification.warning({
message: '温馨提示',
description: `最多支持上传${props.limit}`,
});
}
emit('upload', list, props.zIndex);
} else {
emit('upload', configData.oss_domain + res.name, options.file.name, props.zIndex);

View File

@ -259,9 +259,9 @@
"@babel/plugin-syntax-typescript" "^7.24.7"
"@babel/runtime@^7.10.5":
version "7.25.6"
resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.25.6.tgz#9afc3289f7184d8d7f98b099884c26317b9264d2"
integrity sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==
version "7.26.0"
resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1"
integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==
dependencies:
regenerator-runtime "^0.14.0"
@ -2235,7 +2235,12 @@ copy-to@^2.0.1:
resolved "https://registry.npmmirror.com/copy-to/-/copy-to-2.0.1.tgz#2680fbb8068a48d08656b6098092bdafc906f4a5"
integrity sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w==
core-js@^3.15.1, core-js@^3.37.1:
core-js@^3.15.1:
version "3.39.0"
resolved "https://registry.npmmirror.com/core-js/-/core-js-3.39.0.tgz#57f7647f4d2d030c32a72ea23a0555b2eaa30f83"
integrity sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==
core-js@^3.37.1:
version "3.38.1"
resolved "https://registry.npmmirror.com/core-js/-/core-js-3.38.1.tgz#aa375b79a286a670388a1a363363d53677c0383e"
integrity sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==