From a5b4c85bd599fcc47f60a48f4f1f608182224618 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 27 Oct 2017 15:47:17 +0800 Subject: [PATCH] Change advanced form layout --- src/routes/List/TableList.js | 161 +++++++++++++++++++++++---------- src/routes/List/TableList.less | 17 ++-- 2 files changed, 125 insertions(+), 53 deletions(-) diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index 0ca42b24..0f5ceda7 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; -import { Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message } from 'antd'; +import { Row, Col, Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message } from 'antd'; import StandardTable from '../../components/StandardTable'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; @@ -152,8 +152,120 @@ export default class TableList extends PureComponent { }); } + renderSimpleForm() { + const { getFieldDecorator } = this.props.form; + return ( +
+ + + + {getFieldDecorator('no')( + + )} + + + + + {getFieldDecorator('status')( + + )} + + + + + + + + 展开 + + + + +
+ ); + } + + renderAdvancedForm() { + const { getFieldDecorator } = this.props.form; + return ( +
+ + + + {getFieldDecorator('no')( + + )} + + + + + {getFieldDecorator('status')( + + )} + + + + + {getFieldDecorator('number')( + + )} + + + + + + + {getFieldDecorator('date')( + + )} + + + + + {getFieldDecorator('status3')( + + )} + + + + + {getFieldDecorator('status4')( + + )} + + + +
+ + + + + 收起 + + +
+
+ ); + } + + renderForm() { + return this.state.expandForm ? this.renderAdvancedForm() : this.renderSimpleForm(); + } + render() { - const { rule: { loading: ruleLoading, data }, form: { getFieldDecorator } } = this.props; + const { rule: { loading: ruleLoading, data } } = this.props; const { selectedRows, modalVisible, addInputValue } = this.state; const menu = ( @@ -168,50 +280,7 @@ export default class TableList extends PureComponent {
-
-
- - {getFieldDecorator('no')( - - )} - - - {getFieldDecorator('status')( - - )} - - - - - - {this.state.expandForm ? '收起' : '展开'} - - -
- { - this.state.expandForm && ( -
- - {getFieldDecorator('updatedAt')( - - )} - - - {getFieldDecorator('callNo')( - } - placeholder="请输入" - style={{ width: 272 }} - /> - )} - -
- ) - } -
+ {this.renderForm()}
diff --git a/src/routes/List/TableList.less b/src/routes/List/TableList.less index cbdd43db..aaa64315 100644 --- a/src/routes/List/TableList.less +++ b/src/routes/List/TableList.less @@ -10,13 +10,16 @@ } } -.tableListForm :global(.ant-form-item) { - margin-right: 48px; - margin-bottom: 8px; -} - -.formButton { - white-space: nowrap; +.tableListForm { + :global { + .ant-form-item { + margin-bottom: 24px; + display: flex; + } + .ant-form-item-control-wrapper { + flex: 1; + } + } } @media screen and (max-width: @screen-lg) { -- GitLab