fix : 修复需求上报文件上传/删除问题
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" v-if="route.query.id&&formData.specialFund">
|
||||
<el-form-item label="专项资金" prop="specialFundId" >
|
||||
<el-col :span="6">
|
||||
<el-form-item label="专项资金" prop="specialFundId" v-if="route.query.id&&formData.specialFund">
|
||||
<span>{{ formData.specialFund }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -214,10 +214,12 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount" v-if="!route.query.id&&formData.isSpecialFund">
|
||||
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount"
|
||||
v-if="!route.query.id&&formData.isSpecialFund">
|
||||
<el-input-number v-model="formData.specialFundAmount" placeholder="请输入专项资金" :controls="false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount" v-if="route.query.id&&formData.specialFundAmount">
|
||||
<el-form-item label="其中申请公司总部科技创新专项资金(元)" prop="specialFundAmount"
|
||||
v-if="route.query.id&&formData.specialFundAmount">
|
||||
<el-input-number v-model="formData.specialFundAmount" placeholder="请输入专项资金" :controls="false"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -278,7 +280,6 @@ const deploymentId = ref()
|
||||
const specialFundOption = ref([])
|
||||
const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
const file = ref({})
|
||||
const formData = ref({
|
||||
isSpecialFund: false,
|
||||
industryUniversityResearch: '0',
|
||||
@@ -357,7 +358,6 @@ const compositeParam = (item, type) => {
|
||||
|
||||
const getAttachment = (val) => {
|
||||
console.log('上传文件getAttachment', val)
|
||||
file.value = compositeParam(val)
|
||||
formData.value.singleFile = compositeParam(val)
|
||||
}
|
||||
const getOtherFile = (val) => {
|
||||
@@ -370,6 +370,8 @@ const getOtherFile = (val) => {
|
||||
})
|
||||
}
|
||||
const getFileParam = (item) => {
|
||||
console.log('item', item)
|
||||
if (item === undefined) return;
|
||||
return {
|
||||
fileId: item.fileId,
|
||||
tag: item.tag
|
||||
@@ -385,26 +387,21 @@ const handleSubmit = debounce(async (instance) => {
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
let singleFile = {}
|
||||
if (file.value.fileId !== undefined) {
|
||||
singleFile = {
|
||||
fileId: file.value.fileId
|
||||
}
|
||||
}
|
||||
let otherFiles = []
|
||||
otherFileList.value.forEach(item => {
|
||||
otherFiles.push(getFileParam(item))
|
||||
})
|
||||
if (formData.value.singleFile !== undefined) {
|
||||
formData.value.singleFile = getFileParam(formData.value.singleFile)
|
||||
}
|
||||
let params = {
|
||||
...formData.value,
|
||||
// isSpecialFund: formData.value.isSpecialFund ? formData.value.isSpecialFund : false,
|
||||
deploymentId: deploymentId.value,
|
||||
fileList: otherFiles,
|
||||
singleFile: singleFile,
|
||||
requirementId: route.query.id ? route.query.id : '-1'
|
||||
}
|
||||
console.log('params', params, formData.value)
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
console.log('params', params)
|
||||
if (!attachment.value.isSingleFile) {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
@@ -415,52 +412,37 @@ const handleSubmit = debounce(async (instance) => {
|
||||
} else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
// let res = await requirementReported(params)
|
||||
// ElNotification({
|
||||
// title: '提示',
|
||||
// message: res.msg,
|
||||
// type: res.code === 1000 ? 'success' : 'error'
|
||||
// })
|
||||
// if (res.code === 1000) {
|
||||
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
// await router.push({
|
||||
// name: 'Summary'
|
||||
// })
|
||||
// }
|
||||
let res = await requirementReported(params)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
await router.push({
|
||||
name: 'Summary'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
const handleResubmit = debounce(() => {
|
||||
let singleFile = {}
|
||||
let otherFiles = []
|
||||
let fileArray
|
||||
if (name.value === 'Summary/edit') {
|
||||
singleFile = {
|
||||
fileId: attachment.value.singleFile?.fileId
|
||||
}
|
||||
fileArray = attachment.value.allFileList
|
||||
} else {
|
||||
if (file.value.fileId !== undefined) {
|
||||
singleFile = {
|
||||
fileId: file.value.fileId
|
||||
}
|
||||
}
|
||||
fileArray = otherFileList.value
|
||||
}
|
||||
fileArray.forEach(item => {
|
||||
otherFiles.push(getFileParam(item))
|
||||
})
|
||||
//todo requirementId
|
||||
let params = {
|
||||
...formData.value,
|
||||
// isSpecialFund: formData.value.isSpecialFund ? formData.value.isSpecialFund : false,
|
||||
deploymentId: deploymentId.value,
|
||||
fileList: otherFiles,
|
||||
singleFile: singleFile,
|
||||
requirementId: route.query.id ? route.query.id : '-1'
|
||||
}
|
||||
|
||||
console.log('重新提交params', params, formData.value)
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
if (!attachment.value.isSingleFile) {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
|
||||
@@ -156,6 +156,7 @@ const tableConfig = reactive({
|
||||
prop: 'oper',
|
||||
label: '操作',
|
||||
align: 'center',
|
||||
fixed:'right',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
let btn = []
|
||||
|
||||
Reference in New Issue
Block a user