dataViewConfigForm.jsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import React from 'react';
  2. import { Form, Icon, Input, Button, Select, Switch, Checkbox, InputNumber } from 'antd';
  3. const FormItem = Form.Item;
  4. const { Option } = Select;
  5. const CheckboxGroup = Checkbox.Group;
  6. class DataViewConfigForm extends React.Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. }
  11. }
  12. componentDidMount() {
  13. // To disabled submit button at the beginning.
  14. this.props.form.validateFields();
  15. }
  16. onChange(checkedList) {
  17. console.log(checkedList);
  18. }
  19. render() {
  20. const columns = [
  21. { value: 'c1', label: '列1' },
  22. { value: 'c2', label: '列2' },
  23. { value: 'c3', label: '列3' },
  24. { value: 'c4', label: '列4' },
  25. { value: 'c5', label: '列5' },
  26. ];
  27. let targetColumn = ['c3'];
  28. let rows = 3;
  29. let sort = 'asc';
  30. const gaugeOptions = [
  31. { value: 'z-score', label: '偏差值', checked: true }
  32. ];
  33. let filterFunc = function(option) {
  34. return option.checked == true;
  35. }
  36. const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched } = this.props.form;
  37. const formItemLayout = {
  38. labelCol: { span: 10 },
  39. wrapperCol: { span: 14 },
  40. };
  41. return (
  42. <Form layout='horizontal'>
  43. <FormItem label='分析目标' {...formItemLayout}>
  44. {getFieldDecorator('targetColumn', {
  45. rules: [{ required: true, message: '分析目标不能为空' }],
  46. initialValue : targetColumn
  47. })(
  48. <Select mode='multiple'>
  49. {columns.map((c, i)=>{
  50. return (<Option key={`c-${i}`} value={c.value}>{c.label}</Option>)
  51. })}
  52. </Select>
  53. )}
  54. </FormItem>
  55. {/* <FormItem label='横轴' {...formItemLayout}>
  56. {getFieldDecorator('x', {
  57. initialValue : targetColumn
  58. })(
  59. <Select mode='multiple'>
  60. {columns.map((c, i)=>{
  61. return (<SelectOption key={`x-${i}`} value={c.value}>{c.label}</SelectOption>)
  62. })}
  63. </Select>
  64. )}
  65. </FormItem>
  66. <FormItem label='纵轴' {...formItemLayout}>
  67. {getFieldDecorator('y', {
  68. initialValue : targetColumn
  69. })(
  70. <Select mode='multiple'>
  71. {columns.map((c, i)=>{
  72. return (<SelectOption key={`y-${i}`} value={c.value}>{c.label}</SelectOption>)
  73. })}
  74. </Select>
  75. )}
  76. </FormItem> */}
  77. </Form>
  78. );
  79. }
  80. }
  81. export default Form.create()(DataViewConfigForm);