refactor(expense-management): 优化数字输入和附件处理
- 在 ProjectApply 组件中,将多个 el-input 组件替换为 el-input-number 组件,用于限制输入格式 - 在 ProjectAttachment 组件中,优化附件列表获取逻辑,实现附件去重功能 - 在 add.vue 文件中,启用 console.log 输出,用于调试项目 ID 和研发人员 ID 数组
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user