fix : 重新提交页面初始化

This commit is contained in:
2024-05-20 17:56:38 +08:00
parent a663b84fab
commit e648faba69
8 changed files with 270 additions and 60 deletions

View File

@@ -12,7 +12,7 @@
</el-form>
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true"/>
@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"/>
@@ -40,6 +40,7 @@ const rules = reactive({
})
const processStore = useProcessStore()
const deploymentId = ref()
const attachment = ref()
const file = ref({})
const applyForm = ref()
const showTable = ref(true)
@@ -84,21 +85,21 @@ const tableConfig = reactive({
// }
]
})
const loading = ref(false)
const processInstanceData = ref()
const processDiagramViewer = ref(true)
const compositeParam = (item, type) => {
const name=ref(router.currentRoute.value.name)
const compositeParam = (item) => {
let tag = ''
if (router.currentRoute.value.name === 'Initiation/apply') {
if (name.value === 'Initiation/apply'||name.value === 'Initiation/edit') {
tag = '项目立项申请'
}
return {
fileId: item.id,
size: item.size,
type: type,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
processNodeTag: null,
tag:tag
}
}
@@ -117,8 +118,7 @@ const getOtherFile = (val) => {
}
const getFileParam = (item) => {
return {
fileId: item.fileId,
type: item.type
fileId: item.fileId
}
}
const handleSubmit = (instance) => {
@@ -162,18 +162,59 @@ const handleSubmit = (instance) => {
}
})
}
const handleResubmit = () => {
resubmit(submitParam(formData.value)).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Collection'
})
} else {
ElMessage.error(res.msg)
const handleResubmit =async () => {
let files = []
let singleFile={}
let fileArray
if(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))
})
let params = {
deploymentId: deploymentId.value,
requirementId: route.query.id,
files: files,
singleFile: singleFile,
projectId:route.query.projectId,
}
console.log('params',params)
// let res = await resubmit(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: 'Initiation'
// })
// }
}
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
// }
// })
}
const init = () => {
getProcessInfo().then(res => {
@@ -195,6 +236,14 @@ const init = () => {
})
}
init()
onMounted(async () => {
loading.value=true
await init()
if (route.query.projectId) {
await getDetailInfo()
}
})
</script>
<style scoped>

View File

@@ -147,11 +147,11 @@ const tableConfig = reactive({
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
if (row.state === '3') {
// if (row.state === '3') {
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
} else if (row.state === '0') {
// } else if (row.state === '0') {
btn.push({label: '申请', func: () => handleApply(row), type: 'primary'})
}
// }
return (
<div style={{width: '100%'}}>
{
@@ -193,7 +193,8 @@ const handleEdit = (row) => {
router.push({
name:'Initiation/edit',
query: {
id: row.requirementId
id: row.requirementId,
projectId: row.projectId
}
})
}
@@ -201,7 +202,6 @@ const handleApply = (row) => {
router.push({
name:'Initiation/apply',
query: {
isAdd: 1,
id: row.requirementId,
projectId: row.projectId
}