From ab744f965257e832d17869418bd96233bd63a756 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 03 一月 2022 14:31:56 +0800 Subject: [PATCH] 2022-01-03 --- src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 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 a7f34c7..4b8ef58 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -29,8 +29,9 @@ UNSAFE_componentWillMount () { const { config, bids } = this.props + this.setState({ - tabs: config, + tabs: fromJS(config).toJS(), parentIds: config.parentIds || [], bids: bids ? bids : {} }) @@ -61,13 +62,33 @@ } resetParentParam = (MenuID, id, data) => { - const { parentIds, bids } = this.state + const { parentIds, bids, tabs } = this.state - if (!parentIds.includes(MenuID)) return + if (parentIds.includes(MenuID)) { + this.setState({ + bids: {...bids, [MenuID]: id, [MenuID + '_data']: data} + }) + } - this.setState({ - bids: {...bids, [MenuID]: id, [MenuID + '_data']: data} - }) + 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] + 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 + })} + }) + } + } } autoSwitch = (interval) => { -- Gitblit v1.8.0