From c92c6073d8528ce5013e2408118fa32dbdff7c26 Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Thu, 15 Jan 2026 11:43:35 +0800 Subject: [PATCH] =?UTF-8?q?fix-=E6=89=93=E5=BC=80=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=8A=A5=E5=AE=A1=E7=95=8C=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=93=8D=E4=BD=9C=E6=88=91=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=88=96=E8=AD=A6=E5=91=98=E4=B8=AD=E5=BF=83=E7=AD=89?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=8A=9F=E8=83=BD=E6=97=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=A6=96=E9=A1=B5=E6=93=8D=E4=BD=9C=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.ts | 18 ++++++++-------- src/views/report/edit/controlPrice.vue | 29 +++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/permission.ts b/src/permission.ts index a3a7aa2..042cc14 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -19,15 +19,15 @@ NProgress.configure({ showSpinner: false }) const whiteList: string[] = [PageEnum.LOGIN, '/support', '/401', '/work/verifySubmit'] router.beforeEach(async (to, from, next) => { const tabsStore = useTabsStore(); - const tabList = tabsStore.tabList; - if(tabList && delPathList.indexOf(from.path) >= 0){ - console.log('删除tag标签',from) - const index = tabList.findIndex((item) => item.path == from.path); - // 移除tab - if (tabList.length > 1) { - index !== -1 && tabList.splice(index, 1) - } - } + // const tabList = tabsStore.tabList; + // if(tabList && delPathList.indexOf(from.path) >= 0){ + // console.log('删除tag标签',from) + // const index = tabList.findIndex((item) => item.path == from.path); + // // 移除tab + // if (tabList.length > 1) { + // index !== -1 && tabList.splice(index, 1) + // } + // } // 开始 Progress Bar NProgress.start() if (whiteList.includes(to.path)) { diff --git a/src/views/report/edit/controlPrice.vue b/src/views/report/edit/controlPrice.vue index c560232..abf9603 100644 --- a/src/views/report/edit/controlPrice.vue +++ b/src/views/report/edit/controlPrice.vue @@ -787,11 +787,34 @@ watch(()=>formData.value.project.applicantId,(val)=>{ },{deep:true,immediate:true}) +// 添加缓存变量 +const pageCache = ref({ + isEnd: null, + isInitialized: false +}); + +onUnmounted(() => { + // 组件销毁时清理缓存 + pageCache.value = { + isEnd: null, + isInitialized: false + }; +}); //监测是否是结算项目报审 watch(() => route.query.isEnd, (val) => { - if(val){ - isEndData.value = val === 'true'; + if (pageCache.value.isEnd !== null && !route.query.id) { + isEndData.value = pageCache.value.isEnd; + if (!formData.value.project.reportType) { + formData.value.project.reportType = isEndData.value ? '结算项目' : '项目控制价'; + } + return; + } + // 第一次加载且有参数 + if (val !== undefined && !pageCache.value.isInitialized) { + pageCache.value.isEnd = val === 'true'; + pageCache.value.isInitialized = true; + isEndData.value = pageCache.value.isEnd; if (isEndData.value) { formData.value.project.reportType = '结算项目' } else { @@ -799,7 +822,7 @@ watch(() => route.query.isEnd, (val) => { } }else{ //关闭窗口 - useTabsStore().removeTab('/report/edit/controlPrice', router); + // useTabsStore().removeTab('/report/edit/controlPrice', router); } }, {deep: true, immediate: true})