|
|
@@ -38,7 +38,14 @@
|
|
|
</div>
|
|
|
<!-- <div v-if="fileListRef.length" @click="handleStartUpload">未上传</div> -->
|
|
|
<div class="upload-filelist">
|
|
|
- <div class="upload-filelist__item" v-for="item in fileListRef" :key="item.uuid">
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'upload-filelist__item',
|
|
|
+ item.status == 'error' ? 'upload-filelist__item--error' : '',
|
|
|
+ ]"
|
|
|
+ v-for="item in fileListRef"
|
|
|
+ :key="item.uuid"
|
|
|
+ >
|
|
|
<div class="upload-filelist__item-info">
|
|
|
<paper-clip-outlined class="mr-1" />
|
|
|
<span class="mr-2">{{ item.name }}</span>
|
|
|
@@ -79,7 +86,8 @@
|
|
|
// import FileList from './FileList.vue';
|
|
|
import { nanoid } from 'nanoid';
|
|
|
import locales from '/@/utils/locales';
|
|
|
- import { getPreviewUrl, postFileRemoveByIds } from '/@/api/common';
|
|
|
+ // import { getPreviewUrl, postFileRemoveByIds } from '/@/api/common';
|
|
|
+ import { getPreviewUrl } from '/@/api/common';
|
|
|
import UploadPreviewModal from './UploadPreviewModal.vue';
|
|
|
|
|
|
export default defineComponent({
|
|
|
@@ -165,7 +173,7 @@
|
|
|
const index = fileList.value.findIndex(item => item.id === record.id);
|
|
|
index !== -1 && fileList.value.splice(index, 1);
|
|
|
emit('delete', record);
|
|
|
- await postFileRemoveByIds([record.id]);
|
|
|
+ // await postFileRemoveByIds([record.id]);
|
|
|
} else {
|
|
|
const index = fileListRef.value.findIndex(item => item.uuid === record.uuid);
|
|
|
index !== -1 && fileListRef.value.splice(index, 1);
|
|
|
@@ -251,7 +259,7 @@
|
|
|
async function handleStartUpload() {
|
|
|
const { maxNumber } = props;
|
|
|
if ((fileListRef.value.length + fileList.value.length ?? 0) > maxNumber) {
|
|
|
- return createMessage.warning(locales.upload.maxNumber, maxNumber);
|
|
|
+ return createMessage.warning(`最多只能上传${maxNumber}个文件`);
|
|
|
}
|
|
|
try {
|
|
|
isUploadingRef.value = true;
|
|
|
@@ -328,6 +336,10 @@
|
|
|
margin-bottom: 4px;
|
|
|
padding: 5px 8px;
|
|
|
|
|
|
+ &--error {
|
|
|
+ background-color: rgb(255 241 236 / 100%);
|
|
|
+ }
|
|
|
+
|
|
|
&-info {
|
|
|
max-width: 220px;
|
|
|
white-space: nowrap;
|