fix : 修复阶段变更/详情/编辑功能
This commit is contained in:
@@ -2,21 +2,21 @@
|
||||
<div class="apply-block">
|
||||
<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 === 'Phase/edit'"/>
|
||||
<div class="approval-record">
|
||||
<baseTitle title="流程"></baseTitle>
|
||||
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
|
||||
</div>
|
||||
<div class="oper-page-btn">
|
||||
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
|
||||
<el-button color="#DED0B2" v-if="name==='Phase/change'" @click="handleSubmit">提交</el-button>
|
||||
<el-button color="#DED0B2" v-else @click="handleResubmit">重新提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
||||
import {getProjectCheckProcess, projectCheck, getCheckDetail, resubmitCheck} from "@/api/project-manage";
|
||||
import {getPhaseProcess,submitPhaseChange,getPhaseForm,resubmitPhaseForm} from "@/api/project-manage";
|
||||
import {ElNotification} from "element-plus";
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
@@ -29,7 +29,6 @@ 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)
|
||||
const otherFileList = ref([])
|
||||
@@ -47,7 +46,7 @@ const compositeParam = (item) => {
|
||||
originalFileName: item.originalFilename,
|
||||
fileType: item.fileType,
|
||||
url: item.url,
|
||||
newFile: true,
|
||||
newFile: false,
|
||||
tag: tag
|
||||
}
|
||||
}
|
||||
@@ -71,27 +70,16 @@ const getFileParam = (item) => {
|
||||
tag: item.tag
|
||||
}
|
||||
}
|
||||
const handleSubmit = (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
if (JSON.stringify(file.value) === "{}") {
|
||||
attachment.value.validate()
|
||||
} else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
if (!valid) return
|
||||
const handleSubmit =async () => {
|
||||
let files = []
|
||||
let singleFile = {}
|
||||
let fileArray
|
||||
|
||||
if (file.value.fileId !== undefined) {
|
||||
singleFile = {
|
||||
fileId: file.value.fileId
|
||||
}
|
||||
}
|
||||
fileArray = otherFileList.value
|
||||
|
||||
fileArray.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
@@ -102,24 +90,87 @@ const handleSubmit = (instance) => {
|
||||
singleFile: singleFile,
|
||||
projectId: route.query.projectId,
|
||||
}
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请上传附件',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
console.log('params-提交', params)
|
||||
// let res = await projectCheck(params)
|
||||
// ElNotification({
|
||||
// title: '提示',
|
||||
// message: res.msg,
|
||||
// type: res.code === 1000 ? 'success' : 'error'
|
||||
// })
|
||||
// if (res.code === 1000) {
|
||||
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
// await router.push({
|
||||
// name: 'Implementation'
|
||||
// })
|
||||
// }
|
||||
})
|
||||
let res = await submitPhaseChange(params)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
await router.push({
|
||||
name: 'Implementation'
|
||||
})
|
||||
}
|
||||
}
|
||||
const handleResubmit = (instance) => {
|
||||
let singleFile = {}
|
||||
let otherFiles = []
|
||||
let fileArray
|
||||
if (attachment.value.singleFile!==null&&name.value === 'Phase/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 => {
|
||||
otherFiles.push(getFileParam(item))
|
||||
})
|
||||
//todo requirementId
|
||||
let params = {
|
||||
deploymentId: deploymentId.value,
|
||||
requirementId: route.query.id,
|
||||
fileList: otherFiles,
|
||||
singleFile: singleFile,
|
||||
projectId: route.query.projectId,
|
||||
}
|
||||
if (JSON.stringify(singleFile) === "{}") {
|
||||
attachment.value.validate()
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请上传附件',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
console.log('重新提交params', params)
|
||||
resubmitPhaseForm(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 init = async () => {
|
||||
const {msg, code,data} = await getProjectCheckProcess(route.query.projectId)
|
||||
const {msg, code,data} = await getPhaseProcess()
|
||||
processDiagramViewer.value = false
|
||||
if (code === 1000) {
|
||||
deploymentId.value = data.deploymentId
|
||||
@@ -141,8 +192,25 @@ const init = async () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const getDetailInfo = async () => {
|
||||
getPhaseForm(route.query.projectId).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
formData.value = res.data
|
||||
loading.value=false
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(async () => {
|
||||
// await init()
|
||||
await init()
|
||||
if (name.value === 'Phase/edit'){
|
||||
loading.value=true
|
||||
await getDetailInfo()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user