From ee32a69f9a7f25c37757325dc28ac7b5127dceca Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 15 十月 2019 22:23:36 +0800
Subject: [PATCH] datamanage-update

---
 src/components/tabview/index.jsx |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx
index 1fa9c17..d494727 100644
--- a/src/components/tabview/index.jsx
+++ b/src/components/tabview/index.jsx
@@ -39,7 +39,11 @@
       } else {
         tab.selected = false
       }
-      return tab.MenuID !== menu.MenuID
+      if (menu.type === 'TabForm' || menu.type === 'iframe') {
+        return tab.MenuID !== menu.MenuID
+      } else {
+        return tab.MenuNo !== menu.MenuNo
+      }
     })
     if (menu.MenuID === this.state.selectedTabId) {
       tabs[0] && (tabs[0].selected = true)
@@ -59,11 +63,13 @@
   selectcomponent (view) {
     // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠�
     if (view.type === 'CommonTable') {
-      return (<Comps.CommonTable MenuNo={view.MenuNo} key={view.MenuID}/>)
+      return (<Comps.CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} key={view.MenuID}/>)
     } else if (view.type === 'DataManage') {
-      return (<Comps.DataManage MenuNo={view.MenuNo} key={view.MenuID}/>)
+      return (<Comps.DataManage MenuNo={view.MenuNo} MenuID={view.MenuID} key={view.MenuID}/>)
     } else if (view.type === 'RoleManage') {
-      return (<Comps.RoleManage MenuNo={view.MenuNo} key={view.MenuID}/>)
+      return (<Comps.RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} key={view.MenuID}/>)
+    } else if (view.type === 'TabForm') {
+      return (<Comps.TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} key={view.MenuID} param={view.param}/>)
     } else if (view.type === 'iframe') {
       return (<Comps.Iframe key={view.MenuID} title={view.MenuName} url={'http://qingqiumarket.cn/MKWMS/zh-CN/' + view.LinkUrl}/>)
     } else {
@@ -111,15 +117,18 @@
       // tab绐楀彛椤靛鍔犳垨鍒犻櫎
       if (nextProps.tabviews.length > this.props.tabviews.length) {
         // 鏌ョ湅鏂皌ab椤甸渶瑕佺粍浠舵槸鍚﹀姞杞�
-        let newtab = nextProps.tabviews[nextProps.tabviews.length - 1]
+        let MenuIDs = this.props.tabviews.map(tab => {return tab.MenuID})
+        let newtab = nextProps.tabviews.filter(tab => !MenuIDs.includes(tab.MenuID))[0]
         if (!Comps.CommonTable && newtab.type === 'CommonTable') {
           Comps.CommonTable = asyncComponent(() => import('@/tabviews/commontable'))
         } else if (!Comps.Iframe && newtab.type === 'iframe') {
           Comps.Iframe = asyncComponent(() => import('@/tabviews/iframe'))
         } else if (!Comps.DataManage && newtab.type === 'DataManage') {
           Comps.DataManage = asyncComponent(() => import('@/tabviews/datamanage'))
-        } else if (!Comps.DataManage && newtab.type === 'RoleManage') {
+        } else if (!Comps.RoleManage && newtab.type === 'RoleManage') {
           Comps.RoleManage = asyncComponent(() => import('@/tabviews/rolemanage'))
+        } else if (!Comps.TabForm && newtab.type === 'TabForm') {
+          Comps.TabForm = asyncComponent(() => import('@/tabviews/tabform'))
         }
       }
 

--
Gitblit v1.8.0