From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index 4b8ef58..e098179 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -30,8 +30,14 @@ UNSAFE_componentWillMount () { const { config, bids } = this.props + let _tabs = fromJS(config).toJS() + + if (_tabs.setting.supModule) { + _tabs.subtabs = [] + } + this.setState({ - tabs: fromJS(config).toJS(), + tabs: _tabs, parentIds: config.parentIds || [], bids: bids ? bids : {} }) @@ -71,12 +77,12 @@ } if (tabs.setting.supModule === MenuID) { - if (!data || data[tabs.setting.controlField] === undefined) { + if (!data) { this.setState({ - tabs: {...tabs, subtabs: this.props.config.subtabs} + tabs: {...tabs, subtabs: []} }) } else { - let val = data[tabs.setting.controlField] + let val = data[tabs.setting.controlField] === undefined ? '' : data[tabs.setting.controlField] + '' this.setState({ tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { if (tab.controlVal === val) { @@ -119,11 +125,13 @@ const { mainSearch, BID } = this.props const { tabs, bids } = 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}> + <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>} key={tab.uuid}> + <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> ))} -- Gitblit v1.8.0