Merge pull request 'fix : 修改提交/重新提交功能文件传参问题' (#301) from dj into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/301
This commit is contained in:
2024-06-07 12:37:11 +00:00
5 changed files with 72 additions and 134 deletions

View File

@@ -115,7 +115,7 @@ const tableConfig = reactive({
)) ))
} }
{ {
row.newFile||props.preview ? <popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'} row.newFile||props.preview||!props.preview ? <popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
perm={['mosr:requirement:del']} perm={['mosr:requirement:del']}
onDelete={() => handleDelete(row)}/> onDelete={() => handleDelete(row)}/>
: '' : ''

View File

@@ -428,21 +428,19 @@ const handleSubmit = debounce(async (instance) => {
}) })
const handleResubmit = debounce(() => { const handleResubmit = debounce(() => {
let otherFiles = [] let otherFiles = []
let fileArray
if (name.value === 'Summary/edit') { if (name.value === 'Summary/edit') {
fileArray = attachment.value.allFileList attachment.value.allFileList.forEach(item => {
}
fileArray.forEach(item => {
otherFiles.push(getFileParam(item)) otherFiles.push(getFileParam(item))
}) })
}
let params = { let params = {
...formData.value, ...formData.value,
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
fileList: otherFiles, fileList: otherFiles,
requirementId: route.query.id ? route.query.id : '-1' requirementId: route.query.id ? route.query.id : '-1'
} }
console.log('重新提交params', params, formData.value) console.log('重新提交params', params)
if (!attachment.value.isSingleFile&&!formData.value.singleFile) { if (!attachment.value.isSingleFile || !formData.value.singleFile) {
attachment.value.validate() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',

View File

@@ -109,7 +109,6 @@ const compositeParam = (item) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
file.value = compositeParam(val)
formData.value.singleFile = compositeParam(val) formData.value.singleFile = compositeParam(val)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
@@ -130,23 +129,20 @@ const getFileParam = (item) => {
} }
const handleSubmit = async () => { const handleSubmit = async () => {
let files = [] let files = []
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
otherFileList.value.forEach(item => { otherFileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
if (formData.value.singleFile !== undefined) {
formData.value.singleFile = getFileParam(formData.value.singleFile)
}
let params = { let params = {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
fileList: files, fileList: files,
singleFile: singleFile, singleFile: formData.value.singleFile,
projectId: route.query.projectId, projectId: route.query.projectId,
} }
if (JSON.stringify(singleFile) === "{}") { if (!attachment.value.isSingleFile) {
attachment.value.validate() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -172,34 +168,20 @@ const handleSubmit = async () => {
} }
} }
const handleResubmit = () => { const handleResubmit = () => {
let singleFile = {}
let otherFiles = [] let otherFiles = []
let fileArray if (name.value === 'Filing/edit') {
if (attachment.value.singleFile !== null && name.value === 'Filing/edit') { attachment.value.allFileList?.forEach(item => {
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)) otherFiles.push(getFileParam(item))
}) })
//todo requirementId }
let params = { let params = {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
fileList: otherFiles, fileList: otherFiles,
singleFile: singleFile, singleFile: formData.value.singleFile,
projectId: route.query.projectId, projectId: route.query.projectId,
} }
if (JSON.stringify(singleFile) === "{}") { if (!attachment.value.isSingleFile || !formData.value.singleFile) {
attachment.value.validate() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',

View File

@@ -12,7 +12,8 @@
</el-form> </el-form>
<AttachmentUpload ref="attachment" label="项目验收附件" :showTable="showTable" :otherFileList="otherFileList" <AttachmentUpload ref="attachment" label="项目验收附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment" @getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" :preview="name === 'Implementation/edit'"/> @getOtherFile="getOtherFile" :showFileList="true" :formData="formData"
:preview="name === 'Implementation/edit'"/>
<div class="approval-record"> <div class="approval-record">
<baseTitle title="流程"></baseTitle> <baseTitle title="流程"></baseTitle>
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/> <process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
@@ -30,6 +31,7 @@ import {getProjectCheckProcess, projectCheck,getCheckDetail,resubmitCheck} from
import {ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js'; import {useProcessStore} from '@/stores/processStore.js';
import {useTagsView} from '@/stores/tagsview.js' import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView() const tagsViewStore = useTagsView()
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@@ -37,7 +39,6 @@ const attachment = ref()
const name = ref(router.currentRoute.value.name) const name = ref(router.currentRoute.value.name)
const loading = ref(false) const loading = ref(false)
const formData = ref({}) const formData = ref({})
const file = ref({})
const applyForm = ref() const applyForm = ref()
const deploymentId = ref() const deploymentId = ref()
const showTable = ref(true) const showTable = ref(true)
@@ -62,7 +63,6 @@ const compositeParam = (item) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
file.value=compositeParam(val)
formData.value.singleFile = compositeParam(val) formData.value.singleFile = compositeParam(val)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
@@ -86,32 +86,20 @@ const handleSubmit = (instance) => {
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
let files = [] let files = []
let singleFile={} otherFileList.value.forEach(item => {
let fileArray
if(name.value === 'Implementation/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 => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
if (formData.value.singleFile !== undefined) {
formData.value.singleFile = getFileParam(formData.value.singleFile)
}
let params = { let params = {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
fileList: files, fileList: files,
singleFile: singleFile, singleFile: formData.value.singleFile,
projectId: route.query.projectId, projectId: route.query.projectId,
} }
if (JSON.stringify(singleFile) === "{}") { if (!attachment.value.isSingleFile) {
attachment.value.validate() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -141,34 +129,21 @@ const handleResubmit = (instance) => {
if (!instance) return if (!instance) return
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
let singleFile = {}
let otherFiles = [] let otherFiles = []
let fileArray if (name.value === 'Implementation/edit') {
if (attachment.value.singleFile!==null&&name.value === 'Implementation/edit') { attachment.value.allFileList?.forEach(item => {
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)) otherFiles.push(getFileParam(item))
}) })
//todo requirementId }
let params = { let params = {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
fileList: otherFiles, fileList: otherFiles,
singleFile: singleFile, singleFile: formData.value.singleFile,
projectId: route.query.projectId, projectId: route.query.projectId,
} }
if (JSON.stringify(singleFile) === "{}") { if (!attachment.value.isSingleFile || !formData.value.singleFile) {
attachment.value.validate() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',

View File

@@ -10,7 +10,7 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList" <AttachmentUpload ref="attachment" label="项目立项附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment" @getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" @getOtherFile="getOtherFile" :showFileList="true" :formData="formData"
:preview="name === 'Initiation/edit'"/> :preview="name === 'Initiation/edit'"/>
@@ -43,7 +43,6 @@ const rules = reactive({
const processStore = useProcessStore() const processStore = useProcessStore()
const deploymentId = ref() const deploymentId = ref()
const attachment = ref() const attachment = ref()
const file = ref({})
const applyForm = ref() const applyForm = ref()
const showTable = ref(true) const showTable = ref(true)
const otherFileList = ref([]) const otherFileList = ref([])
@@ -114,7 +113,6 @@ const compositeParam = (item) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
file.value = compositeParam(val)
formData.value.singleFile = compositeParam(val) formData.value.singleFile = compositeParam(val)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
@@ -137,16 +135,20 @@ const handleSubmit = (instance) => {
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
let files = [] let files = []
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
otherFileList.value.forEach(item => { otherFileList.value.forEach(item => {
files.push(getFileParam(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() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -157,13 +159,6 @@ const handleSubmit = (instance) => {
} else { } else {
attachment.value.clearValidate() attachment.value.clearValidate()
} }
let params = {
deploymentId: deploymentId.value,
requirementId: route.query.id,
fileList: files,
singleFile: singleFile,
projectId: route.query.projectId,
}
console.log('params', params) console.log('params', params)
let res = await projectApply(params) let res = await projectApply(params)
ElNotification({ ElNotification({
@@ -181,32 +176,21 @@ const handleSubmit = (instance) => {
} }
const handleResubmit = async () => { const handleResubmit = async () => {
let files = [] let files = []
let singleFile = {} if (name.value === 'Initiation/edit') {
let fileArray attachment.value.allFileList.forEach(item => {
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
}
fileArray.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
}
let params = { let params = {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
fileList: files, fileList: files,
singleFile: singleFile, singleFile: formData.value.singleFile,
projectId: route.query.projectId, 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() attachment.value.validate()
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -217,7 +201,6 @@ const handleResubmit = async () => {
} else { } else {
attachment.value.clearValidate() attachment.value.clearValidate()
} }
console.log('params', params)
let res = await resubmitApply(params) let res = await resubmitApply(params)
ElNotification({ ElNotification({
title: '提示', title: '提示',