From c39ea1f23d21b070188abcf5f4dd5bdd7b47c1f9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 10 三月 2020 10:32:13 +0800 Subject: [PATCH] 2020-03-10 --- src/tabviews/tableshare/topSearch/index.jsx | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/tabviews/tableshare/topSearch/index.jsx b/src/tabviews/tableshare/topSearch/index.jsx index 4222f5a..3107b87 100644 --- a/src/tabviews/tableshare/topSearch/index.jsx +++ b/src/tabviews/tableshare/topSearch/index.jsx @@ -172,7 +172,7 @@ if (item.type === 'text') { // 鏂囨湰鎼滅储 fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} </Form.Item> @@ -180,7 +180,7 @@ ) } else if (item.type === 'select') { // 涓嬫媺鎼滅储 fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: item.initval })( <Select @@ -200,7 +200,7 @@ } else if (item.type === 'multiselect') { // 涓嬫媺澶氶�� let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: _initval })( <Select @@ -220,7 +220,7 @@ ) } else if (item.type === 'date') { // 鏃堕棿鎼滅储 fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'days') : null })( <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> @@ -230,7 +230,7 @@ ) } else if (item.type === 'datemonth') { fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'month') : null })( <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> @@ -240,7 +240,7 @@ ) } else if (item.type === 'dateweek') { fields.push( - <Col span={6} key={index}> + <Col span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null })( <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> @@ -261,7 +261,7 @@ } fields.push( - <Col className="daterange" span={6} key={index}> + <Col className="daterange" span={item.ratio || 6} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, { @@ -280,29 +280,18 @@ } }) - if (this.props.searchlist.length >= 4) { // 娣诲姞鎼滅储銆侀噸缃寜閽� - fields.push( - <Col span={this.props.searchlist.length % 4 ? 6 : 24} style={{paddingLeft: '112px', whiteSpace: 'nowrap'}} key="actions"> + fields.push( + <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> + <Form.Item label={' '} colon={false}> <Button type="primary" htmlType="submit"> {this.props.dict['main.search']} </Button> <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> {this.props.dict['main.reset']} </Button> - </Col> - ) - } else { - fields.push( - <Col span={6} style={{ paddingTop: '4px', whiteSpace: 'nowrap' }} key="actions"> - <Button type="primary" htmlType="submit"> - {this.props.dict['main.search']} - </Button> - <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> - {this.props.dict['main.reset']} - </Button> - </Col> - ) - } + </Form.Item> + </Col> + ) return fields } @@ -402,8 +391,19 @@ } render() { + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + return ( - <Form className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> + <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> <Row gutter={24}>{this.getFields()}</Row> </Form> ) -- Gitblit v1.8.0