feat(project-manage): 新增项目附件标签功能

This commit is contained in:
dj
2025-03-30 15:06:39 +08:00
parent ca9e281119
commit ebd7fa3851
2 changed files with 64 additions and 46 deletions

View File

@@ -32,7 +32,7 @@
<!-- <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'" style="margin-left: 10px;">编辑 <el-button color="#DED0B2" @click="handleEditTag" v-if="activeName!='all'&&activeName!='plus'" 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"
@@ -127,9 +127,9 @@ const executeTableConfig = reactive({
<div> <div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button> <el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
{ {
row.newFile ? 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>
) )
@@ -137,6 +137,7 @@ const executeTableConfig = reactive({
} }
] ]
}) })
// row.newFile ?: ''
const otherAttachmentList = ref([]) const otherAttachmentList = ref([])
const filePreviewParam = ref({ const filePreviewParam = ref({
@@ -159,6 +160,8 @@ const deleteSingleFile = (row) => {
}) })
if (res.code === 1000) { if (res.code === 1000) {
otherAttachmentList.value.splice(otherAttachmentList.value.findIndex((item) => item.fileId === row.fileId), 1); otherAttachmentList.value.splice(otherAttachmentList.value.findIndex((item) => item.fileId === row.fileId), 1);
getAttachmentList()
activeName.value = 'all'
} }
}); });
} }
@@ -176,6 +179,9 @@ const changeTag = async () => {
projectId: route.query.projectId, projectId: route.query.projectId,
fileTag: fileParam.value.tagName fileTag: fileParam.value.tagName
}) })
getAttachmentList()
fileParam.value.tagName = ''
activeName.value = 'all'
} }
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -188,11 +194,9 @@ const changeTag = async () => {
// label: fileParam.value.tagName // label: fileParam.value.tagName
// }) // })
tagNameShow.value = false; tagNameShow.value = false;
fileParam.value.tagName = ''
activeName.value = 'all'
} }
const tabRemove = async (val) => { const tabRemove = async (val) => {
ElMessageBox.confirm(`确认删除名称为${getFileName(val)}的标签吗?`, '系统提示', { ElMessageBox.confirm(`确认删除名称为${getTagName(val)}的标签吗?`, '系统提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@@ -205,15 +209,16 @@ const tabRemove = async (val) => {
}) })
if (res.code === 1000) { if (res.code === 1000) {
getTagsOption() getTagsOption()
otherAttachmentList.value = allFiles.value
} }
}) })
} }
const handleEditTag = () => { const handleEditTag = () => {
tagNameShow.value = true tagNameShow.value = true
fileParam.value.tagName = getFileName(activeName.value) fileParam.value.tagName = getTagName(activeName.value)
isEdit.value = true isEdit.value = true
} }
const getFileName = (name) => { const getTagName = (name) => {
const tagArray = tagsOption.value.filter((item1) => item1.tagId == name) const tagArray = tagsOption.value.filter((item1) => item1.tagId == name)
let tagName = '' let tagName = ''
if (tagArray && tagArray.length > 0) { if (tagArray && tagArray.length > 0) {
@@ -227,16 +232,17 @@ const handleTabClick = (item) => {
isEdit.value = false isEdit.value = false
} }
if (item.props.name != 'plus') { if (item.props.name != 'plus') {
if (item.props.name == 'all') { changeFileList(getTagName(item.props.name))
otherAttachmentList.value = allFiles.value // if (item.props.name == 'all') {
} else { // otherAttachmentList.value = allFiles.value
otherAttachmentList.value = allFiles.value.filter(item1 => item1.tag == getFileName(item.props.name)) // } else {
} // otherAttachmentList.value = allFiles.value.filter(item1 => item1.tag == getTagName(item.props.name))
// }
} }
showAttachmentTable.value = false // showAttachmentTable.value = false
nextTick(() => { // nextTick(() => {
showAttachmentTable.value = true // showAttachmentTable.value = true
}) // })
} }
const compositeParam = (item) => { const compositeParam = (item) => {
return { return {
@@ -246,7 +252,7 @@ const compositeParam = (item) => {
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
newFile: true, newFile: true,
tag: activeName.value, tag: getTagName(activeName.value),
} }
} }
const getFile = (val) => { const getFile = (val) => {
@@ -264,11 +270,14 @@ const handleSubmit = async (list) => {
targetState: "30" targetState: "30"
} }
let res = await uploadFileList(params) let res = await uploadFileList(params)
// ElNotification({ if(res.code !== 1000){
// title: '提示', ElNotification({
// message: res.msg, title: '提示',
// type: res.code === 1000 ? 'success' : 'error' message: res.msg,
// }) type: 'error'
})
}
getTagsOption()
} }
const clickToPreview = (row) => { const clickToPreview = (row) => {
filePreviewShow.value = false filePreviewShow.value = false
@@ -281,12 +290,29 @@ const clickToPreview = (row) => {
filePreviewShow.value = true filePreviewShow.value = true
}) })
} }
const handleSearch = () => { const changeFileList=(tag)=>{
showAttachmentTable.value = false
let params = {
targetId: route.query.projectId,
targetState: "30",
tag:tag
}
searchImplementationFileList(params).then(res => {
if (res.code === 1000) {
otherAttachmentList.value = res.data.fileList
nextTick(() => {
showAttachmentTable.value = true
})
}
})
}
const getAttachmentList = () => {
const loading = ElLoading.service({fullscreen: true}) const loading = ElLoading.service({fullscreen: true})
let params = { let params = {
targetId: route.query.projectId, targetId: route.query.projectId,
targetState: "30" targetState: "30"
} }
showAttachmentTable.value = false
if (attachmentParam.tag) { if (attachmentParam.tag) {
tagsOption.value.forEach(item => { tagsOption.value.forEach(item => {
if (item.value === attachmentParam.tag) { if (item.value === attachmentParam.tag) {
@@ -296,7 +322,6 @@ const handleSearch = () => {
params.tag = attachmentParam.tag params.tag = attachmentParam.tag
} }
searchImplementationFileList(params).then(res => { searchImplementationFileList(params).then(res => {
showAttachmentTable.value = false
if (res.code === 1000) { if (res.code === 1000) {
// otherAttachmentList.value = res.data.fileList // otherAttachmentList.value = res.data.fileList
otherAttachmentList.value = res.data.fileList otherAttachmentList.value = res.data.fileList
@@ -322,19 +347,12 @@ const getTagsOption = () => {
if (!route.query.projectId) return if (!route.query.projectId) return
getTagList(route.query.projectId).then(res => { getTagList(route.query.projectId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
res.data.rows[0].isClose = 1
tagsOption.value = res.data.rows tagsOption.value = res.data.rows
otherAttachmentList.value.forEach(item => { tagsOption.value.forEach((tag, index) => {
tagsOption.value.forEach(tag => { const filterArray = otherAttachmentList.value.filter(item => tag.fileTag == item.tag)
// console.log(tag.fileTag,item.tag) tagsOption.value[index].isClose = filterArray.length > 0 ? 0 : 1
if (tag.fileTag == item.tag) {
tag.isClose = 0
} else {
tag.isClose = 1
}
})
}) })
if (!res.data.rows || res.data.rows.length == 0) return; // if (!res.data.rows || res.data.rows.length == 0) return;
// activeName.value=res.data.rows[0].tagId // activeName.value=res.data.rows[0].tagId
} else { } else {
ElNotification({ ElNotification({
@@ -356,9 +374,9 @@ const handleUpload = () => {
} }
}) })
} }
handleSearch() getAttachmentList()
onActivated(() => { onActivated(() => {
handleSearch() getAttachmentList()
}) })
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -68,13 +68,13 @@ export default defineConfig({
strictPort: false, strictPort: false,
open: true, open: true,
proxy: { proxy: {
// '/api/workflow': { '/api/workflow': {
// // target: 'http://frp.feashow.cn:31800/', target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/', // target: 'http://clay.frp.feashow.cn/',
// // target: 'http://192.168.31.175:8000', // target: 'http://192.168.31.175:8000',
// changeOrigin: true, changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')
// }, },
// '/api/admin': { // '/api/admin': {
// // target: 'http://frp.feashow.cn:31800/', // // target: 'http://frp.feashow.cn:31800/',
// target: 'http://clay.frp.feashow.cn/', // target: 'http://clay.frp.feashow.cn/',