fix : 修复申请文件校验

This commit is contained in:
2024-06-01 20:33:28 +08:00
parent 4a0b3db4e4
commit 346ad4c4df
6 changed files with 264 additions and 176 deletions

View File

@@ -8,14 +8,14 @@
<el-input v-model="formData.projectName" placeholder="请输入项目名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="是否专项资金" prop="isSpecialFund">
<el-radio-group v-model="formData.isSpecialFund" >
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- <el-col :span="5">-->
<!-- <el-form-item label="是否专项资金" prop="isSpecialFund">-->
<!-- <el-radio-group v-model="formData.isSpecialFund" >-->
<!-- <el-radio :label="true"></el-radio>-->
<!-- <el-radio :label="false"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="6">
<el-form-item label="专项资金" prop="specialFund" v-if="formData.isSpecialFund">
<el-select v-model="formData.specialFund" placeholder="请选择专项资金" clearable filterable>
@@ -54,12 +54,6 @@
</el-config-provider>
</el-form-item>
</el-col>
<!-- <el-form-item label="所属公司" prop="affiliatedCompanyId">-->
<!-- <el-tree-select v-model="formData.affiliatedCompanyId" :data="companyOption" style="width: 100%;"-->
<!-- filterable clearable :check-strictly="true"/>-->
<!-- </el-form-item>-->
<!-- </el-col> <el-col :span="12">-->
<el-col :span="12">
<el-form-item label="项目类型" prop="projectType">
<el-select v-model="formData.projectType" placeholder="请选择项目类型" clearable filterable>
@@ -271,7 +265,6 @@ const companyOption = ref([])
const summaryForm = ref()
const deploymentId = ref()
const specialFundOption = ref([])
const isSpecialFund = ref()
const showTable = ref(true)
const otherFileList = ref([])
const file = ref({})
@@ -284,7 +277,6 @@ const rules = reactive({
specialFund: [{required: true, message: '请选择专项资金', trigger: 'blur'}],
startTime: [{required: true, message: '请选择开始时间', trigger: 'blur'}],
rdSubject: [{required: true, message: '请输入研发主体', trigger: 'blur'}],
// affiliatedCompanyId: [{required: true, message: '请输入所属公司', trigger: 'blur'}],
projectType: [{required: true, message: '请选择项目类型', trigger: 'blur'}],
endTime: [{required: true, message: '请选择结束时间', trigger: 'blur'}],
investmentType: [{required: true, message: '请选择出资类型', trigger: 'blur'}],
@@ -305,16 +297,16 @@ const rules = reactive({
serviceDescription: [{required: true, message: '请输入现有业务描述', trigger: 'blur'}],
contentDescription: [{required: true, message: '请输入研发项目关键内容描述', trigger: 'blur'}]
})
const getIsFund = async () => {
getFormInfo(route.query.id).then(res => {
if (res.code === 1000) {
formData.value.isSpecialFund = res.data.isSpecialFund
if(res.data.isSpecialFund){
formData.value.specialFund = Number(res.data.specialFund)
}
}
})
}
// const getIsFund = async () => {
// getFormInfo(route.query.id).then(res => {
// if (res.code === 1000) {
// formData.value.isSpecialFund = res.data.isSpecialFund
// if(res.data.isSpecialFund){
// formData.value.specialFund = Number(res.data.specialFund)
// }
// }
// })
// }
const compositeParam = (item, type) => {
let tag = ''
if (name.value === 'Summary/add' || name.value === 'Summary/edit') {
@@ -351,74 +343,85 @@ const getFileParam = (item) => {
}
}
const handleSubmit = debounce(async (instance) => {
console.log('formData.value',formData.value)
if (!instance) return
instance.validate(async (valid, fields) => {
if (JSON.stringify(file.value) === "{}") {
attachment.value.validate()
} else {
attachment.value.clearValidate()
}
if (!valid) return
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
// if (JSON.stringify(file.value) === "{}") {
// attachment.value.validate()
// } else {
// attachment.value.clearValidate()
// }
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
}
let otherFiles = []
otherFileList.value.forEach(item => {
otherFiles.push(getFileParam(item))
})
// let params = {
// "specialFund": "2",
// "projectName": "重新提交全流程测试2024520",
// "startTime": "2024-05-24 00:00:00",
// "endTime": "2024-05-29 00:00:00",
// "projectType": "3",
// "investmentType": "3",
// "businessSegment": "2",
// "technicalStandard": "2",
// "governmentDeclaration": 0,
// "inventionPatent": "3",
// "newPatent": "3",
// "economicEstimate": "3",
// "other": "3",
// "copyright": "3",
// "softwareCopyright": "3",
// "industryUniversityResearch": 0,
// "intellectualProperty": "00",
// "resultForm": "3",
// "projectImpact": "3",
// "rdSubject": "3",
// // "affiliatedCompanyId": formData.value.affiliatedCompanyId,
// "serviceDescription": "3",
// "contentDescription": "3",
// "specialFundAmount": "3",
// deploymentId: deploymentId.value,
// "singleFile": singleFile,
// "fileList": otherFiles,
// "requirementId":route.query.id
// }
let params = {
...formData.value,
deploymentId: deploymentId.value,
fileList: otherFiles,
singleFile: singleFile,
requirementId: route.query.id
}
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 otherFiles = []
otherFileList.value.forEach(item => {
otherFiles.push(getFileParam(item))
})
}
// let params = {
// "specialFund": "2",
// "projectName": "测试全流程功能-上报",
// "startTime": "2024-05-24 00:00:00",
// "endTime": "2024-05-29 00:00:00",
// "projectType": "3",
// "investmentType": "3",
// "businessSegment": "2",
// "technicalStandard": "2",
// "governmentDeclaration": 0,
// "inventionPatent": "3",
// "newPatent": "3",
// "economicEstimate": "3",
// "other": "3",
// "copyright": "3",
// "softwareCopyright": "3",
// "industryUniversityResearch": 0,
// "intellectualProperty": "00",
// "resultForm": "3",
// "projectImpact": "3",
// "rdSubject": "3",
// "serviceDescription": "3",
// "contentDescription": "3",
// "specialFundAmount": "3",
// deploymentId: deploymentId.value,
// "singleFile": singleFile,
// "fileList": otherFiles,
// "requirementId":route.query.id
// }
let params = {
...formData.value,
deploymentId: deploymentId.value,
fileList: otherFiles,
singleFile: singleFile,
requirementId: route.query.id
}
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
console.log('params', params)
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(() => {
@@ -426,12 +429,12 @@ const handleResubmit = debounce(() => {
let otherFiles = []
let fileArray
if (name.value === 'Summary/edit') {
console.log('attachment.value', attachment.value.singleFile)
if (attachment.value.singleFile === null) {
attachment.value.validate()
} else {
attachment.value.clearValidate()
}
// console.log('attachment.value', attachment.value.singleFile)
// if (attachment.value.singleFile === null) {
// attachment.value.validate()
// } else {
// attachment.value.clearValidate()
// }
singleFile = {
fileId: attachment.value.singleFile?.fileId
}
@@ -455,6 +458,17 @@ const handleResubmit = debounce(() => {
singleFile: singleFile,
requirementId: route.query.id
}
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
console.log('重新提交params', params)
resubmitReported(params).then(res => {
ElNotification({
@@ -470,6 +484,7 @@ const handleResubmit = debounce(() => {
}
})
})
const getDetailInfo = async () => {
getDetail(route.query.projectId).then(res => {
ElNotification({
@@ -486,15 +501,10 @@ const getDetailInfo = async () => {
const init = async () => {
const resFund = await getFundOption()
specialFundOption.value = resFund.data
await getIsFund()
// await getIsFund()
const res = await getSubCompOpt()
companyOption.value = res.data
getProcessInfo().then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
let data = res.data
deploymentId.value = data.deploymentId
@@ -507,6 +517,12 @@ const init = async () => {
nextTick(() => {
processDiagramViewer.value = true
})
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}