fix : 修改提交/重新提交功能文件传参问题
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||
<AttachmentUpload ref="attachment" label="项目立项附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||
@getAttachment="getAttachment"
|
||||
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData"
|
||||
:preview="name === 'Initiation/edit'"/>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
import { ElNotification} from "element-plus";
|
||||
import {ElNotification} from "element-plus";
|
||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
||||
import {getApplyProcess, projectApply, resubmitApply, getApplyDetail} from "@/api/project-manage";
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
@@ -43,7 +43,6 @@ const rules = reactive({
|
||||
const processStore = useProcessStore()
|
||||
const deploymentId = ref()
|
||||
const attachment = ref()
|
||||
const file = ref({})
|
||||
const applyForm = ref()
|
||||
const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
@@ -114,7 +113,6 @@ const compositeParam = (item) => {
|
||||
}
|
||||
const getAttachment = (val) => {
|
||||
console.log('上传文件getAttachment', val)
|
||||
file.value = compositeParam(val)
|
||||
formData.value.singleFile = compositeParam(val)
|
||||
}
|
||||
const getOtherFile = (val) => {
|
||||
@@ -137,16 +135,20 @@ const handleSubmit = (instance) => {
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
let files = []
|
||||
let singleFile = {}
|
||||
if (file.value.fileId !== undefined) {
|
||||
singleFile = {
|
||||
fileId: file.value.fileId
|
||||
}
|
||||
}
|
||||
otherFileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
if (formData.value.singleFile !== undefined) {
|
||||
formData.value.singleFile = getFileParam(formData.value.singleFile)
|
||||
}
|
||||
let params = {
|
||||
deploymentId: deploymentId.value,
|
||||
requirementId: route.query.id,
|
||||
fileList: files,
|
||||
singleFile: formData.value.singleFile,
|
||||
projectId: route.query.projectId,
|
||||
}
|
||||
if (!attachment.value.isSingleFile) {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
@@ -157,13 +159,6 @@ const handleSubmit = (instance) => {
|
||||
} else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
let params = {
|
||||
deploymentId: deploymentId.value,
|
||||
requirementId: route.query.id,
|
||||
fileList: files,
|
||||
singleFile: singleFile,
|
||||
projectId: route.query.projectId,
|
||||
}
|
||||
console.log('params', params)
|
||||
let res = await projectApply(params)
|
||||
ElNotification({
|
||||
@@ -181,32 +176,21 @@ const handleSubmit = (instance) => {
|
||||
}
|
||||
const handleResubmit = async () => {
|
||||
let files = []
|
||||
let singleFile = {}
|
||||
let fileArray
|
||||
if (attachment.value.singleFile !== null && name.value === 'Initiation/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
|
||||
if (name.value === 'Initiation/edit') {
|
||||
attachment.value.allFileList.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
}
|
||||
fileArray.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
|
||||
let params = {
|
||||
deploymentId: deploymentId.value,
|
||||
requirementId: route.query.id,
|
||||
fileList: files,
|
||||
singleFile: singleFile,
|
||||
singleFile: formData.value.singleFile,
|
||||
projectId: route.query.projectId,
|
||||
}
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
console.log('params', params, attachment.value.isSingleFile)
|
||||
if (!attachment.value.isSingleFile || !formData.value.singleFile) {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
@@ -217,7 +201,6 @@ const handleResubmit = async () => {
|
||||
} else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
console.log('params', params)
|
||||
let res = await resubmitApply(params)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
|
||||
Reference in New Issue
Block a user