import React, {Component, PropTypes} from 'react';
import {Row, Col, Form, Input, Button, Checkbox, Select, Icon,Modal } from 'antd';
import CreateVNZ from '../../types/vnz/createVNZModal';
import EditVNZ from '../../types/vnz/editVNZModal';
import style from './style.less';
import { queryListAction,deleteListData } from '../../actions';

const FormItem = Form.Item;
const Option = Select.Option;

const FilterGroup = React.createClass({
  geiInitialState(){
     return{
       values:''
     }
  },
	render() {
    const { getFieldProps } = this.props.form;
		return (
      <div className={style.filter}>
        <Form inline className={style.form} onSubmit={this.handleSubmit}>
          <CreateVNZ {...this.props} />
          <EditVNZ {...this.props} />
          <Button className={style.button} type="primary" icon="delete" onClick={this.handleDel}>删除</Button>
          <div className={style.searchBox}>
              <FormItem
                label="关键词"
                className={style.searchInp}
                >
                <Input
                  style={{width: 200}}
                  type="text"
                  name="keyword"
                  placeholder="模糊查询关键词"
                  {...getFieldProps('keyword')}
                  />
              </FormItem>
              <div className={style.searchBtn}>
                <Button
                  type="primary"
                  htmlType="submit"
                >
                  <Icon type="search"/> 搜索
                </Button>
              </div>
          </div>
        </Form>
      </div>
    );
	},
  
  //关键词改变
  handleChange(e){
    e.preventDefault();
    this.setState({
       values:e.target.value
    })
  },
  // 搜索列表
  handleSubmit(e) {
    e.preventDefault();
    let params = {
      keyword:this.props.form.getFieldValue("keyword")
    }
    this.props.dispatch(
      queryListAction(this.props.type, params)
    )
  },
  //删除列表
  handleDel(e) {
    e.preventDefault();
    let ids = this.props.ids;   
    this.props.dispatch(
      deleteListData(this.props.type, ids)
    ) 
  }
});

export default Form.create()(FilterGroup);