fix : 重新提交全流程初步完成

This commit is contained in:
2024-05-20 23:01:53 +08:00
parent 6c80652416
commit 3270aeef06
12 changed files with 280 additions and 189 deletions

View File

@@ -19,18 +19,17 @@
</div>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
<el-button color="#DED0B2" @click="handleResubmit">重新提交</el-button>
<el-button color="#DED0B2" @click="handleResubmit(applyForm)">重新提交</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getProjectCheckProcess, projectCheck} 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'
import {getDetail, resubmitReported} from "../../project-demand/summary/api";
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
@@ -83,11 +82,11 @@ const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
// if(JSON.stringify(file.value) == "{}"){
// applyForm.value.validate()
// }else {
// applyForm.value.clearValidate()
// }
if(JSON.stringify(file.value) === "{}"){
attachment.value.validate()
}else {
attachment.value.clearValidate()
}
if (!valid) return
let files = []
let singleFile={}
@@ -111,11 +110,11 @@ const handleSubmit = (instance) => {
let params = {
deploymentId: deploymentId.value,
requirementId: route.query.id,
files: files,
fileList: files,
singleFile: singleFile,
projectId:route.query.projectId,
}
console.log('params',params)
console.log('params-提交',params)
let res = await projectCheck(params)
ElNotification({
title: '提示',
@@ -130,61 +129,70 @@ const handleSubmit = (instance) => {
}
})
}
const handleResubmit = () => {
let singleFile = {}
let otherFiles = []
let fileArray
if(name.value === 'Implementation/edit'){
singleFile = {
fileId: attachment.value.singleFile.fileId
const handleResubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let singleFile = {}
let otherFiles = []
let fileArray
if (JSON.stringify(file.value) === "{}"||attachment.value.singleFile===null) {
attachment.value.validate()
} else {
attachment.value.clearValidate()
}
fileArray=attachment.value.allFileList
}else {
if (file.value.fileId !== undefined) {
if (attachment.value.singleFile!==null&&name.value === 'Implementation/edit') {
singleFile = {
fileId: file.value.fileId
fileId: attachment.value.singleFile.fileId
}
fileArray = attachment.value.allFileList
} else {
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
fileArray = otherFileList.value
}
fileArray=otherFileList.value
}
fileArray.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,
projectId: route.query.projectId,
}
console.log('重新提交params', params)
resubmitCheck(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Implementation'
})
}
})
})
//todo requirementId
let params={
deploymentId: deploymentId.value,
requirementId: route.query.id,
files: otherFiles,
singleFile: singleFile,
projectId:route.query.projectId,
}
console.log('重新提交params',params)
// resubmitReported(params).then(res => {
// ElNotification({
// title: '提示',
// message: res.msg,
// type: res.code === 1000 ? 'success' : 'error'
// })
// if (res.code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// router.push({
// name: 'Implementation'
// })
// }
// })
}
const getDetailInfo = async () => {
// getDetail(route.query.projectId).then(res => {
// ElNotification({
// title: '提示',
// message: res.msg,
// type: res.code === 1000 ? 'success' : 'error'
// })
// if (res.code === 1000) {
// formData.value = res.data.formData
// loading.value=false
// }
// })
getCheckDetail(route.query.projectId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
formData.value = res.data.formData
loading.value=false
}
})
}
const init = () => {
getProjectCheckProcess().then(res => {
@@ -206,12 +214,11 @@ const init = () => {
})
}
onMounted(async () => {
loading.value=true
await init()
if (route.query.projectId) {
if (name.value === 'Implementation/edit'){
loading.value=true
await getDetailInfo()
}
})
</script>