Merge pull request 'fix: 修复附件上传和展示问题' (#982) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/982
This commit is contained in:
2025-04-09 15:11:29 +00:00

View File

@@ -7,7 +7,7 @@
style="margin-left: 15px;margin-top: -10px">
<el-tab-pane name="all" :closable="false" label="全部">
</el-tab-pane>
<el-tab-pane v-for="item in tagsOption" :closable="item.isClose==1"
<el-tab-pane v-for="item in tagsOption" :closable="item.isClose==1&&uploadState"
:key="item.tagId"
:label="item.fileTag"
:name="item.tagId">
@@ -30,7 +30,7 @@
</el-row>
<div style="margin-top:10px;margin-bottom: 8px;margin-left: 15px;display: flex">
<!-- <el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>-->
<file-upload v-if="!isLineBtn&&uploadState&&activeName!='plus'" @getFile="getFile"/>
<file-upload v-if="!isLineBtn&&uploadState&&activeName!='plus'&&activeName!='all'" @getFile="getFile"/>
<el-button color="#DED0B2" @click="handleEditTag" v-if="activeName!='all'&&activeName!='plus'&&uploadState"
style="margin-left: 10px;">编辑
@@ -204,6 +204,14 @@ const changeTag = async () => {
tagNameShow.value = false;
}
const tabRemove = async (val) => {
if(otherAttachmentList.value&&otherAttachmentList.value.length>0){
ElNotification({
title: '提示',
message: '该标签下存在文件,不能删除标签。如需删除标签,请先删除该标签下的所有文件。',
type: 'error'
})
return;
}
ElMessageBox.confirm(`确认删除名称为${getTagName(val)}的标签吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -222,8 +230,16 @@ const tabRemove = async (val) => {
})
}
const handleEditTag = () => {
tagNameShow.value = true
fileParam.value.tagName = getTagName(activeName.value)
if(otherAttachmentList.value&&otherAttachmentList.value.length>0){
ElNotification({
title: '提示',
message: '该标签下存在文件,不能编辑标签。如需编辑标签,请先删除该标签下的所有文件。',
type: 'error'
})
return;
}
tagNameShow.value = true
isEdit.value = true
}
const getTagName = (name) => {
@@ -381,10 +397,10 @@ const getTagsOption = (flag) => {
list=otherAttachmentList.value
}
tagsOption.value.forEach((tag, index) => {
const filterArray = list.filter(item => tag.fileTag == item.tag)
console.log("🚀 ~ file:filterArray ", filterArray)
tagsOption.value[index].isClose = filterArray.length > 0 ? 0 : 1
// const filterArray = list.filter(item => tag.fileTag == item.tag)
// console.log("🚀 ~ file:filterArray ", filterArray)
tagsOption.value[index].isClose =1
// tagsOption.value[index].isClose = filterArray.length > 0 ? 0 : 1
})
console.log("🚀 otherAttachmentList.value", allFiles.value)
console.log("🚀 ~ file:\tagsOption.value ", tagsOption.value)