king
2020-05-18 ff4295358a99b2d35265a5fed445e4407cf6ed9a
src/templates/sharecomponent/tabscomponent/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { is, fromJS } from 'immutable'
import { Icon, Tooltip, Modal, notification } from 'antd'
import Utils from '@/utils/utils.js'
@@ -43,6 +43,17 @@
  }
  /**
   * @description 标签组变化时,更新标签
   */
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { tabgroups } = this.state
    if (!is(fromJS(nextProps.config.tabgroups), fromJS(this.props.config.tabgroups)) && !is(fromJS(nextProps.config.tabgroups), fromJS(tabgroups))) {
      this.setState({tabgroups: fromJS(nextProps.config.tabgroups).toJS()})
    }
  }
  /**
   * @description 元素添加或拖动时顺序变化
   */
  handleList = (list, card, groupId) => {
@@ -62,8 +73,9 @@
      this.setState({tabgroups: _tabgroups})
      this.handleTab(card, _group)
    } else {
      this.setState({tabgroups: _tabgroups})
      this.props.updatetabs({...config, tabgroups: _tabgroups})
      this.setState({tabgroups: _tabgroups}, () => {
        this.props.updatetabs({...config, tabgroups: _tabgroups})
      })
    }
  }
@@ -169,8 +181,9 @@
        group: null,
        tabgroups: tabgroups, 
        visible: false
      }, () => {
        this.props.updatetabs({...config, tabgroups: tabgroups})
      })
      this.props.updatetabs({...config, tabgroups: tabgroups})
    })
  }
  
@@ -196,8 +209,9 @@
        _this.setState({
          tabgroups: tabgroups
        }, () => {
          _this.props.updatetabs({...config, tabgroups: tabgroups}, [card])
        })
        _this.props.updatetabs({...config, tabgroups: tabgroups}, [card])
      },
      onCancel() {}
    })
@@ -229,8 +243,9 @@
        _this.setState({
          tabgroups: _tabgroups
        }, () => {
          _this.props.updatetabs({...config, tabgroups: _tabgroups})
        })
        _this.props.updatetabs({...config, tabgroups: _tabgroups})
      },
      onCancel() {}
    })
@@ -249,13 +264,13 @@
      okText: this.state.dict['model.confirm'],
      cancelText: this.state.dict['header.cancel'],
      onOk() {
        _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid)
        _this.setState({
          tabgroups: _tabgroups
        }, () => {
          _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist)
        })
        _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist)
      },
      onCancel() {}
    })
@@ -276,8 +291,9 @@
    this.setState({
      tabgroups: _tabgroups
    }, () => {
      this.props.updatetabs({...config, tabgroups: _tabgroups})
    })
    this.props.updatetabs({...config, tabgroups: _tabgroups})
    notification.success({
      top: 92,
@@ -308,8 +324,9 @@
        group: null,
        tabgroups: _tabgroups,
        visible: false
      }, () => {
        this.props.updatetabs({...config, tabgroups: _tabgroups})
      })
      this.props.updatetabs({...config, tabgroups: _tabgroups})
    } else {
      this.setState({
        card: null,