From a42c6f16bbb177dfcc754d53d925afddead38eba Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 12 十一月 2024 22:51:26 +0800 Subject: [PATCH] 包装规则中查询更新,判断存在更新 --- src/store/modules/multipleTab.ts | 38 +++++++++++++++++++++++++++----------- 1 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/store/modules/multipleTab.ts b/src/store/modules/multipleTab.ts index 0a04c2a..69cdd67 100644 --- a/src/store/modules/multipleTab.ts +++ b/src/store/modules/multipleTab.ts @@ -2,18 +2,20 @@ import { toRaw, unref } from 'vue'; import { defineStore } from 'pinia'; -import { store } from '/@/store'; +import { store } from '@/store'; -import { useGo, useRedo } from '/@/hooks/web/usePage'; -import { Persistent } from '/@/utils/cache/persistent'; +import { useGo, useRedo } from '@/hooks/web/usePage'; +import { Persistent } from '@/utils/cache/persistent'; -import { PageEnum } from '/@/enums/pageEnum'; -import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic'; -import { getRawRoute } from '/@/utils'; -import { MULTIPLE_TABS_KEY } from '/@/enums/cacheEnum'; +import { PageEnum } from '@/enums/pageEnum'; +import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '@/router/routes/basic'; +import { getRawRoute } from '@/utils'; +import { MULTIPLE_TABS_KEY } from '@/enums/cacheEnum'; -import projectSetting from '/@/settings/projectSetting'; -import { useUserStore } from '/@/store/modules/user'; +import projectSetting from '@/settings/projectSetting'; +import { useUserStore } from '@/store/modules/user'; +import { useProdRouteStore } from './prodRoute'; +import { isNullOrUnDef } from '/@/utils/is'; export interface MultipleTabState { cacheTabList: Set<string>; @@ -85,6 +87,17 @@ const { currentRoute } = router; const route = unref(currentRoute); const name = route.name; + const useProdRoute = useProdRouteStore(); + useProdRoute.setChangeToCPPage(false); + if (!isNullOrUnDef(route.params.id)) { + // 浠巗essionStorage涓鍙栧弬鏁板苟杞崲鍥炲璞� + const savedParams = sessionStorage.getItem( + `${JSON.parse(decodeURI(route.params.id[0]))['sName']}_params`, + ); + const objParams = savedParams ? JSON.parse(decodeURI(savedParams)) : {}; + useProdRoute.setCurProdRotTree({ name: objParams['CODE'], treeInfo: [] }); + useProdRoute.setCurSelectedNodes({ name: objParams['CODE'], SelectedNodes: [] }); + } const findTab = this.getCachedTabList.find((item) => item === name); if (findTab) { @@ -134,7 +147,9 @@ // Existing pages, do not add tabs repeatedly const tabHasExits = this.tabList.some((tab, index) => { updateIndex = index; - return (tab.fullPath || tab.path) === (fullPath || path); + return ( + decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path) + ); }); // If the tab already exists, perform the update operation @@ -308,7 +323,7 @@ for (const path of closePathList) { if (path !== route.fullPath) { - const closeItem = this.tabList.find((item) => item.path === path); + const closeItem = this.tabList.find((item) => item.fullPath === path); if (!closeItem) { continue; } @@ -320,6 +335,7 @@ } this.bulkCloseTabs(pathList); this.updateCacheTab(); + Persistent.setLocal(MULTIPLE_TABS_KEY, this.tabList, true); handleGotoPage(router); }, -- Gitblit v1.9.3