| | |
| | | import React, {Component} from 'react' |
| | | import { Row, Col, Icon, Radio, Input } from 'antd' |
| | | import { Row, Col, Icon, Radio, Input, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const { Search } = Input |
| | |
| | | <div className={'ant-card ant-card-bordered ' + (card.selected ? 'selected' : '')} > |
| | | <div className="base" onClick={this.changeSelect}> |
| | | <Icon type="check" /> |
| | | <p title={card.field}>字段: <span>{card.field}</span></p> |
| | | <p title={card.label}>名称: <span>{card.label}</span></p> |
| | | <p title={card.field}>{this.props.dict['header.form.field']}: <span>{card.field}</span></p> |
| | | <p title={card.label}>{this.props.dict['header.form.name']}: <span>{card.label}</span></p> |
| | | </div> |
| | | {type === 'search' ? |
| | | <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> |
| | |
| | | dataSource: props.data, |
| | | selectCards: props.data.filter(item => item.selected), |
| | | type: props.type, |
| | | searchKey: '' |
| | | searchKey: '', |
| | | loading: false |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | reset = () => { |
| | | this.setState({ |
| | | searchKey: '', |
| | | loading: true |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { dataSource, type } = this.state |
| | | const { dataSource, type, loading } = this.state |
| | | |
| | | return ( |
| | | <div className="common-modal-edit-card"> |
| | | <Row className="search-row"> |
| | | <Col span={8}> |
| | | <Search placeholder="请输入字段名" onSearch={value => {this.setState({searchKey: value})}} enterButton /> |
| | | {!loading ? <Search placeholder={this.props.dict['header.form.field.placeholder']} onSearch={value => {this.setState({searchKey: value})}} enterButton /> : null} |
| | | </Col> |
| | | <Col span={8}> |
| | | <Button onClick={this.reset}> |
| | | {this.props.dict['header.reset']} |
| | | </Button> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | |
| | | if (item.field.toLowerCase().indexOf(this.state.searchKey.toLowerCase()) >= 0) { |
| | | return ( |
| | | <Col key={index} span={8}> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} changeCard={this.changeCard} /> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} dict={this.props.dict} changeCard={this.changeCard} /> |
| | | </Col> |
| | | ) |
| | | } else { |