fix : 修复项目实施附件上传功能
This commit is contained in:
@@ -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" @getFile="getFile"/>
|
||||
<file-upload v-if="!isLineBtn&&uploadState&&activeName!='plus'" @getFile="getFile"/>
|
||||
|
||||
<el-button color="#DED0B2" @click="handleEditTag" v-if="activeName!='all'&&activeName!='plus'&&uploadState"
|
||||
style="margin-left: 10px;">编辑
|
||||
@@ -46,7 +46,7 @@
|
||||
<file-preview ref="filePreviewRef" :fullscreen="false" v-if="filePreviewShow" :fileName="filePreviewParam.fileName"
|
||||
:fileUrl="filePreviewParam.fileUrl"
|
||||
:fileType="filePreviewParam.fileType"/>
|
||||
<el-dialog v-model="tagNameShow" center width="450" top="450px">
|
||||
<el-dialog v-model="tagNameShow" center width="450" top="40vh">
|
||||
<div style="display: flex;align-items: center">标签:
|
||||
<el-input v-model="fileParam.tagName" placeholder="请输入标签名称" style="width: 335px;" clearable/>
|
||||
</div>
|
||||
@@ -63,6 +63,7 @@ import {addTag, delTag, getTagList, getTags, updateTag} from "@/api/project-mana
|
||||
import {ElLoading, ElMessageBox, ElNotification} from "element-plus";
|
||||
import {searchImplementationFileList, uploadFileList} from "@/api/project-manage/attachment";
|
||||
import {deleteFile, downloadFile} from "@/api/project-demand";
|
||||
import {nextTick, onActivated} from "vue";
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@@ -184,11 +185,13 @@ const changeTag = async () => {
|
||||
fileTag: fileParam.value.tagName,
|
||||
projectId: route.query.projectId,
|
||||
})
|
||||
changeFileList(fileParam.value.tagName,true)
|
||||
} else {
|
||||
res = await addTag({
|
||||
projectId: route.query.projectId,
|
||||
fileTag: fileParam.value.tagName
|
||||
})
|
||||
|
||||
getAttachmentList()
|
||||
fileParam.value.tagName = ''
|
||||
activeName.value = 'all'
|
||||
@@ -198,11 +201,6 @@ const changeTag = async () => {
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
getTagsOption()
|
||||
// tagsOption.value.push({
|
||||
// value: fileParam.value.tagName,
|
||||
// label: fileParam.value.tagName
|
||||
// })
|
||||
tagNameShow.value = false;
|
||||
}
|
||||
const tabRemove = async (val) => {
|
||||
@@ -240,6 +238,7 @@ const handleTabClick = (item) => {
|
||||
tagNameShow.value = item.props.name == 'plus';
|
||||
if (item.props.name == 'plus') {
|
||||
isEdit.value = false
|
||||
fileParam.value.tagName = ''
|
||||
}
|
||||
if (item.props.name != 'plus') {
|
||||
if (item.props.name == 'all') {
|
||||
@@ -295,7 +294,7 @@ const handleSubmit = async (list) => {
|
||||
otherAttachmentList.value.push(item)
|
||||
})
|
||||
}
|
||||
getTagsOption()
|
||||
changeFileList('all',true)
|
||||
}
|
||||
const clickToPreview = (row) => {
|
||||
filePreviewShow.value = false
|
||||
@@ -308,7 +307,7 @@ const clickToPreview = (row) => {
|
||||
filePreviewShow.value = true
|
||||
})
|
||||
}
|
||||
const changeFileList = (tag) => {
|
||||
const changeFileList = (tag,flag) => {
|
||||
let params = {}
|
||||
if (tag == 'all') {
|
||||
params = {
|
||||
@@ -326,7 +325,14 @@ const changeFileList = (tag) => {
|
||||
|
||||
searchImplementationFileList(params).then(res => {
|
||||
if (res.code === 1000) {
|
||||
otherAttachmentList.value = res.data.fileList
|
||||
if(tag == 'all'&&flag){
|
||||
allFiles.value = res.data.fileList
|
||||
}else{
|
||||
otherAttachmentList.value = res.data.fileList
|
||||
}
|
||||
if(flag){
|
||||
getTagsOption(flag)
|
||||
}
|
||||
nextTick(() => {
|
||||
showAttachmentTable.value = true
|
||||
})
|
||||
@@ -340,14 +346,6 @@ const getAttachmentList = () => {
|
||||
targetState: "30"
|
||||
}
|
||||
showAttachmentTable.value = false
|
||||
if (attachmentParam.tag) {
|
||||
tagsOption.value.forEach(item => {
|
||||
if (item.value === attachmentParam.tag) {
|
||||
attachmentParam.tag = item.label
|
||||
}
|
||||
})
|
||||
params.tag = attachmentParam.tag
|
||||
}
|
||||
searchImplementationFileList(params).then(res => {
|
||||
if (res.code === 1000) {
|
||||
// otherAttachmentList.value = res.data.fileList
|
||||
@@ -370,15 +368,27 @@ const getAttachmentList = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const getTagsOption = () => {
|
||||
const getTagsOption = (flag) => {
|
||||
if (!route.query.projectId) return
|
||||
getTagList(route.query.projectId).then(res => {
|
||||
if (res.code === 1000) {
|
||||
tagsOption.value = res.data.rows
|
||||
let list=[]
|
||||
if(flag){
|
||||
|
||||
list= allFiles.value
|
||||
}else{
|
||||
list=otherAttachmentList.value
|
||||
}
|
||||
tagsOption.value.forEach((tag, index) => {
|
||||
const filterArray = otherAttachmentList.value.filter(item => tag.fileTag == item.tag)
|
||||
const filterArray = list.filter(item => tag.fileTag == item.tag)
|
||||
console.log("🚀 ~ file:filterArray ", filterArray)
|
||||
|
||||
tagsOption.value[index].isClose = filterArray.length > 0 ? 0 : 1
|
||||
})
|
||||
console.log("🚀 otherAttachmentList.value", allFiles.value)
|
||||
console.log("🚀 ~ file:\tagsOption.value ", tagsOption.value)
|
||||
|
||||
// if (!res.data.rows || res.data.rows.length == 0) return;
|
||||
// activeName.value=res.data.rows[0].tagId
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user