import { Component } from 'react';

class DataPaneBasic extends Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
      filter: [],
      page: 0,
      pageSize: 10
    };
  }

  /**
   * 搜索条件改变
   * @memberof Search
   */
  onFilterChange = (name, value, type) => {
    let { filter } = this.state;
    if (value) {
      const flag = filter.some(e => {
        if (e.name === name) {
          e.value = value;
          return true;
        }
      });
      !flag && filter.push({ name, value, type });
    } else {
      filter = filter.filter(e => e.name !== name);
    }
    this.setState({ filter }, this.onSearch);
  }

  onSearch = () => {

  }
}

export default DataPaneBasic;
