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

@@ -10,15 +10,16 @@
</el-col>
</el-row>
</el-form>
<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 === 'Implementation/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>
</div>
</div>
</template>
@@ -29,7 +30,13 @@ import {getProjectCheckProcess, projectCheck} 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()
const attachment = ref()
const name=ref(router.currentRoute.value.name)
const loading = ref(false)
const formData = ref({})
const file = ref({})
const applyForm = ref()
@@ -39,11 +46,9 @@ const otherFileList = ref([])
const processInstanceData = ref()
const processDiagramViewer = ref(true)
const processStore = useProcessStore()
const router = useRouter()
const route = useRoute()
const compositeParam = (item) => {
let tag=''
if(router.currentRoute.value.name==='Implementation/check'){
if(name.value==='Implementation/check'||name.value === 'Implementation/edit'){
tag='项目验收'
}
return {
@@ -52,7 +57,6 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
processNodeTag: null,
tag: tag
}
}
@@ -72,8 +76,7 @@ const getOtherFile = (val) => {
const getFileParam = (item) => {
return {
fileId: item.fileId,
type: item.type
fileId: item.fileId
}
}
const handleSubmit = (instance) => {
@@ -88,12 +91,21 @@ const handleSubmit = (instance) => {
if (!valid) return
let files = []
let singleFile={}
if(file.value.fileId!==undefined){
let fileArray
if(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
}
otherFileList.value.forEach(item => {
fileArray.forEach(item => {
files.push(getFileParam(item))
})
let params = {
@@ -118,6 +130,62 @@ const handleSubmit = (instance) => {
}
})
}
const handleResubmit = () => {
let singleFile = {}
let otherFiles = []
let fileArray
if(name.value === 'Implementation/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: '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
// }
// })
}
const init = () => {
getProjectCheckProcess().then(res => {
processDiagramViewer.value = false
@@ -137,7 +205,14 @@ const init = () => {
}
})
}
init()
onMounted(async () => {
loading.value=true
await init()
if (route.query.projectId) {
await getDetailInfo()
}
})
</script>
<style scoped>

View File

@@ -150,15 +150,16 @@ const tableConfig = reactive({
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'},{label: '验收', func: () => handleCheck(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'},
{label: '编辑', func: () => handleEdit(row), type: 'primary'},
{label: '台账', func: () => handleStandingBook(row), type: 'primary'},
{label: '附件', func: () => handleAttachment(row), type: 'primary'},
{label: '查看分摊', func: () => handleShare(row), type: 'primary'}
)
}
// }
return (
<div style={{width: '100%'}}>
{
@@ -207,6 +208,15 @@ const handleCheck = (row) => {
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Implementation/edit',
query: {
id: row.requirementId,
projectId: row.projectId
}
})
}
const handleStandingBook = (row) => {
router.push({
name: 'Implementation/account',