From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 四月 2025 12:18:03 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/tabs/antv-tabs/index.jsx |   98 +++++++++++++++++++++++++++++++------------------
 1 files changed, 62 insertions(+), 36 deletions(-)

diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
index 0476bf0..ea63ca4 100644
--- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
+++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx
@@ -13,27 +13,47 @@
 
 class antvTabs extends Component {
   static propTpyes = {
-    BID: PropTypes.any,              // 椤甸潰BID
-    bids: PropTypes.any,             // 鐖剁骇Id闆�
     config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
-    mainSearch: PropTypes.any,       // 澶栧眰鎼滅储鏉′欢
-    menuType: 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.$pass) return true
+    
+          return !tab.controlVals.includes(val)
+        })
+      } else {
+        _tabs.subtabs = config.subtabs.filter(tab => {
+          if (tab.$pass) return true
+    
+          return tab.controlVals.includes('@pass_empty@')
+        })
+      }
+    }
 
     this.setState({
-      tabs: fromJS(config).toJS(),
-      parentIds: config.parentIds || [],
-      bids: bids ? bids : {}
+      tabs: _tabs
     })
   }
 
@@ -47,8 +67,13 @@
     if (config.setting.autoSwitch === 'true' && config.subtabs.length > 1 && config.setting.interval) {
       this.autoSwitch(config.setting.interval)
     }
-    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
 
+    if (config.activeKey) {
+      let node = document.getElementById('tab' + config.activeKey)
+      node && node.click()
+    }
+
+    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
   }
 
   /**
@@ -62,29 +87,29 @@
   }
 
   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 || data[tabs.setting.controlField] === undefined) {
-        this.setState({
-          tabs: {...tabs, subtabs: this.props.config.subtabs}
-        })
-      } else {
-        let val = data[tabs.setting.controlField]
+      if (!data) {
         this.setState({
           tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => {
-            if (tab.controlVal === val) {
-              return false
-            } else if (/,/ig.test(tab.controlVal)) {
-              return tab.controlVal.split(',').includes(val)
-            }
-            return true
+            if (tab.$pass) return true
+    
+            return tab.controlVals.includes('@pass_empty@')
+          })}
+        })
+      } else {
+        let val = ''
+        Object.keys(data).forEach(key => {
+          if (key.toLowerCase() === tabs.setting.controlField) {
+            val = data[key] + ''
+          }
+        })
+        this.setState({
+          tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => {
+            if (tab.$pass) return true
+    
+            return !tab.controlVals.includes(val)
           })}
         })
       }
@@ -116,15 +141,16 @@
   }
 
   render() {
-    const { mainSearch, BID } = this.props
-    const { tabs, bids } = this.state
+    const { tabs } = this.state
+
+    if (!tabs.subtabs.length) return null
 
     return (
-      <div className={'menu-antv-tabs-wrap ' + tabs.setting.tabLabel} style={tabs.style}>
-        <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}>
+      <div className={`menu-antv-tabs-wrap ${tabs.setting.tabLabel || ''} ${tabs.setting.cusClass || ''} align-${tabs.setting.tabAlign || ''}`} id={'anchor' + tabs.uuid} style={tabs.style}>
+        <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}/>
+            <TabPane tab={<span className={tab.taType || ''} id={'tab' + tab.uuid}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span>} style={{backgroundColor: tab.backgroundColor || 'transparent'}} key={tab.uuid}>
+              <TabTransfer config={tab}/>
             </TabPane>
           ))}
         </Tabs>

--
Gitblit v1.8.0