From 5d41cbe3722ff40b65bfa4de82d62a79f171f5a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 八月 2022 17:41:55 +0800
Subject: [PATCH] 2022-08-15

---
 src/tabviews/custom/components/tabs/antv-tabs/index.jsx |   43 +++++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
index a5159a1..483549b 100644
--- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
+++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
@@ -13,32 +13,45 @@
 
 class antvTabs extends Component {
   static propTpyes = {
-    BID: PropTypes.any,              // 椤甸潰BID
-    bids: PropTypes.any,             // 鐖剁骇Id闆�
     config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
     mainSearch: PropTypes.any,       // 澶栧眰鎼滅储鏉′欢
   }
 
   state = {
     tabs: null,
-    parentIds: [],
-    bids: {},
     activeIndex: 1
   }
 
   UNSAFE_componentWillMount () {
-    const { config, bids } = this.props
+    const { config } = this.props
 
     let _tabs = fromJS(config).toJS()
 
     if (_tabs.setting.supModule) {
       _tabs.subtabs = []
+
+      let data = window.GLOB.CacheData.get(_tabs.setting.supModule)
+
+      if (data) {
+        let val = ''
+        Object.keys(data).forEach(key => {
+          if (key.toLowerCase() === _tabs.setting.controlField) {
+            val = data[key]
+          }
+        })
+        _tabs.subtabs = config.subtabs.filter(tab => {
+          if (tab.controlVal === val) {
+            return false
+          } else if (/,/ig.test(tab.controlVal)) {
+            return !tab.controlVal.split(',').includes(val)
+          }
+          return true
+        })
+      }
     }
 
     this.setState({
-      tabs: _tabs,
-      parentIds: config.parentIds || [],
-      bids: bids ? bids : {}
+      tabs: _tabs
     })
   }
 
@@ -72,13 +85,7 @@
   }
 
   resetParentParam = (MenuID, id, data) => {
-    const { parentIds, bids, tabs } = this.state
-
-    if (parentIds.includes(MenuID)) {
-      this.setState({
-        bids: {...bids, [MenuID]: id, [MenuID + '_data']: data}
-      })
-    }
+    const { tabs } = this.state
 
     if (tabs.setting.supModule === MenuID) {
       if (!data) {
@@ -131,8 +138,8 @@
   }
 
   render() {
-    const { mainSearch, BID } = this.props
-    const { tabs, bids } = this.state
+    const { mainSearch } = this.props
+    const { tabs } = this.state
 
     if (!tabs.subtabs.length) return null
 
@@ -141,7 +148,7 @@
         <Tabs defaultActiveKey="1" tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}>
           {tabs.subtabs.map(tab => (
             <TabPane tab={<span id={'tab' + tab.uuid}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span>} style={{backgroundColor: tab.backgroundColor || 'transparent'}} key={tab.uuid}>
-              <TabTransfer BID={BID} config={tab} bids={bids} mainSearch={mainSearch}/>
+              <TabTransfer config={tab} mainSearch={mainSearch}/>
             </TabPane>
           ))}
         </Tabs>

--
Gitblit v1.8.0