fix : 修复项目归档五个附件上传功能

This commit is contained in:
2024-06-01 19:05:11 +08:00
parent dd046f645f
commit bc27a83848
6 changed files with 91 additions and 122 deletions

View File

@@ -1,13 +1,13 @@
<template> <template>
<baseTitle title="标签名称"></baseTitle> <!-- <baseTitle title="标签名称"></baseTitle>-->
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules"> <!-- <el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">-->
<el-form-item label="标签名称" prop="tagName"> <!-- <el-form-item label="标签名称" prop="tagName">-->
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/> <!-- <el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<baseTitle title="其他文件"></baseTitle> <baseTitle title="上传附件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0"> <el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/> <file-upload @getFile="getFile" />
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false"> :data="fileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
@@ -16,7 +16,7 @@
</fvTable> </fvTable>
</el-card> </el-card>
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button> <el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
</div> </div>
</template> </template>
@@ -29,7 +29,6 @@ const tagsViewStore = useTagsView()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const fileList = ref([]) const fileList = ref([])
const tagsOption = ref([])
const formData = ref({ const formData = ref({
tagName:'' tagName:''
}) })
@@ -53,7 +52,7 @@ const tableConfig = reactive({
align: 'center' align: 'center'
}, },
{ {
prop: 'tag', prop: 'size',
label: '文件大小', label: '文件大小',
align: 'center' align: 'center'
}, },
@@ -72,28 +71,21 @@ const tableConfig = reactive({
] ]
}) })
const showTable = ref(true) const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name) const name = ref(router.currentRoute.value.name)
const rules = reactive({ const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}], tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
}) })
const compositeParam = (item) => { const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,
originalFileName: item.originalFilename, originalFileName: item.originalFilename,
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
tag: formData.value.tagName, tag:'需求征集'
} }
} }
const getFile = (val) => { const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val) let fileObj = compositeParam(val)
fileList.value.push(fileObj) fileList.value.push(fileObj)
@@ -103,21 +95,18 @@ const getFile = (val) => {
} }
const getFileParam = (item) => { const getFileParam = (item) => {
return { return {
fileId: item.fileId fileId: item.fileId,
tag:item.tag
} }
} }
const handleSubmit = async (instance) => { const handleSubmit = async () => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { fileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
let params = { let params = {
fileList: files, mosrUserFileDtoList: files,
projectId: route.query.id, projectId: route.query.id,
tag: formData.value.tagName
} }
console.log('params', params) console.log('params', params)
let res = await uploadRequirementAttachment(params) let res = await uploadRequirementAttachment(params)
@@ -135,7 +124,6 @@ const handleSubmit = async (instance) => {
} }
}) })
} }
})
} }
</script> </script>

View File

@@ -1,13 +1,13 @@
<template> <template>
<baseTitle title="标签名称"></baseTitle> <!-- <baseTitle title="标签名称"></baseTitle>-->
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules"> <!-- <el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">-->
<el-form-item label="标签名称" prop="tagName"> <!-- <el-form-item label="标签名称" prop="tagName">-->
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/> <!-- <el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<baseTitle title="其他文件"></baseTitle> <baseTitle title="上传附件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0"> <el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/> <file-upload @getFile="getFile"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false"> :data="fileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
@@ -16,7 +16,7 @@
</fvTable> </fvTable>
</el-card> </el-card>
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button> <el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
</div> </div>
</template> </template>
@@ -29,7 +29,6 @@ const tagsViewStore = useTagsView()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const fileList = ref([]) const fileList = ref([])
const tagsOption = ref([])
const formData = ref({ const formData = ref({
tagName:'' tagName:''
}) })
@@ -53,7 +52,7 @@ const tableConfig = reactive({
align: 'center' align: 'center'
}, },
{ {
prop: 'tag', prop: 'size',
label: '文件大小', label: '文件大小',
align: 'center' align: 'center'
}, },
@@ -72,28 +71,21 @@ const tableConfig = reactive({
] ]
}) })
const showTable = ref(true) const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name) const name = ref(router.currentRoute.value.name)
const rules = reactive({ const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}], tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
}) })
const compositeParam = (item) => { const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,
originalFileName: item.originalFilename, originalFileName: item.originalFilename,
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
tag: formData.value.tagName, tag:'需求上报',
} }
} }
const getFile = (val) => { const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val) let fileObj = compositeParam(val)
fileList.value.push(fileObj) fileList.value.push(fileObj)
@@ -103,21 +95,18 @@ const getFile = (val) => {
} }
const getFileParam = (item) => { const getFileParam = (item) => {
return { return {
fileId: item.fileId fileId: item.fileId,
tag:item.tag
} }
} }
const handleSubmit = async (instance) => { const handleSubmit = async () => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { fileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
let params = { let params = {
fileList: files, mosrUserFileDtoList: files,
projectId: route.query.id, projectId: route.query.id,
tag: formData.value.tagName
} }
console.log('params', params) console.log('params', params)
let res = await uploadCollectAttachment(params) let res = await uploadCollectAttachment(params)
@@ -135,7 +124,6 @@ const handleSubmit = async (instance) => {
} }
}) })
} }
})
} }
</script> </script>

View File

