diff --git a/src/components/DetailComponent/ProjectAttachment.vue b/src/components/DetailComponent/ProjectAttachment.vue index 3efa1ee..d834566 100644 --- a/src/components/DetailComponent/ProjectAttachment.vue +++ b/src/components/DetailComponent/ProjectAttachment.vue @@ -32,7 +32,8 @@ - 编辑 + 编辑 handleDownload(row)}>下载 { uploadState.value ? - deleteSingleFile(row)}/>:'' + deleteSingleFile(row)}/> : '' } ) @@ -241,9 +242,9 @@ const handleTabClick = (item) => { isEdit.value = false } if (item.props.name != 'plus') { - if(item.props.name == 'all'){ + if (item.props.name == 'all') { changeFileList('all') - }else{ + } else { changeFileList(getTagName(item.props.name)) } // if (item.props.name == 'all') { @@ -269,10 +270,9 @@ const compositeParam = (item) => { } } const getFile = (val) => { - // console.log('上传文件', val) + console.log('上传文件', val) let fileObj = compositeParam(val) fileList.value.push(fileObj) - otherAttachmentList.value.push(fileObj) handleSubmit(fileList.value) } @@ -283,12 +283,17 @@ const handleSubmit = async (list) => { targetState: "30" } let res = await uploadFileList(params) - if(res.code !== 1000){ + if (res.code !== 1000) { ElNotification({ title: '提示', message: res.msg, type: 'error' }) + fileList.value=[] + }else{ + list.forEach(item => { + otherAttachmentList.value.push(item) + }) } getTagsOption() } @@ -303,18 +308,18 @@ const clickToPreview = (row) => { filePreviewShow.value = true }) } -const changeFileList=(tag)=>{ +const changeFileList = (tag) => { let params = {} - if(tag=='all'){ + if (tag == 'all') { params = { targetId: route.query.projectId, targetState: "30", } - }else{ + } else { params = { targetId: route.query.projectId, targetState: "30", - tag:tag + tag: tag } } showAttachmentTable.value = false