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

@@ -1,7 +1,7 @@
<template>
<div class="apply-block">
<el-form :model="formData" ref="applyForm" label-width="auto" :rules="rules">
<baseTitle title="项目立项申请"></baseTitle>
<baseTitle title="项目立项"></baseTitle>
<el-row>
<el-col :span="12">
<el-form-item label="前置流程">
@@ -93,7 +93,7 @@ const name = ref(router.currentRoute.value.name)
const compositeParam = (item) => {
let tag = ''
if (name.value === 'Initiation/apply' || name.value === 'Initiation/edit') {
tag = '项目立项申请'
tag = '项目立项'
}
return {
fileId: item.id,
@@ -130,7 +130,7 @@ const handleSubmit = (instance) => {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传申请书附件',
message: '请上传附件',
type: 'error'
})
return;
@@ -148,6 +148,17 @@ const handleSubmit = (instance) => {
otherFileList.value.forEach(item => {
files.push(getFileParam(item))
})
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
let params = {
deploymentId: deploymentId.value,
requirementId: route.query.id,
@@ -155,6 +166,7 @@ const handleSubmit = (instance) => {
singleFile: singleFile,
projectId: route.query.projectId,
}
console.log('params', params)
let res = await projectApply(params)
ElNotification({
@@ -174,12 +186,12 @@ const handleResubmit = async () => {
let files = []
let singleFile = {}
let fileArray
if (JSON.stringify(file.value) === "{}" || attachment.value.singleFile === null) {
attachment.value.validate()
return;
} else {
attachment.value.clearValidate()
}
// if (JSON.stringify(file.value) === "{}" || attachment.value.singleFile === null) {
// attachment.value.validate()
// return;
// } else {
// attachment.value.clearValidate()
// }
if (attachment.value.singleFile !== null && name.value === 'Initiation/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId
@@ -203,6 +215,17 @@ const handleResubmit = async () => {
singleFile: singleFile,
projectId: route.query.projectId,
}
if (JSON.stringify(singleFile) === "{}") {
attachment.value.validate()
ElNotification({
title: '提示',
message: '请上传附件',
type: 'error'
})
return;
}else {
attachment.value.clearValidate()
}
console.log('params', params)
let res = await resubmitApply(params)
ElNotification({
@@ -232,11 +255,6 @@ const getDetailInfo = async () => {
}
const init = () => {
getApplyProcess(route.query.projectId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
processDiagramViewer.value = false
if (res.code === 1000) {
let data = res.data
@@ -251,6 +269,12 @@ const init = () => {
nextTick(() => {
processDiagramViewer.value = true
})
}else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}