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

@@ -2,9 +2,9 @@
<div class="apply-block">
<el-form :model="formData" ref="applyForm" label-width="auto" :rules="rules">
<baseTitle title="项目结项"></baseTitle>
<AttachmentUpload label="项目结项附件" :showTable="showTable" :otherFileList="otherFileList"
<AttachmentUpload ref="attachment" label="项目结项附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true"/>
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" :preview="name === 'Filing/edit'"/>
<div class="approval-record">
<baseTitle title="流程"></baseTitle>
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
@@ -12,6 +12,7 @@
</el-form>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
<el-button color="#DED0B2" @click="handleResubmit">重新提交</el-button>
</div>
</div>
</template>
@@ -23,12 +24,16 @@ import {downloadFile} from "@/api/project-demand";
import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {getProjectConclusionProcess, projectConclusion} from "@/api/project-manage";
const router = useRouter()
const route = useRoute()
const tagsViewStore = useTagsView()
const formData = ref({})
const rules = reactive({
attachment: [{required: true, message: '请上传项目结项附件', trigger: 'blur'}],
})
const attachment = ref()
const name=ref(router.currentRoute.value.name)
const loading = ref(false)
const file = ref({})
const applyForm = ref()
const deploymentId = ref()
@@ -37,8 +42,6 @@ const otherFileList = ref([])
const processInstanceData = ref()
const processDiagramViewer = ref(true)
const processStore = useProcessStore()
const router = useRouter()
const route = useRoute()
const tableConfig = reactive({
columns: [
{
@@ -90,7 +93,7 @@ const handleDownload = (row) => {
}
const compositeParam = (item) => {
let tag = ''
if (router.currentRoute.value.name === 'Filing/conclusion') {
if (name.value === 'Filing/conclusion'||name.value === 'Filing/edit') {
tag = '项目结项'
}
return {
@@ -99,7 +102,6 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
processNodeTag: null,
tag: tag
}
}
@@ -119,8 +121,7 @@ const getOtherFile = (val) => {
const getFileParam = (item) => {
return {
fileId: item.fileId,
type: item.type
fileId: item.fileId
}
}
const handleSubmit = (instance) => {
@@ -165,6 +166,62 @@ const handleSubmit = (instance) => {
}
})
}
const handleResubmit = () => {
let singleFile = {}
let otherFiles = []
let fileArray
if(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
}
fileArray.forEach(item => {
otherFiles.push(getFileParam(item))
})
//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: 'Filing'
// })
// }
// })
}
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 = () => {
getProjectConclusionProcess().then(res => {
processDiagramViewer.value = false
@@ -184,7 +241,14 @@ const init = () => {
}
})
}
init()
onMounted(async () => {
loading.value=true
await init()
if (route.query.projectId) {
await getDetailInfo()
}
})
</script>
<style scoped>

View File

@@ -146,12 +146,13 @@ const tableConfig = reactive({
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'},{label: '结项', func: () => handleConclusion(row), type: 'primary'}]
if (row.state === '3') {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
// if (row.state === '3') {
btn.push({label: '附件', func: () => handleCheck(row), type: 'primary'})
} else if (row.state === '4') {
// } else if (row.state === '4') {
btn.push({label: '结项', func: () => handleConclusion(row), type: 'primary'})
}
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
// }
return (
<div style={{width: '100%'}}>
{
@@ -197,4 +198,13 @@ const handleConclusion = (row) => {
}
})
}
const handleEdit = (row) => {
router.push({
name:'Filing/edit',
query: {
id: row.requirementId,
projectId: row.projectId
}
})
}
</script>