From 27bc6ea89fcf73f110fbb11135c0c78f88d383e6 Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Fri, 7 Jun 2024 20:36:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4/?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=8F=90=E4=BA=A4=E5=8A=9F=E8=83=BD=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BC=A0=E5=8F=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AttachmentUpload.vue | 2 +- src/views/project-demand/summary/add.vue | 12 ++- .../project-management/filing/conclusion.vue | 46 +++------- .../implementation/check.vue | 87 +++++++------------ .../project-management/initiation/apply.vue | 59 +++++-------- 5 files changed, 72 insertions(+), 134 deletions(-) diff --git a/src/components/AttachmentUpload.vue b/src/components/AttachmentUpload.vue index 81ebf81..e8c8533 100644 --- a/src/components/AttachmentUpload.vue +++ b/src/components/AttachmentUpload.vue @@ -115,7 +115,7 @@ const tableConfig = reactive({ )) } { - row.newFile||props.preview ? handleDelete(row)}/> : '' diff --git a/src/views/project-demand/summary/add.vue b/src/views/project-demand/summary/add.vue index 9215685..1c2eeeb 100644 --- a/src/views/project-demand/summary/add.vue +++ b/src/views/project-demand/summary/add.vue @@ -428,21 +428,19 @@ const handleSubmit = debounce(async (instance) => { }) const handleResubmit = debounce(() => { let otherFiles = [] - let fileArray if (name.value === 'Summary/edit') { - fileArray = attachment.value.allFileList + attachment.value.allFileList.forEach(item => { + otherFiles.push(getFileParam(item)) + }) } - fileArray.forEach(item => { - otherFiles.push(getFileParam(item)) - }) let params = { ...formData.value, deploymentId: deploymentId.value, fileList: otherFiles, requirementId: route.query.id ? route.query.id : '-1' } - console.log('重新提交params', params, formData.value) - if (!attachment.value.isSingleFile&&!formData.value.singleFile) { + console.log('重新提交params', params) + if (!attachment.value.isSingleFile || !formData.value.singleFile) { attachment.value.validate() ElNotification({ title: '提示', diff --git a/src/views/project-management/filing/conclusion.vue b/src/views/project-management/filing/conclusion.vue index 07e6734..ddf32f4 100644 --- a/src/views/project-management/filing/conclusion.vue +++ b/src/views/project-management/filing/conclusion.vue @@ -109,7 +109,6 @@ const compositeParam = (item) => { } const getAttachment = (val) => { console.log('上传文件getAttachment', val) - file.value = compositeParam(val) formData.value.singleFile = compositeParam(val) } const getOtherFile = (val) => { @@ -130,23 +129,20 @@ const getFileParam = (item) => { } const handleSubmit = async () => { let files = [] - let singleFile = {} - if (file.value.fileId !== undefined) { - singleFile = { - fileId: file.value.fileId - } - } otherFileList.value.forEach(item => { files.push(getFileParam(item)) }) + if (formData.value.singleFile !== undefined) { + formData.value.singleFile = getFileParam(formData.value.singleFile) + } 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) === "{}") { + if (!attachment.value.isSingleFile) { attachment.value.validate() ElNotification({ title: '提示', @@ -154,7 +150,7 @@ const handleSubmit = async () => { type: 'error' }) return; - }else { + } else { attachment.value.clearValidate() } console.log('params', params) @@ -172,34 +168,20 @@ const handleSubmit = async () => { } } const handleResubmit = () => { - let singleFile = {} let otherFiles = [] - let fileArray - if (attachment.value.singleFile !== null && name.value === 'Filing/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 === 'Filing/edit') { + attachment.value.allFileList?.forEach(item => { + otherFiles.push(getFileParam(item)) + }) } - fileArray.forEach(item => { - otherFiles.push(getFileParam(item)) - }) - //todo requirementId let params = { deploymentId: deploymentId.value, requirementId: route.query.id, fileList: otherFiles, - singleFile: singleFile, + singleFile: formData.value.singleFile, projectId: route.query.projectId, } - if (JSON.stringify(singleFile) === "{}") { + if (!attachment.value.isSingleFile || !formData.value.singleFile) { attachment.value.validate() ElNotification({ title: '提示', @@ -207,7 +189,7 @@ const handleResubmit = () => { type: 'error' }) return; - }else { + } else { attachment.value.clearValidate() } console.log('重新提交params', params) @@ -254,7 +236,7 @@ const init = () => { nextTick(() => { processDiagramViewer.value = true }) - }else { + } else { ElNotification({ title: '提示', message: res.msg, diff --git a/src/views/project-management/implementation/check.vue b/src/views/project-management/implementation/check.vue index 29db57b..b5f18fd 100644 --- a/src/views/project-management/implementation/check.vue +++ b/src/views/project-management/implementation/check.vue @@ -12,7 +12,8 @@ + @getOtherFile="getOtherFile" :showFileList="true" :formData="formData" + :preview="name === 'Implementation/edit'"/>
@@ -26,18 +27,18 @@