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>-->
<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>
</div>
<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>
{
uploadState.value ?
<popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
onDelete={() => deleteSingleFile(row)}/>:''
<popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
onDelete={() => deleteSingleFile(row)}/> : ''
}
</div>
)
@@ -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