From b5ada3a1ac996a6da519ab650d8e27580dc7268c Mon Sep 17 00:00:00 2001
From: dj <1042039504@qq.com>
Date: Wed, 11 Jun 2025 14:19:55 +0800
Subject: [PATCH] =?UTF-8?q?feat(FileUpload):=20=E6=B7=BB=E5=8A=A0=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E4=B8=AD=E7=9A=84=20loading=20?=
=?UTF-8?q?=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DetailComponent/ProjectAttachment.vue | 52 +++++++++++--------
src/components/FileUpload.vue | 14 ++++-
2 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/src/components/DetailComponent/ProjectAttachment.vue b/src/components/DetailComponent/ProjectAttachment.vue
index e449037..401ef96 100644
--- a/src/components/DetailComponent/ProjectAttachment.vue
+++ b/src/components/DetailComponent/ProjectAttachment.vue
@@ -30,7 +30,7 @@
-
+
handleDownload(row)}>下载
{
- uploadState.value ?
+ uploadState.value ?
deleteSingleFile(row)}/> : ''
}
@@ -157,6 +157,7 @@ const filePreviewParam = ref({
fileType: 'pdf'
})
const filePreviewShow = ref(false)
+const uploadLoading = ref(false)
const isEdit = ref(false)
const isCloseByList = (index) => {
// otherAttachmentList.length>0?false:true
@@ -173,24 +174,24 @@ const handleDownload = (row) => {
}
const deleteSingleFile = (row) => {
console.log("🚀 ~ file: ", row)
- deleteFile(row.fileId).then(res => {
- ElNotification({
- title: '提示',
- message: res.msg,
- type: res.code === 1000 ? 'success' : 'error'
- })
- if (res.code === 1000) {
- if (row.newFile) {
- const finalList = getLocalList().filter(item => item.fileId !== row.fileId);
- localStorage.setItem(`implementAllFileList-${route.query.projectId}`, JSON.stringify(finalList))
- }else{
- otherAttachmentList.value.splice(otherAttachmentList.value.findIndex((item) => item.fileId === row.fileId), 1);
- }
-
- getAttachmentList()
- activeName.value = 'all'
+ deleteFile(row.fileId).then(res => {
+ ElNotification({
+ title: '提示',
+ message: res.msg,
+ type: res.code === 1000 ? 'success' : 'error'
+ })
+ if (res.code === 1000) {
+ if (row.newFile) {
+ const finalList = getLocalList().filter(item => item.fileId !== row.fileId);
+ localStorage.setItem(`implementAllFileList-${route.query.projectId}`, JSON.stringify(finalList))
+ } else {
+ otherAttachmentList.value.splice(otherAttachmentList.value.findIndex((item) => item.fileId === row.fileId), 1);
}
- });
+
+ getAttachmentList()
+ activeName.value = 'all'
+ }
+ });
}
const changeTag = async () => {
@@ -266,7 +267,7 @@ const getTagName = (name) => {
}
return tagName
}
-const handleTabClick = (item) => {
+const handleTabClick = (item, e) => {
const defaultArray = tagsOption.value.filter(item1 => item1.tagId == item.props.name)
if (defaultArray && defaultArray.length > 0) {
isDefault.value = defaultArray[0].isDefault == 1
@@ -306,14 +307,21 @@ const compositeParam = (item) => {
tag: getTagName(activeName.value) || '项目实施',
}
}
+const beforeUpload=()=>{
+ // uploadLoading.value= ElLoading.service({fullscreen: true})
+}
const getFile = (val) => {
+
console.log('上传文件', val)
- fileList.value=getLocalList()
+ fileList.value = getLocalList()
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
localStorage.setItem(`implementAllFileList-${route.query.projectId}`, JSON.stringify(fileList.value))
otherAttachmentList.value.push(fileObj)
// handleSubmit([fileObj])
+ // nextTick(() => {
+ // uploadLoading.value.close()
+ // })
}
const handleSubmit = async () => {
@@ -372,6 +380,8 @@ const changeFileList = (tag, flag) => {
// targetId: route.query.projectId,
// targetState: "30",
// }
+
+ otherAttachmentList.value = [...otherAttachmentList.value, ...getLocalList()];
} else {
const filw = getLocalList().filter(item1 => item1.tag === tag);
const filteredAllFiles = allFiles.value.filter(item1 => item1.tag === tag);
diff --git a/src/components/FileUpload.vue b/src/components/FileUpload.vue
index ad783c6..3bb2218 100644
--- a/src/components/FileUpload.vue
+++ b/src/components/FileUpload.vue
@@ -19,8 +19,9 @@