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']}
onDelete={() => handleDelete(row)}/>
: ''

View File

@@ -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: '提示',

View File

@@ -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,

View File

@@ -12,7 +12,8 @@
</el-form>
<AttachmentUpload ref="attachment" label="项目验收附件" :showTable="showTable" :otherFileList="otherFileList"
@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">
<baseTitle title="流程"></baseTitle>
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
@@ -26,18 +27,18 @@
<script setup lang="jsx">
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getProjectCheckProcess, projectCheck,getCheckDetail,resubmitCheck} from "@/api/project-manage";
import {getProjectCheckProcess, projectCheck, getCheckDetail, resubmitCheck} from "@/api/project-manage";
import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
const attachment = ref()
const name=ref(router.currentRoute.value.name)
const name = ref(router.currentRoute.value.name)
const loading = ref(false)
const formData = ref({})
const file = ref({})
const applyForm = ref()
const deploymentId = ref()
const showTable = ref(true)
@@ -46,9 +47,9 @@ const processInstanceData = ref()
const processDiagramViewer = ref(true)
const processStore = useProcessStore()
const compositeParam = (item) => {
let tag=''
if(name.value==='Implementation/check'||name.value === 'Implementation/edit'){
tag='项目验收'
let tag = ''
if (name.value === 'Implementation/check' || name.value === 'Implementation/edit') {
tag = '项目验收'
}
return {
fileId: item.id,
@@ -62,7 +63,6 @@ const compositeParam = (item) => {
}
const getAttachment = (val) => {
console.log('上传文件getAttachment', val)
file.value=compositeParam(val)
formData.value.singleFile = compositeParam(val)
}
const getOtherFile = (val) => {
@@ -86,32 +86,20 @@ const handleSubmit = (instance) => {
instance.validate(async (valid) => {
if (!valid) return
let files = []
let singleFile={}
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 => {
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,
projectId:route.query.projectId,
singleFile: formData.value.singleFile,
projectId: route.query.projectId,
}
if (JSON.stringify(singleFile) === "{}") {
if (!attachment.value.isSingleFile) {
attachment.value.validate()
ElNotification({
title: '提示',
@@ -119,10 +107,10 @@ const handleSubmit = (instance) => {
type: 'error'
})
return;
}else {
} else {
attachment.value.clearValidate()
}
console.log('params-提交',params)
console.log('params-提交', params)
let res = await projectCheck(params)
ElNotification({
title: '提示',
@@ -141,34 +129,21 @@ const handleResubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let singleFile = {}
let otherFiles = []
let fileArray
if (attachment.value.singleFile!==null&&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
if (name.value === 'Implementation/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: '提示',
@@ -176,7 +151,7 @@ const handleResubmit = (instance) => {
type: 'error'
})
return;
}else {
} else {
attachment.value.clearValidate()
}
console.log('重新提交params', params)
@@ -204,16 +179,16 @@ const getDetailInfo = async () => {
})
if (res.code === 1000) {
formData.value = res.data.formData
loading.value=false
loading.value = false
}
})
}
const init = () => {
const init = () => {
getProjectCheckProcess(route.query.projectId).then(res => {
processDiagramViewer.value = false
if (res.code === 1000) {
let data = res.data
deploymentId.value=data.deploymentId
deploymentId.value = data.deploymentId
processInstanceData.value = data
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
@@ -224,7 +199,7 @@ const init = () => {
nextTick(() => {
processDiagramViewer.value = true
})
}else {
} else {
ElNotification({
title: '提示',
message: res.msg,
@@ -235,8 +210,8 @@ const init = () => {
}
onMounted(async () => {
await init()
if (name.value === 'Implementation/edit'){
loading.value=true
if (name.value === 'Implementation/edit') {
loading.value = true
await getDetailInfo()
}
})

View File

@@ -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: '提示',