diff --git a/src/components/AttachmentUpload.vue b/src/components/AttachmentUpload.vue index 9d3c72d..d8fc3e1 100644 --- a/src/components/AttachmentUpload.vue +++ b/src/components/AttachmentUpload.vue @@ -376,6 +376,11 @@ const handleDelete = (row, type) => { }else{ isHaveOneFile.value=true } + if(localStorage.getItem('collectData')){ + let collectData=JSON.parse(localStorage.getItem('collectData')) + collectData.fileList=allFileList.value + localStorage.setItem('collectData', JSON.stringify(collectData)) + } } } }); diff --git a/src/views/project-demand/summary/add.vue b/src/views/project-demand/summary/add.vue index ffb3aa4..9ba9dd6 100644 --- a/src/views/project-demand/summary/add.vue +++ b/src/views/project-demand/summary/add.vue @@ -14,7 +14,7 @@ - + @@ -26,7 +26,7 @@ placeholder="开始时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" - style="width: 100%" + style="width: 100%" @change="changeCollectData" /> @@ -43,14 +43,14 @@ value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" :disabled="!formData.startTime" - :disabled-date="disabledDate" + :disabled-date="disabledDate" @change="changeCollectData" /> - + - + - + - + - + - + - + - + - + @@ -213,7 +213,7 @@ - + - + - + - - + - + - + @@ -268,14 +268,14 @@ @@ -395,14 +395,53 @@ const rules = reactive({ serviceDescription: [{required: true, message: '请输入现有业务描述', trigger: ['blur', 'change']}], contentDescription: [{required: true, message: '请输入研发项目关键内容描述', trigger: ['blur', 'change']}] }) +// watch(() => otherFileList.value, (newVal) => { +// console.log('newVal',newVal) +// otherFileList.value=newVal +// changeCollectData() +// }, {deep: true}) +watch(() => singleList.value, (newVal) => { + showSingleTable.value = newVal.length !== 0; +}, {deep: true}) localStorage.removeItem('originallySelectedList') +if(localStorage.getItem('collectData')){ + let collectData=JSON.parse(localStorage.getItem('collectData')) + if(collectData.fileList){ + if (name.value === 'Summary/edit') { + attachment.value.allFileList=collectData.fileList + }else { + otherFileList.value=collectData.fileList + } + } + if(collectData.optionalChargeLeadership){ + optionalChargeLeadershipList.value=collectData.optionalChargeLeadership + } + formData.value=collectData +} + +const changeCollectData=()=>{ + let params = { + ...formData.value, + deploymentId: deploymentId.value, + fileList: [], + requirementId: route.query.id ? route.query.id : '-1' + } + if (name.value === 'Summary/edit') { + params.fileList= attachment.value.allFileList + }else { + params.fileList= otherFileList.value + } + localStorage.setItem('collectData', JSON.stringify(params)) +} const handleShowOptionalChargeLeadershipPicker = () => { optionalChargeLeadershipPickerRef.value.showUserPicker() } const optionalChargeLeaderPickerOkOrCancel = (userList) => { optionalChargeLeadershipList.value = userList + formData.value.optionalChargeLeadership = optionalChargeLeadershipList.value + changeCollectData() } const handleBack = () => { @@ -479,15 +518,9 @@ const getOtherFile = (val) => { nextTick(() => { showTable.value = true }) +changeCollectData() } -// watch(() => otherFileList.value, (newVal) => { -// console.log('newVal',newVal) -// showTable.value = newVal.length !== 0; -// console.log('showTable.value',showTable.value) -// }, {deep: true}) -watch(() => singleList.value, (newVal) => { - showSingleTable.value = newVal.length !== 0; -}, {deep: true}) + const getFileParam = (item) => { if (item === undefined) return; return { @@ -495,6 +528,7 @@ const getFileParam = (item) => { tag: item.tag } } + const handleSubmit = debounce(async (instance) => { if (!instance) return instance.validate(async (valid, fields) => { @@ -535,18 +569,19 @@ const handleSubmit = debounce(async (instance) => { requirementId: route.query.id ? route.query.id : '-1' } console.log('params', params) - let res = await requirementReported(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: 'Summary' - }) - } + // let res = await requirementReported(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: 'Summary' + // }) + // localStorage.removeItem('collectData') + // } }) }) const handleResubmit = debounce((instance) => { @@ -599,6 +634,7 @@ const handleResubmit = debounce((instance) => { router.push({ name: 'Summary' }) + localStorage.removeItem('collectData') } }) }) @@ -623,6 +659,7 @@ const getDetailInfo = async () => { } const specialFundChange = () => { processInfo() + changeCollectData() } const init = async () => { await getIsFund()