fix : 修复项目归档中附件上传问题

This commit is contained in:
2024-06-05 11:40:31 +08:00
parent d676868cf7
commit ca64562059
4 changed files with 93 additions and 117 deletions

View File

@@ -1,24 +1,8 @@
<template>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="需求征集" name="00">
<search-files-by-tag @search="searchRequirement" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="需求上报" name="10">
<search-files-by-tag @search="searchReport" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目立项" name="20">
<search-files-by-tag @search="searchInitiation" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目实施" name="40">
<search-files-by-tag type="40" @search="searchImplementation" @upload="upload" ref="implementation"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目归档" name="50">
<search-files-by-tag @search="searchFiling" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
<el-tab-pane v-for="item in paneList" :label="item.label" :name="item.name">
<search-files-by-tag @search="search" @upload="upload" :type="item.name==='40'?'40':''"
:fileList="fileList" :uploadState="uploadState" v-model:loading="loading"/>
</el-tab-pane>
</el-tabs>
</template>
@@ -31,78 +15,52 @@ const route = useRoute()
const router = useRouter()
const activeName = ref('50')
const attachment = ref({})
const implementation = ref()
const loading = ref(false)
const uploadState = ref(true)
const otherFileList = ref([])
const fileList = ref([])
const projectId = ref(route.query.id)
const requirementId = ref(route.query.requirementId)
const handleClick = (tab) => {
switchSearch(tab.props.name)
}
const switchSearch = (index) => {
switch (index) {
case '00':
searchRequirement({})
break
case '10':
searchReport({})
break
case '20':
searchInitiation({})
break
case '40':
searchImplementation({})
break
case '50':
searchFiling({})
break
const paneList=ref([
{
label:'需求征集',
name:'00'
},
{
label:'需求上报',
name:'10'
},
{
label:'项目立项',
name:'20'
},
{
label:'项目实施',
name:'40'
},
{
label:'项目归档',
name:'50'
}
])
const handleClick = (tab) => {
activeName.value=tab.props.name
loading.value=true
search({})
}
const searchRequirement = async (param) => {
param.targetState = '00'
const search = async (param) => {
param.targetState = activeName.value
param.targetId = projectId.value
searchFileList(param).then(res => {
loading.value=false
changeFileList(res)
})
}
const searchReport = async (param) => {
param.targetState = '10'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchInitiation = async (param) => {
param.targetState = '20'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchImplementation = async (param) => {
param.targetState = '40'
param.targetId = projectId.value
console.log('param',param)
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchFiling = async (param) => {
param.targetState = '50'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const changeFileList = (res) => {
if (res.code === 1000) {
otherFileList.value = res.data.fileList
fileList.value = res.data.fileList
uploadState.value = res.data.upload
} else {
ElNotification({
@@ -113,14 +71,6 @@ const changeFileList = (res) => {
}
}
onMounted(() => {
if (activeName.value === '50') {
searchFiling({})
}
})
const upload = () => {
if (activeName.value === '40') {
router.push({
@@ -140,6 +90,12 @@ const upload = () => {
})
}
}
onMounted(() => {
if (activeName.value === '50') {
search({})
}
})
</script>
<style scoped lang="scss">

View File

@@ -97,7 +97,7 @@ const getTagsOption = () => {
const handleSearch = () => {
let params = {
targetId: route.query.id,
targetState: "30"
targetState: "40"
}
if (attachment.tag) {
tagsOption.value.forEach(item => {

View File

@@ -139,8 +139,7 @@ const handleSubmit = async (instance) => {
let params = {
fileList: fileList.value,
projectId: route.query.id,
tag: formData.value.tagName,
targetState: "30"
targetState: "40"
}
let res = await uploadFileList(params)
ElNotification({