From 70d94f3c1ddb4c1069d51cf7ddef1cc292edce78 Mon Sep 17 00:00:00 2001
From: dj <1042039504@qq.com>
Date: Fri, 6 Jun 2025 22:58:48 +0800
Subject: [PATCH] =?UTF-8?q?refactor(expense-management):=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E6=95=B0=E5=AD=97=E8=BE=93=E5=85=A5=E5=92=8C=E9=99=84?=
=?UTF-8?q?=E4=BB=B6=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 ProjectApply 组件中,将多个 el-input 组件替换为 el-input-number 组件,用于限制输入格式
- 在 ProjectAttachment 组件中,优化附件列表获取逻辑,实现附件去重功能
- 在 add.vue 文件中,启用 console.log 输出,用于调试项目 ID 和研发人员 ID 数组
---
.../DetailComponent/ProjectApply.vue | 58 +++++++++----------
.../DetailComponent/ProjectAttachment.vue | 18 +++++-
.../expense-management/share-detail/add.vue | 4 +-
3 files changed, 47 insertions(+), 33 deletions(-)
diff --git a/src/components/DetailComponent/ProjectApply.vue b/src/components/DetailComponent/ProjectApply.vue
index d8c47c4..76f5b32 100644
--- a/src/components/DetailComponent/ProjectApply.vue
+++ b/src/components/DetailComponent/ProjectApply.vue
@@ -6,88 +6,88 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -202,8 +202,8 @@
-
-
+
+
搜索
diff --git a/src/components/DetailComponent/ProjectAttachment.vue b/src/components/DetailComponent/ProjectAttachment.vue
index 5ab0b51..e449037 100644
--- a/src/components/DetailComponent/ProjectAttachment.vue
+++ b/src/components/DetailComponent/ProjectAttachment.vue
@@ -308,6 +308,7 @@ const compositeParam = (item) => {
}
const getFile = (val) => {
console.log('上传文件', val)
+ fileList.value=getLocalList()
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
localStorage.setItem(`implementAllFileList-${route.query.projectId}`, JSON.stringify(fileList.value))
@@ -347,8 +348,8 @@ const handleSubmit = async () => {
// otherAttachmentList.value.push(item)
// })
getAttachmentList()
+ fileList.value = []
}
- fileList.value = []
// changeFileList('all',true)
}
}
@@ -372,7 +373,20 @@ const changeFileList = (tag, flag) => {
// targetState: "30",
// }
} else {
- otherAttachmentList.value = allFiles.value.filter(item1 => item1.tag == tag)
+ const filw = getLocalList().filter(item1 => item1.tag === tag);
+ const filteredAllFiles = allFiles.value.filter(item1 => item1.tag === tag);
+
+// 使用 fileId 作为唯一标识进行去重
+ const seen = new Set();
+ const uniqueFiles = [...filteredAllFiles, ...filw].filter(item => {
+ if (!seen.has(item.fileId)) {
+ seen.add(item.fileId);
+ return true;
+ }
+ return false;
+ });
+
+ otherAttachmentList.value = uniqueFiles;
// params = {
// targetId: route.query.projectId,
// targetState: "30",
diff --git a/src/views/expense-management/share-detail/add.vue b/src/views/expense-management/share-detail/add.vue
index f3eb95b..764e864 100644
--- a/src/views/expense-management/share-detail/add.vue
+++ b/src/views/expense-management/share-detail/add.vue
@@ -176,8 +176,8 @@ const selectProject=(row,index)=>{
//先选择人员, 再选择项目: 再添加一行,重复操作
const projectIdArray = formData.value.tableData.map(item => item.projectId)
const researchPersonnelIdArray = formData.value.tableData.map(item => item.researchPersonnelId)
- // console.log('projectIdArray',projectIdArray)
- // console.log('researchPersonnelIdArray',researchPersonnelIdArray)
+ console.log('projectIdArray',projectIdArray)
+ console.log('researchPersonnelIdArray',researchPersonnelIdArray)
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
let repeatProjectName=getProjectName(row.projectId)