@@ -127,12 +127,22 @@ const changeFileList = (res) => {
} }
} }
const upload = () => { const upload = () => {
router.push({ if(activeName.value==='3'){
name: switchUpload(activeName.value), router.push({
query: { name: 'Implementation/upload',
id: route.query.id query: {
} id: route.query.id,
}) type:'3'
}
})
}else {
router.push({
name: switchUpload(activeName.value),
query: {
id: route.query.id
}
})
}
} }
const switchUpload=(index)=>{ const switchUpload=(index)=>{
switch (index) { switch (index) {

View File

@@ -1,13 +1,13 @@
<template> <template>
<baseTitle title="标签名称"></baseTitle> <!-- <baseTitle title="标签名称"></baseTitle>-->
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules"> <!-- <el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">-->
<el-form-item label="标签名称" prop="tagName"> <!-- <el-form-item label="标签名称" prop="tagName">-->
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/> <!-- <el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<baseTitle title="其他文件"></baseTitle> <baseTitle title="上传附件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0"> <el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/> <file-upload @getFile="getFile" />
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false"> :data="fileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
@@ -16,7 +16,7 @@
</fvTable> </fvTable>
</el-card> </el-card>
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button> <el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
</div> </div>
</template> </template>
@@ -29,7 +29,6 @@ const tagsViewStore = useTagsView()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const fileList = ref([]) const fileList = ref([])
const tagsOption = ref([])
const formData = ref({ const formData = ref({
tagName:'' tagName:''
}) })
@@ -53,7 +52,7 @@ const tableConfig = reactive({
align: 'center' align: 'center'
}, },
{ {
prop: 'tag', prop: 'size',
label: '文件大小', label: '文件大小',
align: 'center' align: 'center'
}, },
@@ -72,28 +71,21 @@ const tableConfig = reactive({
] ]
}) })
const showTable = ref(true) const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name) const name = ref(router.currentRoute.value.name)
const rules = reactive({ const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}], tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
}) })
const compositeParam = (item) => { const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,
originalFileName: item.originalFilename, originalFileName: item.originalFilename,
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
tag: formData.value.tagName, tag: '项目归档',
} }
} }
const getFile = (val) => { const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val) let fileObj = compositeParam(val)
fileList.value.push(fileObj) fileList.value.push(fileObj)
@@ -103,23 +95,19 @@ const getFile = (val) => {
} }
const getFileParam = (item) => { const getFileParam = (item) => {
return { return {
fileId: item.fileId fileId: item.fileId,
tag:item.tag
} }
} }
const handleSubmit = async (instance) => { const handleSubmit = async () => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { fileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
let params = { let params = {
fileList: files, mosrUserFileDtoList: files,
projectId: route.query.id, projectId: route.query.id,
tag: formData.value.tagName
} }
console.log('params', params)
let res = await uploadFilingAttachment(params) let res = await uploadFilingAttachment(params)
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -135,7 +123,6 @@ const handleSubmit = async (instance) => {
} }
}) })
} }
})
} }
</script> </script>

View File

@@ -160,12 +160,21 @@ const handleSubmit = async (instance) => {
}) })
if (res.code === 1000) { if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path) tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({ if(route.query.type=='3'){
name: 'Implementation/attachment', await router.push({
query:{ name: 'Filing/attachment',
id: route.query.id query:{
} id: route.query.id
}) }
})
}else {
await router.push({
name: 'Implementation/attachment',
query:{
id: route.query.id
}
})
}
} }
}) })
} }

View File

@@ -1,13 +1,13 @@
<template> <template>
<baseTitle title="标签名称"></baseTitle> <!-- <baseTitle title="标签名称"></baseTitle>-->
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules"> <!-- <el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">-->
<el-form-item label="标签名称" prop="tagName"> <!-- <el-form-item label="标签名称" prop="tagName">-->
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/> <!-- <el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> <!-- </el-form>-->
<baseTitle title="其他文件"></baseTitle> <baseTitle title="上传附件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0"> <el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/> <file-upload @getFile="getFile"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false"> :data="fileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
@@ -16,7 +16,7 @@
</fvTable> </fvTable>
</el-card> </el-card>
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button> <el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
</div> </div>
</template> </template>
@@ -29,7 +29,6 @@ const tagsViewStore = useTagsView()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const fileList = ref([]) const fileList = ref([])
const tagsOption = ref([])
const formData = ref({ const formData = ref({
tagName:'' tagName:''
}) })
@@ -53,7 +52,7 @@ const tableConfig = reactive({
align: 'center' align: 'center'
}, },
{ {
prop: 'tag', prop: 'size',
label: '文件大小', label: '文件大小',
align: 'center' align: 'center'
}, },
@@ -72,28 +71,21 @@ const tableConfig = reactive({
] ]
}) })
const showTable = ref(true) const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name) const name = ref(router.currentRoute.value.name)
const rules = reactive({ const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}], tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
}) })
const compositeParam = (item) => { const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,
originalFileName: item.originalFilename, originalFileName: item.originalFilename,
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
tag: formData.value.tagName, tag: '项目立项',
} }
} }
const getFile = (val) => { const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val) let fileObj = compositeParam(val)
fileList.value.push(fileObj) fileList.value.push(fileObj)
@@ -103,23 +95,19 @@ const getFile = (val) => {
} }
const getFileParam = (item) => { const getFileParam = (item) => {
return { return {
fileId: item.fileId fileId: item.fileId,
tag:item.tag
} }
} }
const handleSubmit = async (instance) => { const handleSubmit = async () => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { fileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
let params = { let params = {
fileList: files, mosrUserFileDtoList: files,
projectId: route.query.id, projectId: route.query.id,
tag: formData.value.tagName
} }
console.log('params', params)
let res = await uploadInitiationAttachment(params) let res = await uploadInitiationAttachment(params)
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -135,7 +123,6 @@ const handleSubmit = async (instance) => {
} }
}) })
} }
})
} }
</script> </script>