fix : 修复项目实施附件查询及上传功能、代码文件优化

This commit is contained in:
2024-06-03 15:39:22 +08:00
parent 1ee92f698e
commit abe80eafdc
21 changed files with 86 additions and 1164 deletions

View File

@@ -12,7 +12,7 @@
</el-form-item>
<el-form-item>
<el-button @click="handleSearch" color="#DED0B2">搜索</el-button>
<el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>
<el-button v-if="uploadState" color="#DED0B2" @click="handleUpload">上传附件</el-button>
</el-form-item>
</el-form>
<el-card style="width: 100%">
@@ -27,11 +27,13 @@
<script setup lang="jsx">
import {downloadFile} from "@/api/project-demand";
import {getTags,getImplementationAttachment} from "@/api/project-manage";
import {searchFileList} from "@/api/project-manage/attachment.js";
import {getTags} from "@/api/project-manage";
import {ElNotification} from "element-plus";
const route = useRoute()
const router = useRouter()
const uploadState = ref(true)
const attachment = reactive({
tag: ''
})
@@ -80,49 +82,45 @@ const showTable = ref(true)
const otherFileList = ref([])
const getTagsOption = () => {
if (!route.query.id) return
let params={
projectId: route.query.id
}
getTags(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
getTags(route.query.id).then(res => {
if (res.code === 1000) {
tagsOption.value = res.data
}else{
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
const handleSearch = () => {
let params
let params = {
targetId: route.query.id,
targetState: "30"
}
if (attachment.tag) {
tagsOption.value.forEach(item => {
if (item.value === attachment.tag) {
attachment.tag = item.label
}
})
params = {
targetId: route.query.id,
tag: attachment.tag
}
} else {
params = {
targetId: route.query.id
}
params.tag = attachment.tag
}
getImplementationAttachment(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
searchFileList(params).then(res => {
showTable.value = false
if (res.code === 1000) {
otherFileList.value = res.data
otherFileList.value = res.data.fileList
uploadState.value = res.data.upload
nextTick(() => {
showTable.value = true
})
}else{
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
@@ -143,8 +141,9 @@ const handleDownload = (row) => {
a.click()
})
}
getTagsOption()
handleSearch()
getTagsOption()
</script>
<style scoped>