|
@@ -146,12 +146,10 @@
|
|
|
if (fileList.length == 1) {
|
|
if (fileList.length == 1) {
|
|
|
handleFile(file);
|
|
handleFile(file);
|
|
|
await handleStartUpload();
|
|
await handleStartUpload();
|
|
|
- console.log(
|
|
|
|
|
- '🚀 ~ file: XTUpload.vue:150 ~ beforeUpload ~ fileListRef.value:',
|
|
|
|
|
- fileListRef.value,
|
|
|
|
|
- );
|
|
|
|
|
} else {
|
|
} else {
|
|
|
isMultiCount.value += 1;
|
|
isMultiCount.value += 1;
|
|
|
|
|
+ // console.log('🚀 ~ file: XTUpload.vue:155 ~ beforeUpload ~ isMultiCount:', isMultiCount);
|
|
|
|
|
+ // console.log('🚀 ~ file: XTUpload.vue:157 ~ beforeUpload ~ fileList:', fileList);
|
|
|
if (isMultiCount.value == fileList.length) {
|
|
if (isMultiCount.value == fileList.length) {
|
|
|
console.log('上传操作');
|
|
console.log('上传操作');
|
|
|
fileList.forEach(ele => {
|
|
fileList.forEach(ele => {
|
|
@@ -246,13 +244,28 @@
|
|
|
item.status =
|
|
item.status =
|
|
|
data.code == ResultEnum.SUCCESS ? UploadResultStatus.SUCCESS : UploadResultStatus.ERROR;
|
|
data.code == ResultEnum.SUCCESS ? UploadResultStatus.SUCCESS : UploadResultStatus.ERROR;
|
|
|
item.responseData = data;
|
|
item.responseData = data;
|
|
|
- if (idx + 1 == len) {
|
|
|
|
|
|
|
+ // if (idx + 1 == len) {
|
|
|
|
|
+ if (idx <= len) {
|
|
|
|
|
+ // console.log('🚀 ~ file: XTUpload.vue:250 ~ uploadApiByItem ~ len:', len);
|
|
|
|
|
+ // console.log(
|
|
|
|
|
+ // '🚀 ~ file: XTUpload.vue:259 ~ uploadApiByItem ~ fileListRef.value:',
|
|
|
|
|
+ // fileListRef.value,
|
|
|
|
|
+ // );
|
|
|
|
|
+ isMultiCount.value = 0;
|
|
|
fileListRef.value.forEach(ele => {
|
|
fileListRef.value.forEach(ele => {
|
|
|
const responseData = ele.responseData as any;
|
|
const responseData = ele.responseData as any;
|
|
|
|
|
+ // console.log(
|
|
|
|
|
+ // '🚀 ~ file: XTUpload.vue:258 ~ uploadApiByItem ~ responseData:',
|
|
|
|
|
+ // responseData,
|
|
|
|
|
+ // );
|
|
|
if (responseData?.code == ResultEnum.SUCCESS) {
|
|
if (responseData?.code == ResultEnum.SUCCESS) {
|
|
|
fileList.value.push(responseData.data);
|
|
fileList.value.push(responseData.data);
|
|
|
|
|
+ // console.log(
|
|
|
|
|
+ // '🚀 ~ file: XTUpload.vue:256 ~ uploadApiByItem ~ fileList.value.push:',
|
|
|
|
|
+ // fileList.value,
|
|
|
|
|
+ // );
|
|
|
} else {
|
|
} else {
|
|
|
- createMessage.error(responseData?.errorMsg);
|
|
|
|
|
|
|
+ responseData ? createMessage.error(responseData?.errorMsg) : '';
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
fileListRef.value = fileListRef.value.filter(ele => {
|
|
fileListRef.value = fileListRef.value.filter(ele => {
|
|
@@ -279,6 +292,7 @@
|
|
|
// 点击开始上传
|
|
// 点击开始上传
|
|
|
async function handleStartUpload() {
|
|
async function handleStartUpload() {
|
|
|
const { maxNumber } = props;
|
|
const { maxNumber } = props;
|
|
|
|
|
+ console.log('🚀 ~ file: XTUpload.vue:282 ~ handleStartUpload ~ props:', props);
|
|
|
if ((fileListRef.value.length + fileList.value.length ?? 0) > maxNumber) {
|
|
if ((fileListRef.value.length + fileList.value.length ?? 0) > maxNumber) {
|
|
|
return createMessage.warning(`最多只能上传${maxNumber}个文件`);
|
|
return createMessage.warning(`最多只能上传${maxNumber}个文件`);
|
|
|
}
|
|
}
|