king
2020-11-25 42fae277ae5ebe794fc070bf38482a919eb661fc
src/templates/sharecomponent/searchcomponent/index.jsx
@@ -18,10 +18,7 @@
class SearchComponent extends Component {
  static propTpyes = {
    menu: PropTypes.object,          // 当前菜单信息
    config: PropTypes.object,        // 配置信息
    pasteContent: PropTypes.object,  // 粘贴配置信息
    sysRoles: PropTypes.array,       // 角色列表,黑名单
    updatesearch: PropTypes.func     // 更新
  }
@@ -48,10 +45,12 @@
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { searchlist } = this.state
    if (nextProps.pasteContent && nextProps.pasteContent.copyType === 'search') {
      this.setState({searchlist: [...searchlist, nextProps.pasteContent]})
      this.handleSearch(nextProps.pasteContent)
    } else if (!is(fromJS(nextProps.config.search), fromJS(this.props.config.search)) && !is(fromJS(nextProps.config.search), fromJS(searchlist))) {
    if (!is(fromJS(nextProps.config.search), fromJS(this.props.config.search)) && !is(fromJS(nextProps.config.search), fromJS(searchlist))) {
      let len = nextProps.config.search.length
      let item = nextProps.config.search[len - 1]
      if (item.copyType && item.focus) {
        this.handleSearch(item)
      }
      this.setState({searchlist: fromJS(nextProps.config.search).toJS()})
    }
  }
@@ -91,7 +90,7 @@
    this.setState({
      visible: true,
      card: card,
      formlist: getSearchForm(card, this.props.sysRoles, linkableFields)
      formlist: getSearchForm(card, linkableFields)
    })
  }
@@ -99,18 +98,18 @@
   * @description 取消保存,如果元素为新添元素,则从序列中删除
   */
  editModalCancel = () => {
    const { card } = this.state
    const { config } = this.props
    const { card, searchlist } = this.state
    if (card.focus) {
      let searchlist = fromJS(this.state.searchlist).toJS()
      searchlist = searchlist.filter(item => item.uuid !== card.uuid)
      let _searchlist = searchlist.filter(item => item.uuid !== card.uuid)
      this.setState({
        card: null,
        searchlist: searchlist,
        searchlist: _searchlist,
        visible: false
      })
      this.props.updatesearch({...config, search: _searchlist})
    } else {
      this.setState({
        card: null,