|
@@ -1,140 +1,39 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
-import { Form, Icon, Input, Button, Select, Switch } from 'antd';
|
|
|
|
|
|
|
+import { Form, Select } from 'antd';
|
|
|
const FormItem = Form.Item;
|
|
const FormItem = Form.Item;
|
|
|
const { Option } = Select;
|
|
const { Option } = Select;
|
|
|
import { connect } from 'dva';
|
|
import { connect } from 'dva';
|
|
|
-import preparing from '../../../models/preparing';
|
|
|
|
|
|
|
+import chartDesigner from '../../../models/chartDesigner';
|
|
|
|
|
|
|
|
-const PreparingForm = connect(
|
|
|
|
|
- ({ present: { preparing } }) => ({
|
|
|
|
|
- preparing,
|
|
|
|
|
- }
|
|
|
|
|
-))(props => {
|
|
|
|
|
- const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched } = props.form;
|
|
|
|
|
-
|
|
|
|
|
- const formItemLayout = {
|
|
|
|
|
- labelCol: { span: 10 },
|
|
|
|
|
- wrapperCol: { span: 14 },
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const columns = [
|
|
|
|
|
- { value: 'c1', label: '列1' },
|
|
|
|
|
- { value: 'c2', label: '列2' },
|
|
|
|
|
- { value: 'c3', label: '列3' },
|
|
|
|
|
- { value: 'c4', label: '列4' },
|
|
|
|
|
- { value: 'c5', label: '列5' },
|
|
|
|
|
- { value: 'c6', label: '列6' },
|
|
|
|
|
- { value: 'c7', label: '列7' },
|
|
|
|
|
- { value: 'c8', label: '列8' },
|
|
|
|
|
- { value: 'c9', label: '列9' },
|
|
|
|
|
- { value: 'c10', label: '列10' },
|
|
|
|
|
- { value: 'c11', label: '列11' },
|
|
|
|
|
- { value: 'c12', label: '列12' },
|
|
|
|
|
- { value: 'c13', label: '列13' }
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- return (
|
|
|
|
|
- <Form layout='horizontal'>
|
|
|
|
|
- <FormItem label='分组' {...formItemLayout}>
|
|
|
|
|
- {getFieldDecorator('groupBy', {
|
|
|
|
|
- initialValue : props.preparing.groupBy
|
|
|
|
|
- })(
|
|
|
|
|
|
|
+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
|
|
<Select
|
|
|
mode="multiple"
|
|
mode="multiple"
|
|
|
|
|
+ labelInValue={true}
|
|
|
onChange={(value) => {
|
|
onChange={(value) => {
|
|
|
- props.dispatch({ type: 'preparing/set', groupBy: value});
|
|
|
|
|
|
|
+ props.dispatch({ type: 'chartDesigner/preparing/setGroupBy', groupBy: value});
|
|
|
}}
|
|
}}
|
|
|
|
|
+ value={props.chartDesigner.preparing.groupBy}
|
|
|
>
|
|
>
|
|
|
{columns.map((c, i)=>{
|
|
{columns.map((c, i)=>{
|
|
|
- return (<Option key={`column-${i}`} value={c.value}>{c.label}</Option>)
|
|
|
|
|
|
|
+ return (<Option key={i} value={c.name}>{c.label}</Option>)
|
|
|
})}
|
|
})}
|
|
|
</Select>
|
|
</Select>
|
|
|
- )}
|
|
|
|
|
- </FormItem>
|
|
|
|
|
- {/* <FormItem label='分段' {...formItemLayout}>
|
|
|
|
|
- {getFieldDecorator('bucketization', {
|
|
|
|
|
- initialValue : bucketization
|
|
|
|
|
- })(
|
|
|
|
|
- <Select mode="multiple">
|
|
|
|
|
- {bucketizations.map((b, i)=>{
|
|
|
|
|
- return (<Option key={`bucketization-${i}`} value={b.value}>{b.label}</Option>)
|
|
|
|
|
- })}
|
|
|
|
|
- </Select>
|
|
|
|
|
- )}
|
|
|
|
|
- </FormItem> */}
|
|
|
|
|
- </Form>
|
|
|
|
|
- );
|
|
|
|
|
-});
|
|
|
|
|
-export default Form.create()(PreparingForm);
|
|
|
|
|
-
|
|
|
|
|
-// class PreparingForm extends React.Component {
|
|
|
|
|
-
|
|
|
|
|
-// constructor(props) {
|
|
|
|
|
-// super(props);
|
|
|
|
|
-// this.state = {
|
|
|
|
|
-// config: props.config
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-// componentDidMount() {
|
|
|
|
|
-// // To disabled submit button at the beginning.
|
|
|
|
|
-// this.props.form.validateFields();
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-// render() {
|
|
|
|
|
-// const { config } = this.state;
|
|
|
|
|
-// const { groupBy } = config;
|
|
|
|
|
-
|
|
|
|
|
-// const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched } = this.props.form;
|
|
|
|
|
-
|
|
|
|
|
-// const formItemLayout = {
|
|
|
|
|
-// labelCol: { span: 10 },
|
|
|
|
|
-// wrapperCol: { span: 14 },
|
|
|
|
|
-// };
|
|
|
|
|
-
|
|
|
|
|
-// const columns = [
|
|
|
|
|
-// { value: 'c1', label: '列1' },
|
|
|
|
|
-// { value: 'c2', label: '列2' },
|
|
|
|
|
-// { value: 'c3', label: '列3' },
|
|
|
|
|
-// { value: 'c4', label: '列4' },
|
|
|
|
|
-// { value: 'c5', label: '列5' },
|
|
|
|
|
-// { value: 'c6', label: '列6' },
|
|
|
|
|
-// { value: 'c7', label: '列7' },
|
|
|
|
|
-// { value: 'c8', label: '列8' },
|
|
|
|
|
-// { value: 'c9', label: '列9' },
|
|
|
|
|
-// { value: 'c10', label: '列10' },
|
|
|
|
|
-// { value: 'c11', label: '列11' },
|
|
|
|
|
-// { value: 'c12', label: '列12' },
|
|
|
|
|
-// { value: 'c13', label: '列13' }
|
|
|
|
|
-// ];
|
|
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Form>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
-// return (
|
|
|
|
|
-// <Form layout='horizontal'>
|
|
|
|
|
-// <FormItem label='分组' {...formItemLayout}>
|
|
|
|
|
-// {getFieldDecorator('groupBy', {
|
|
|
|
|
-// initialValue : groupBy
|
|
|
|
|
-// })(
|
|
|
|
|
-// <Select mode="multiple">
|
|
|
|
|
-// {columns.map((c, i)=>{
|
|
|
|
|
-// return (<Option key={`column-${i}`} value={c.value}>{c.label}</Option>)
|
|
|
|
|
-// })}
|
|
|
|
|
-// </Select>
|
|
|
|
|
-// )}
|
|
|
|
|
-// </FormItem>
|
|
|
|
|
-// {/* <FormItem label='分段' {...formItemLayout}>
|
|
|
|
|
-// {getFieldDecorator('bucketization', {
|
|
|
|
|
-// initialValue : bucketization
|
|
|
|
|
-// })(
|
|
|
|
|
-// <Select mode="multiple">
|
|
|
|
|
-// {bucketizations.map((b, i)=>{
|
|
|
|
|
-// return (<Option key={`bucketization-${i}`} value={b.value}>{b.label}</Option>)
|
|
|
|
|
-// })}
|
|
|
|
|
-// </Select>
|
|
|
|
|
-// )}
|
|
|
|
|
-// </FormItem> */}
|
|
|
|
|
-// </Form>
|
|
|
|
|
-// );
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+function mapStateToProps({ present: { chartDesigner } }) {
|
|
|
|
|
+ return { chartDesigner: chartDesigner }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-// export default Form.create()(PreparingForm);
|
|
|
|
|
|
|
+export default Form.create()(connect(mapStateToProps)(PreparingForm));
|