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})