king
2023-08-27 da64ab0923bf8817fc8599a6e37b953ce38f64c8
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>