/*
 * @Author: your name
 * @Date: 2019-10-23 18:27:52
 * @LastEditTime : 2020-02-11 15:36:01
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \one_stop_front\src\components\libs\TableList.js
 */
import React from 'react';
import { Tree, Table, Spin } from 'antd';
import FormList from './formList';
import { connect } from 'dva';

export default class TableList extends React.Component {

  constructor(props) {
    super(props)
    const value = props.value || {};
    this.state = {
      isAll:value.isAll,
      querys: value.querys,
      sql: value.sql,
      columns:value.columns,
    }
  }

  triggerChange = (changedValue) => {
    // Should provide an event to pass value to Form.
    const onChange = this.props.onChange;
    if (onChange) {
      onChange(Object.assign({}, this.state, changedValue));
    }
  }
  componentWillReceiveProps(nextProps) {
    // Should be a controlled component.
    if ('value' in nextProps) {
      const value = nextProps.value;
      this.setState(value);
    }
  }

  render() {
    return <FormList 
                istableCom={true} 
                showHeader={this.props.showHeader} 
                isHiddenPage={
                    this.props.isHiddenPage!=null?
                          this.props.isHiddenPage
                          :false} 
                loading={this.props.loading} 
                pageSize={this.props.pageSize||10} 
                value={this.state}  
                notShowBack={true} 
                rights={this.props.rights || []} 
                objCode={this.props.objCode} 
                isFormCom={true} 
                sql={this.props.sql} />

  }
}