From 547c91649da47f4dd8c6706e632797dbd9d79d87 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 07 十二月 2024 16:26:49 +0800
Subject: [PATCH] 工艺路线工序节点保存更新

---
 src/store/modules/multipleTab.ts |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/multipleTab.ts b/src/store/modules/multipleTab.ts
index deb7ea7..e9a65a0 100644
--- a/src/store/modules/multipleTab.ts
+++ b/src/store/modules/multipleTab.ts
@@ -15,6 +15,7 @@
 import projectSetting from '@/settings/projectSetting';
 import { useUserStore } from '@/store/modules/user';
 import { useProdRouteStore } from './prodRoute';
+import { isArray, isNullOrUnDef } from '/@/utils/is';
 
 export interface MultipleTabState {
   cacheTabList: Set<string>;
@@ -88,7 +89,15 @@
       const name = route.name;
       const useProdRoute = useProdRouteStore();
       useProdRoute.setChangeToCPPage(false);
-      useProdRoute.setCurProdRotTree([]);
+      if (!isNullOrUnDef(route.params.id) && isArray(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) {
@@ -138,7 +147,9 @@
       // Existing pages, do not add tabs repeatedly
       const tabHasExits = this.tabList.some((tab, index) => {
         updateIndex = index;
-        return decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path);
+        return (
+          decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path)
+        );
       });
 
       // If the tab already exists, perform the update operation

--
Gitblit v1.9.3