From f3d9ff44a3676076ed36b636ce80c08a6fe6e4b2 Mon Sep 17 00:00:00 2001
From: dj <1042039504@qq.com>
Date: Wed, 9 Apr 2025 10:58:26 +0800
Subject: [PATCH] =?UTF-8?q?fix=20:=20=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E5=AE=9E=E6=96=BD=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DetailComponent/ProjectAttachment.vue | 50 +++++++++++--------
1 file changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/components/DetailComponent/ProjectAttachment.vue b/src/components/DetailComponent/ProjectAttachment.vue
index d235575..956675d 100644
--- a/src/components/DetailComponent/ProjectAttachment.vue
+++ b/src/components/DetailComponent/ProjectAttachment.vue
@@ -30,7 +30,7 @@
-
+
编辑
@@ -46,7 +46,7 @@
-
+
标签:
@@ -63,6 +63,7 @@ import {addTag, delTag, getTagList, getTags, updateTag} from "@/api/project-mana
import {ElLoading, ElMessageBox, ElNotification} from "element-plus";
import {searchImplementationFileList, uploadFileList} from "@/api/project-manage/attachment";
import {deleteFile, downloadFile} from "@/api/project-demand";
+import {nextTick, onActivated} from "vue";
const router = useRouter()
const route = useRoute()
@@ -184,11 +185,13 @@ const changeTag = async () => {
fileTag: fileParam.value.tagName,
projectId: route.query.projectId,
})
+ changeFileList(fileParam.value.tagName,true)
} else {
res = await addTag({
projectId: route.query.projectId,
fileTag: fileParam.value.tagName
})
+
getAttachmentList()
fileParam.value.tagName = ''
activeName.value = 'all'
@@ -198,11 +201,6 @@ const changeTag = async () => {
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
- getTagsOption()
- // tagsOption.value.push({
- // value: fileParam.value.tagName,
- // label: fileParam.value.tagName
- // })
tagNameShow.value = false;
}
const tabRemove = async (val) => {
@@ -240,6 +238,7 @@ const handleTabClick = (item) => {
tagNameShow.value = item.props.name == 'plus';
if (item.props.name == 'plus') {
isEdit.value = false
+ fileParam.value.tagName = ''
}
if (item.props.name != 'plus') {
if (item.props.name == 'all') {
@@ -295,7 +294,7 @@ const handleSubmit = async (list) => {
otherAttachmentList.value.push(item)
})
}
- getTagsOption()
+ changeFileList('all',true)
}
const clickToPreview = (row) => {
filePreviewShow.value = false
@@ -308,7 +307,7 @@ const clickToPreview = (row) => {
filePreviewShow.value = true
})
}
-const changeFileList = (tag) => {
+const changeFileList = (tag,flag) => {
let params = {}
if (tag == 'all') {
params = {
@@ -326,7 +325,14 @@ const changeFileList = (tag) => {
searchImplementationFileList(params).then(res => {
if (res.code === 1000) {
- otherAttachmentList.value = res.data.fileList
+ if(tag == 'all'&&flag){
+ allFiles.value = res.data.fileList
+ }else{
+ otherAttachmentList.value = res.data.fileList
+ }
+ if(flag){
+ getTagsOption(flag)
+ }
nextTick(() => {
showAttachmentTable.value = true
})
@@ -340,14 +346,6 @@ const getAttachmentList = () => {
targetState: "30"
}
showAttachmentTable.value = false
- if (attachmentParam.tag) {
- tagsOption.value.forEach(item => {
- if (item.value === attachmentParam.tag) {
- attachmentParam.tag = item.label
- }
- })
- params.tag = attachmentParam.tag
- }
searchImplementationFileList(params).then(res => {
if (res.code === 1000) {
// otherAttachmentList.value = res.data.fileList
@@ -370,15 +368,27 @@ const getAttachmentList = () => {
}
})
}
-const getTagsOption = () => {
+const getTagsOption = (flag) => {
if (!route.query.projectId) return
getTagList(route.query.projectId).then(res => {
if (res.code === 1000) {
tagsOption.value = res.data.rows
+ let list=[]
+ if(flag){
+
+ list= allFiles.value
+ }else{
+ list=otherAttachmentList.value
+ }
tagsOption.value.forEach((tag, index) => {
- const filterArray = otherAttachmentList.value.filter(item => tag.fileTag == item.tag)
+ const filterArray = list.filter(item => tag.fileTag == item.tag)
+ console.log("🚀 ~ file:filterArray ", filterArray)
+
tagsOption.value[index].isClose = filterArray.length > 0 ? 0 : 1
})
+ console.log("🚀 otherAttachmentList.value", allFiles.value)
+ console.log("🚀 ~ file:\tagsOption.value ", tagsOption.value)
+
// if (!res.data.rows || res.data.rows.length == 0) return;
// activeName.value=res.data.rows[0].tagId
} else {