| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import React from 'react';
- import { Form, Select } from 'antd';
- const FormItem = Form.Item;
- const { Option } = Select;
- import { connect } from 'dva';
- import chartDesigner from '../../../models/chartDesigner';
- class PreparingForm extends React.Component {
- render() {
- const props = this.props;
- const columns = props.chartDesigner.columns;
- const { formItemLayout } = props
-
- return (
- <Form layout='horizontal'>
- <FormItem label='分组' {...formItemLayout}>
- <Select
- mode="multiple"
- labelInValue={true}
- placeholder='请选择...'
- onChange={(value) => {
- props.dispatch({ type: 'chartDesigner/setModel', name: 'preparing', value: { ...props.chartDesigner.preparing, groupBy: value } });
- }}
- value={props.chartDesigner.preparing.groupBy}
- >
- {columns.map((c, i)=>{
- return (<Option key={i} value={c.name}>{c.label}</Option>)
- })}
- </Select>
- </FormItem>
- </Form>
- );
- }
- };
- function mapStateToProps({ present: { chartDesigner } }) {
- return { chartDesigner: chartDesigner }
- }
- export default connect(mapStateToProps)(PreparingForm);
|