fix : 修复提交/重新提交按钮显示

This commit is contained in:
2024-05-29 21:34:37 +08:00
parent dd3f793ac2
commit 04c1175cf8
6 changed files with 116 additions and 106 deletions

View File

@@ -12,14 +12,15 @@
</el-form>
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" :preview="name === 'Initiation/edit'"/>
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData"
:preview="name === 'Initiation/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" @click="handleResubmit">重新提交</el-button>
<el-button color="#DED0B2" v-if="name==='Initiation/apply'" @click="handleSubmit(applyForm)">提交</el-button>
<el-button color="#DED0B2" v-else @click="handleResubmit">重新提交</el-button>
</div>
</div>
</template>
@@ -28,7 +29,7 @@
import {useTagsView} from '@/stores/tagsview.js'
import {ElMessage, ElNotification} from "element-plus";
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getApplyProcess, projectApply,resubmitApply,getApplyDetail} from "@/api/project-manage";
import {getApplyProcess, projectApply, resubmitApply, getApplyDetail} from "@/api/project-manage";
import {useProcessStore} from '@/stores/processStore.js';
const tagsViewStore = useTagsView()
@@ -88,10 +89,10 @@ const tableConfig = reactive({
const loading = ref(false)
const processInstanceData = ref()
const processDiagramViewer = ref(true)
const name=ref(router.currentRoute.value.name)
const name = ref(router.currentRoute.value.name)
const compositeParam = (item) => {
let tag = ''
if (name.value === 'Initiation/apply'||name.value === 'Initiation/edit') {
if (name.value === 'Initiation/apply' || name.value === 'Initiation/edit') {
tag = '项目立项申请'
}
return {
@@ -100,12 +101,12 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag:tag
tag: tag
}
}
const getAttachment = (val) => {
console.log('上传文件getAttachment', val)
file.value=compositeParam(val)
file.value = compositeParam(val)
}
const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val)
@@ -125,15 +126,15 @@ const getFileParam = (item) => {
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if(JSON.stringify(file.value) === "{}"){
if (JSON.stringify(file.value) === "{}") {
attachment.value.validate()
}else {
} else {
attachment.value.clearValidate()
}
if (!valid) return
let files = []
let singleFile={}
if(file.value.fileId!==undefined){
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
@@ -146,9 +147,9 @@ const handleSubmit = (instance) => {
requirementId: route.query.id,
fileList: files,
singleFile: singleFile,
projectId:route.query.projectId,
projectId: route.query.projectId,
}
console.log('params',params)
console.log('params', params)
let res = await projectApply(params)
ElNotification({
title: '提示',
@@ -163,27 +164,27 @@ const handleSubmit = (instance) => {
}
})
}
const handleResubmit =async () => {
const handleResubmit = async () => {
let files = []
let singleFile={}
let singleFile = {}
let fileArray
if (JSON.stringify(file.value) === "{}"||attachment.value.singleFile===null) {
if (JSON.stringify(file.value) === "{}" || attachment.value.singleFile === null) {
attachment.value.validate()
} else {
attachment.value.clearValidate()
}
if(attachment.value.singleFile!==null&&name.value === 'Initiation/edit'){
if (attachment.value.singleFile !== null && name.value === 'Initiation/edit') {
singleFile = {
fileId: attachment.value.singleFile.fileId
}
fileArray=attachment.value.allFileList
}else {
fileArray = attachment.value.allFileList
} else {
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
fileArray=otherFileList.value
fileArray = otherFileList.value
}
fileArray.forEach(item => {
files.push(getFileParam(item))
@@ -193,9 +194,9 @@ const handleResubmit =async () => {
requirementId: route.query.id,
fileList: files,
singleFile: singleFile,
projectId:route.query.projectId,
projectId: route.query.projectId,
}
console.log('params',params)
console.log('params', params)
let res = await resubmitApply(params)
ElNotification({
title: '提示',
@@ -218,11 +219,11 @@ const getDetailInfo = async () => {
})
if (res.code === 1000) {
formData.value = res.data.formData
loading.value=false
loading.value = false
}
})
}
const init = () => {
const init = () => {
getApplyProcess(route.query.projectId).then(res => {
ElNotification({
title: '提示',
@@ -232,7 +233,7 @@ const init = () => {
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;
@@ -250,7 +251,7 @@ init()
onMounted(async () => {
await init()
if (name.value === 'Initiation/edit') {
loading.value=true
loading.value = true
await getDetailInfo()
}
})