From da64ab0923bf8817fc8599a6e37b953ce38f64c8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 八月 2023 18:37:36 +0800 Subject: [PATCH] 2023-08-27 --- src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 38 ++++++++++++++++++++------------------ 1 files changed, 20 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 69b47b4..5fce84e 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -14,7 +14,6 @@ class antvTabs extends Component { static propTpyes = { config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 - mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 } state = { @@ -36,16 +35,19 @@ let val = '' Object.keys(data).forEach(key => { if (key.toLowerCase() === _tabs.setting.controlField) { - val = data[key] + 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 + 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@') }) } } @@ -90,23 +92,24 @@ if (tabs.setting.supModule === MenuID) { if (!data) { this.setState({ - tabs: {...tabs, subtabs: []} + tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { + 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] + val = data[key] + '' } }) 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(val) })} }) } @@ -138,7 +141,6 @@ } render() { - const { mainSearch } = this.props const { tabs } = this.state if (!tabs.subtabs.length) return null @@ -148,7 +150,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 config={tab} mainSearch={mainSearch}/> + <TabTransfer config={tab}/> </TabPane> ))} </Tabs> -- Gitblit v1.8.0