fix: 修复附件上传和展示问题

This commit is contained in:
dj
2025-04-09 00:13:51 +08:00
parent 2f43919132
commit 25d5b20b65

View File

@@ -32,7 +32,8 @@
<!-- <el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>--> <!-- <el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>-->
<file-upload v-if="!isLineBtn&&uploadState" @getFile="getFile"/> <file-upload v-if="!isLineBtn&&uploadState" @getFile="getFile"/>
<el-button color="#DED0B2" @click="handleEditTag" v-if="activeName!='all'&&activeName!='plus'&&uploadState" style="margin-left: 10px;">编辑 <el-button color="#DED0B2" @click="handleEditTag" v-if="activeName!='all'&&activeName!='plus'&&uploadState"
style="margin-left: 10px;">编辑
</el-button> </el-button>
</div> </div>
<fvTable style="width: 100%;min-height:311px;max-height: 311px" v-if="showAttachmentTable" height="311" <fvTable style="width: 100%;min-height:311px;max-height: 311px" v-if="showAttachmentTable" height="311"
@@ -128,8 +129,8 @@ const executeTableConfig = reactive({
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button> <el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
{ {
uploadState.value ? uploadState.value ?
<popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'} <popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
onDelete={() => deleteSingleFile(row)}/>:'' onDelete={() => deleteSingleFile(row)}/> : ''
} }
</div> </div>
) )
@@ -241,9 +242,9 @@ const handleTabClick = (item) => {
isEdit.value = false isEdit.value = false
} }
if (item.props.name != 'plus') { if (item.props.name != 'plus') {
if(item.props.name == 'all'){ if (item.props.name == 'all') {
changeFileList('all') changeFileList('all')
}else{ } else {
changeFileList(getTagName(item.props.name)) changeFileList(getTagName(item.props.name))
} }
// if (item.props.name == 'all') { // if (item.props.name == 'all') {
@@ -269,10 +270,9 @@ const compositeParam = (item) => {
} }
} }
const getFile = (val) => { const getFile = (val) => {
// console.log('上传文件', val) console.log('上传文件', val)
let fileObj = compositeParam(val) let fileObj = compositeParam(val)
fileList.value.push(fileObj) fileList.value.push(fileObj)
otherAttachmentList.value.push(fileObj)
handleSubmit(fileList.value) handleSubmit(fileList.value)
} }
@@ -283,12 +283,17 @@ const handleSubmit = async (list) => {
targetState: "30" targetState: "30"
} }
let res = await uploadFileList(params) let res = await uploadFileList(params)
if(res.code !== 1000){ if (res.code !== 1000) {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
type: 'error' type: 'error'
}) })
fileList.value=[]
}else{
list.forEach(item => {
otherAttachmentList.value.push(item)
})
} }
getTagsOption() getTagsOption()
} }
@@ -303,18 +308,18 @@ const clickToPreview = (row) => {
filePreviewShow.value = true filePreviewShow.value = true
}) })
} }
const changeFileList=(tag)=>{ const changeFileList = (tag) => {
let params = {} let params = {}
if(tag=='all'){ if (tag == 'all') {
params = { params = {
targetId: route.query.projectId, targetId: route.query.projectId,
targetState: "30", targetState: "30",
} }
}else{ } else {
params = { params = {
targetId: route.query.projectId, targetId: route.query.projectId,
targetState: "30", targetState: "30",
tag:tag tag: tag
} }
} }
showAttachmentTable.value = false showAttachmentTable.value = false