Commit a5b4c85b authored by afc163's avatar afc163

Change advanced form layout

parent f81fc7da
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { connect } from 'dva'; 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 StandardTable from '../../components/StandardTable';
import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import PageHeaderLayout from '../../layouts/PageHeaderLayout';
...@@ -152,66 +152,135 @@ export default class TableList extends PureComponent { ...@@ -152,66 +152,135 @@ export default class TableList extends PureComponent {
}); });
} }
render() { renderSimpleForm() {
const { rule: { loading: ruleLoading, data }, form: { getFieldDecorator } } = this.props; const { getFieldDecorator } = this.props.form;
const { selectedRows, modalVisible, addInputValue } = this.state;
const menu = (
<Menu onClick={this.handleMenuClick} selectedKeys={[]}>
<Menu.Item key="remove">删除</Menu.Item>
<Menu.Item key="approval">批量审批</Menu.Item>
</Menu>
);
return ( return (
<PageHeaderLayout title="查询表格">
<Card bordered={false}>
<div className={styles.tableList}>
<div className={styles.tableListForm}>
<Form onSubmit={this.handleSearch} layout="inline"> <Form onSubmit={this.handleSearch} layout="inline">
<div style={{ marginBottom: 16 }}> <Row gutter={48}>
<Col span={8}>
<FormItem label="规则编号"> <FormItem label="规则编号">
{getFieldDecorator('no')( {getFieldDecorator('no')(
<Input placeholder="请输入" style={{ width: 272 }} /> <Input placeholder="请输入" />
)} )}
</FormItem> </FormItem>
</Col>
<Col span={8}>
<FormItem label="使用状态"> <FormItem label="使用状态">
{getFieldDecorator('status')( {getFieldDecorator('status')(
<Select placeholder="请选择" style={{ width: 272 }}> <Select placeholder="请选择" style={{ width: '100%' }}>
<Option value="0">关闭</Option> <Option value="0">关闭</Option>
<Option value="1">运行中</Option> <Option value="1">运行中</Option>
</Select> </Select>
)} )}
</FormItem> </FormItem>
<span className={styles.formButton}> </Col>
<Col span={8}>
<span>
<Button type="primary" htmlType="submit">查询</Button> <Button type="primary" htmlType="submit">查询</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>重置</Button> <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>重置</Button>
<a style={{ marginLeft: 8 }} onClick={this.toggleForm}> <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
{this.state.expandForm ? '收起' : '展开'} <Icon type={this.state.expandForm ? 'up' : 'down'} /> 展开 <Icon type="down" />
</a> </a>
</span> </span>
</div> </Col>
{ </Row>
this.state.expandForm && ( </Form>
<div style={{ marginBottom: 16 }}> );
<FormItem label="更新时间"> }
{getFieldDecorator('updatedAt')(
<DatePicker style={{ width: 272 }} /> renderAdvancedForm() {
const { getFieldDecorator } = this.props.form;
return (
<Form onSubmit={this.handleSearch} layout="inline">
<Row gutter={48}>
<Col span={8}>
<FormItem label="规则编号">
{getFieldDecorator('no')(
<Input placeholder="请输入" />
)}
</FormItem>
</Col>
<Col span={8}>
<FormItem label="使用状态">
{getFieldDecorator('status')(
<Select placeholder="请选择" style={{ width: '100%' }}>
<Option value="0">关闭</Option>
<Option value="1">运行中</Option>
</Select>
)} )}
</FormItem> </FormItem>
</Col>
<Col span={8}>
<FormItem label="调用次数"> <FormItem label="调用次数">
{getFieldDecorator('callNo')( {getFieldDecorator('number')(
<InputNumber <InputNumber style={{ width: '100%' }} />
prefix={<Icon type="right" />} )}
placeholder="请输入" </FormItem>
style={{ width: 272 }} </Col>
/> </Row>
<Row gutter={48}>
<Col span={8}>
<FormItem label="更新日期">
{getFieldDecorator('date')(
<DatePicker style={{ width: '100%' }} placeholder="请输入更新日期" />
)}
</FormItem>
</Col>
<Col span={8}>
<FormItem label="使用状态">
{getFieldDecorator('status3')(
<Select placeholder="请选择" style={{ width: '100%' }}>
<Option value="0">关闭</Option>
<Option value="1">运行中</Option>
</Select>
)}
</FormItem>
</Col>
<Col span={8}>
<FormItem label="使用状态">
{getFieldDecorator('status4')(
<Select placeholder="请选择" style={{ width: '100%' }}>
<Option value="0">关闭</Option>
<Option value="1">运行中</Option>
</Select>
)} )}
</FormItem> </FormItem>
</Col>
</Row>
<div>
<span style={{ float: 'right' }}>
<Button type="primary" htmlType="submit">查询</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>重置</Button>
<a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
收起 <Icon type="up" />
</a>
</span>
</div> </div>
)
}
</Form> </Form>
);
}
renderForm() {
return this.state.expandForm ? this.renderAdvancedForm() : this.renderSimpleForm();
}
render() {
const { rule: { loading: ruleLoading, data } } = this.props;
const { selectedRows, modalVisible, addInputValue } = this.state;
const menu = (
<Menu onClick={this.handleMenuClick} selectedKeys={[]}>
<Menu.Item key="remove">删除</Menu.Item>
<Menu.Item key="approval">批量审批</Menu.Item>
</Menu>
);
return (
<PageHeaderLayout title="查询表格">
<Card bordered={false}>
<div className={styles.tableList}>
<div className={styles.tableListForm}>
{this.renderForm()}
</div> </div>
<div className={styles.tableListOperator}> <div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>新建</Button> <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>新建</Button>
......
...@@ -10,13 +10,16 @@ ...@@ -10,13 +10,16 @@
} }
} }
.tableListForm :global(.ant-form-item) { .tableListForm {
margin-right: 48px; :global {
margin-bottom: 8px; .ant-form-item {
} margin-bottom: 24px;
display: flex;
.formButton { }
white-space: nowrap; .ant-form-item-control-wrapper {
flex: 1;
}
}
} }
@media screen and (max-width: @screen-lg) { @media screen and (max-width: @screen-lg) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment